Day 1: LeetCode Two Sum

Posted on March 12, 2026

In an effort to better myself, I've decided to take it upon me to commit to 30 minutes of Leetcode or system design practice a day. Not that I've been ignoring Leetcode, but I tend to grind it before interviews (which I don't get anyways) but it's good to build habits. It doesn't matter if I finish, just that I do it. So today is day 1 of that practice, starting with the Top 150 Interview Questions.

Anyways, starting at the top, we have the classic two-sum. Now, going in, I knew I'd have to use a two-pointer. I ended up with this solution, passing 18 out of 50 or so of the testcases.

day1habit
Incorrect Two-sum solution

Not very pretty.

I started from the beginning, trying to figure out how to move my way forward. The base cases were easy enough, but figuring out how to get the numbers to merge was harder. I was able to get the first four numbers of a six number list, but the rest were eluding me, as shown by the hacksaw solution of an if statement I ended up with. I also ended up with a ton of syntax issues. By the end of the 30 minutes, I wasn't really any closer to the actual solution, and I couldn't really think of where I went wrong. Because it was such a fundamental problem, I took a peek at the solution. I was supposed to go backwards.

Takeaways: Two-sums start at the end, especially in a sorted list, in order to avoid issues with swapping numbers already in place.

I'll revisit this one in a week, but it does end in failure. Regardless, a rather telling start to the habit.