1. Patterns > Memorization
When I first started LeetCode, I tried to brute-force my way through problems with raw logic and trial-error. Big mistake. By week 2, I started noticing repeating problem patterns:
- Sliding Window for contiguous subarrays
- Two Pointers for sorted arrays
- HashMaps for frequency counts or prefix sums
- DFS/BFS for trees and graphs
- Backtracking for permutations/combinations
Learning these patterns made problems 10x easier to approach—even the hard ones.
Example: Two Sum
Classic problem. Here’s a quick JavaScript solution using a HashMap:
function twoSum(nums, target) {
const map = new Map();
for (let i = 0; i < nums.length; i++) {
const complement = target - nums[i];
if (map.has(complement)) {
return [map.get(complement), i];
}
map.set(nums[i], i);
}
}
Time complexity: O(n)
Space complexity: O(n)
2. Read Discussions—But Only After 30 Minutes
Yes, the LeetCode discussion tab is filled with gold… and traps. If you jump in too early, you miss the struggle—which is the key part of learning.
What worked for me:
- Spend at least 30 minutes on a problem before peeking.
- Then read 2–3 top answers and compare with my own.
Sometimes, the insight I needed was just one smart variable name or a recursive thought away.
3. Easy ≠ Useless
Many people skip Easy problems. But here’s the thing—Easy problems build speed, and speed matters when you’re solving 3–4 problems in a timed interview. I practiced 10 easy problems a day for 2 weeks—and it drastically improved my:
- Code typing speed
- Edge case thinking
- Confidence
4. It’s a Marathon, Not a Sprint
You can’t cram algorithms. You need spaced repetition. Here’s my weekly schedule that helped me stay consistent:
Day | Focus |
---|---|
Mon | Arrays & Hashing |
Tue | Recursion & Backtracking |
Wed | Binary Trees |
Thu | Graphs |
Fri | Review tricky problems |
Sat | Mock interviews |
Sun | REST day (review notes only) |
5. Debugging > Code Writing
I spent more time debugging than writing code. But I got smarter by asking:
- “What’s the base case here?”
- “What happens when the input is empty?”
- “What’s the edge case with max/min values?”
I kept a “bug journal” where I noted my mistakes and lessons. Here’s a mistake I made in recursion early on:
def factorial(n):
if n == 0:
return 1
factorial(n - 1) * n # no return!
Fixed:
def factorial(n):
if n == 0:
return 1
return factorial(n - 1) * n
6. You Grow by Facing “Mediums” and “Hards”
I avoided Hard problems at first (who doesn’t?). But tackling a few each week stretched my thinking. Even if I didn’t solve them alone, I understood advanced techniques like:
- Segment Trees
- Union Find
- Bit Manipulation
- Trie structures
Even solving 20% of a Hard problem made the next Medium easier.
My Toolkit
Here’s what helped me stay productive:
- LeetCode Premium (especially for company-specific questions)
- Neetcode.io for curated patterns
- Notion to track solved questions and patterns
- VS Code with LeetCode plugin for local testing
Final Thoughts
After 100 hours, I’m still learning. But now I don’t panic when I see a blank code editor. I see structure, possibilities, and patterns.
So whether you’re preparing for FAANG interviews or just leveling up—stick with it. LeetCode is not about grinding to perfection. It’s about learning how to think like a problem solver.
Let’s Connect!
Have you started your LeetCode journey? Share your tips or questions in the comments! Or find me on GitHub / LinkedIn / Dev.to