Back at it

Back in the Code Saddle!

Hey everyone! It’s been a little while (over a month, whoops!), but I’m excited to share that I’m back on my LeetCode journey.

Just a quick recap: * I kicked things off back in February and managed to tackle over 80 problems in about ten weeks. * Then life got a bit hectic with work, and my coding practice took a bit of a backseat for a few weeks. * But now, here we are in week fifteen, and I’m thrilled to be back on track with a fresh plan!

This new chapter comes with an interesting opportunity on the horizon. While things are still busy with my day job, I wanted to create a more streamlined approach to my coding study. My focus is now laser-sharp on strengthening my cold coding skills and getting a better grasp of time and space complexity.

To make this manageable alongside everything else, I’ve decided to tackle two problems per week, each falling under a different general topic. The goal is deep practice with cold coding and daily review of those tricky time and space complexities.

Here’s my plan:

Week 1: Arrays & Hashing (Starting Apr 27, 2025) #

  • Problem 1: 238. Product of Array Except Self - This problem nicely explores prefix and suffix product approaches, leading to an optimal O(n) time complexity solution without division. Consider the space complexity as well.
  • Problem 2: 49. Group Anagrams - You’ve already done this one, which is great! Revisit it with a focus on the time complexity of different hashing approaches (sorting vs. character counting) and why one might be preferred.

Week 2: Two Pointers & Linked Lists (Starting May 4, 2025) #

  • Problem 1: 143. Reorder List - This problem combines linked list manipulation with the two-pointer technique (slow/fast pointer to find the middle) and reversing a list. Analyze the time complexity of each step.
  • Problem 2: 167. Two Sum II - Input Array Is Sorted - You’ve already solved this! Focus on the efficiency of the two-pointer approach (O(n)) compared to a hash map approach (which you likely considered for the unsorted version).

Week 3: Trees & Graph Traversal (Starting May 11, 2025) #

  • Problem 1: 236. Lowest Common Ancestor of a Binary Tree - This classic tree problem can be solved recursively or iteratively. Analyze the time complexity in terms of the number of nodes in the tree.
  • Problem 2: 200. Number of Islands - This problem is a good introduction to graph traversal algorithms like Breadth-First Search (BFS) or Depth-First Search (DFS). Understand the time complexity in terms of the grid size (number of rows and columns).

Week 4: Sliding Window (Starting May 18, 2025) #

  • Problem 1: 76. Minimum Window Substring - This is a challenging problem that effectively uses the sliding window technique with two pointers and a frequency map. Pay close attention to the time complexity of updating the window and the frequency map.
  • Problem 2: 3. Longest Substring Without Repeating Characters - You’ve already done this one. Re-examine your solution and ensure you understand the optimal O(n) time complexity using a sliding window and a set or map.

Week 5: Dynamic Programming (Starting May 25, 2025) #

  • Problem 1: 322. Coin Change - This is a standard dynamic programming problem. Focus on defining the DP state, the base case, and the recurrence relation. Analyze the time complexity based on the number of coins and the target amount.
  • Problem 2: 62. Unique Paths - This is a simpler DP problem that can also be solved combinatorially. Understand the DP approach and its time complexity related to the dimensions of the grid.

Week 6: Backtracking & Greedy (Starting Jun 1, 2025) #

  • Problem 1: 78. Subsets - This problem can be solved using backtracking. Understand how the recursive calls build up the subsets and analyze the time complexity, which is related to the number of possible subsets.
  • Problem 2: 455. Assign Cookies - This problem demonstrates a greedy approach. Understand why the greedy strategy works here and analyze the time complexity, which is dominated by sorting.

So, how did Week 1 go? In a word: great! I felt a familiar energy as I dove back in, building on the healthy study habits I established in my initial ten weeks. I genuinely enjoy the challenge of LeetCode problems – those little puzzles that sometimes unlock fascinating computer science concepts I never formally learned (like building that min-heap from scratch in JavaScript – so cool!).

This week, the focus was on Arrays & Hashing. I really concentrated on being able to sit down with a problem description and code a solution from scratch based on the concepts in my head. By the end of the week, the solutions felt pretty ingrained, which was exactly the goal for my cold coding practice. I also made it a point to review time and space complexity every day. It’s still an area where I’m growing, but I feel like consistent practice will get me more comfortable talking about it. I even picked up a handy JavaScript shorthand for iterating through loops: for (const str of strs).

That’s the scoop for Week 1! Next week, I’m diving into Two Pointers & Linked Lists. I had hoped to create dedicated problem pages, but time is a bit tight right now.

Onward!