DEV Community

Huynh Nguyen
Huynh Nguyen

Posted on

How I Beat the LeetCode Grind with Tiny Habits

✍️ Inspired by Gayle Laakmann McDowell (Cracking the Coding Interview)

💡 Backed by BJ Fogg’s Tiny Habits Method


🚀 How I Beat the LeetCode Grind

Many people quit solving LeetCode or CTCI problems after 1–3 weeks.

Why?

Because the problems are hard, the learning curve is steep, and there are just too many to go through.

But what if the solution isn’t grinding harder — it’s starting smaller?

That’s exactly what I discovered by combining two powerful ideas:

  • Gayle McDowell’s strategy: Brute-force first, then optimize
  • BJ Fogg’s Tiny Habits method: Build momentum with small wins

🎯 My 3-Phase System

Here’s the simple system I followed that helped me stay consistent, get faster, and actually enjoy the process.


🌱 Phase 1: Starter

  • 👣 Solve 1 problem every 1–3 days
  • Take your time. Understand brute force deeply.
  • Build the habit, not speed.

Once you complete 15 problems, move to Phase 2.


🧠 Golden Rule (All Phases)

For every problem, always do this:

  1. Start with brute-force (even if it's O(n²))
  2. ⚙️ Think of optimizations → can you get to O(n)?
  3. 🧠 Write your thought process before coding

This mirrors how top candidates explain their ideas in interviews — just like Gayle recommends in Cracking the Coding Interview.


🔥 Phase 2: Warmer

Now you’re more confident. Let’s build retention and recall.

Use the 1–1–1 strategy daily:

  • 🔁 1 problem from yesterday
  • 🔁 1 from the past 5 days
  • 🆕 1 new problem

✍️ Add These 2 Habits:

  1. Write a Daily Log Example:

🗓️ 2025-07-28
✅ Problem: Daily Temperatures
🧠 Brute: nested loop
⚙️ Optimized: stack → O(n)
🧪 Status: Passed

  1. ** Write UnitTest** Just a few asserts. Helps you catch mistakes fast.

⚡ Phase 3: Speeder

Now layer your memory like spaced repetition.

Use the 1–1–1–1–1 method daily:

  • 1 from yesterday
  • 1 from 5 days ago
  • 1 from 10 days ago
  • 1 from 14 days ago
  • 1 new problem

You’ll be reviewing across time and reinforcing memory naturally — like Anki flashcards but for code.


📊 Track Like a Pro (The Tiny Habits Roller)

Inspired by BJ Fogg, I created a tiny tracking system to build momentum.

✅ Option 1: Google Sheet

No Date Time Problem Difficulty Phase Approach Status Notes
1 2025-07-28 05:00 Daily Temperatures Medium Phase II Brute → Stack Used decreasing stack

📝 Option 2: Markdown Log


markdown
## 📆 2025-07-28
### ✅ Problem: Daily Temperatures
- Phase: II
- Difficulty: Medium
- Approach: Brute → Stack (O(n))
- Notes:
- Used stack for next warmer day pattern

You can track this locally or push it to a GitHub repo to showcase your learning journey.

⸻

🧠 Why It Works
    • ✅ Brute-force → Optimize → Test: from Gayle
    • 🧱 Tiny daily wins: from BJ Fogg
    • 🔁 Spaced recall: real learning
    • 🧪 Logs + Tests: real engineering
    • 📊 Track it = Keep it rolling

⸻

✍️ Final Thoughts

If you’re feeling overwhelmed by LeetCode:

Start tiny. Stay consistent.
Build the roller — then let momentum take over.

“Tiny wins today → Big confidence tomorrow.” — Me 😄

⸻

Let me know if you try this system — or have your own method.
Let’s grow together! 🚀

---
Enter fullscreen mode Exit fullscreen mode

Top comments (0)