Hiprup
·8 min read

How to Crack a Coding Interview in 2 Weeks: A Study Plan

A focused 14-day plan to prep for coding interviews — patterns, daily problem targets, and how to practice DSA efficiently when you're short on time.

Two weeks is enough time to meaningfully improve your coding interview performance — if you use it strategically. The biggest mistake candidates make is grinding random LeetCode problems without a plan. You'll solve 50 problems and still freeze on easy arrays. This guide gives you a pattern-first, time-boxed plan that covers the ground that actually shows up in interviews.


The 2-week strategy

The core insight: coding interviews test a small set of patterns, not an infinite problem space. Once you recognize the pattern — sliding window, BFS, two pointers — the solution becomes a structured exercise, not a puzzle. Your job in two weeks is to internalize ~8 patterns deeply rather than skim 200 problems shallowly.

Rules for the plan:

  1. Time-box each problem to 25 minutes. If you're stuck after 25 minutes, read the hint or solution, understand it, and move on. Staring at a problem for 3 hours is not practice — it's suffering.
  2. Write solutions on paper or a blank editor (no autocomplete). Interviews don't give you autocomplete. Train how you'll perform.
  3. After solving, ask yourself: Could I explain this to someone else? Can I state the time and space complexity? Could I code it again cleanly in 15 minutes?
  4. Do at least one mock interview in Week 2. Solving problems alone doesn't prepare you for the pressure of explaining your thinking in real time.

Daily commitment: 2–3 hours is enough. More than that leads to fatigue and diminishing returns in a two-week sprint.


Week 1: Core patterns

Week 1 covers the patterns that appear most frequently. These patterns alone cover roughly 60–70% of coding interview problems.

Day 1–2: Arrays and strings

The foundation. Every other topic builds on array manipulation.

Patterns:

  • Two-pass with prefix/suffix (e.g., product of array except self)
  • Sorting as a preprocessing step
  • Character frequency with a hash map or fixed-size array (for lowercase ASCII)

Problems to do (Easy → Medium):

  • Two Sum (hash map pattern)
  • Best Time to Buy and Sell Stock (one-pass max/min)
  • Valid Anagram (character count)
  • Longest Common Prefix
  • Product of Array Except Self

Key insight: For string problems, always ask: can I sort the characters? Can I use a frequency array of size 26? These two questions unlock half of string problems.

Day 3: Hashing and frequency maps

When you need to count occurrences, detect duplicates, or group elements — reach for a hash map.

Patterns:

  • Frequency map (count elements, then query)
  • Group by key (group anagrams → sort each word as the key)
  • Complement lookup (Two Sum: store target - x as you go)

Problems to do:

  • Group Anagrams
  • Top K Frequent Elements (hash map + heap or bucket sort)
  • Subarray Sum Equals K (prefix sum + hash map)

Day 4: Two pointers

Two pointers reduce O(n²) brute-force solutions to O(n) by using the sorted order or a shrinking window.

Patterns:

  • Left/right pointers from opposite ends (container with most water, 3Sum)
  • Slow/fast pointer (detect cycle, find middle of linked list)
  • Read/write pointer (remove duplicates in-place)

Problems to do:

  • 3Sum
  • Container With Most Water
  • Move Zeroes
  • Linked List Cycle (fast/slow)
# Two-pointer template (sorted array, looking for pair summing to target)
left, right = 0, len(nums) - 1
while left < right:
    s = nums[left] + nums[right]
    if s == target:
        return [left, right]
    elif s < target:
        left += 1
    else:
        right -= 1

Day 5: Sliding window

Sliding window solves "longest/shortest subarray/substring with property X" in O(n).

Patterns:

  • Fixed-size window (average of subarrays of size k)
  • Variable-size window with a shrink condition (longest substring without repeating characters)

Problems to do:

  • Longest Substring Without Repeating Characters
  • Minimum Window Substring
  • Fruit Into Baskets

Template: expand the right pointer, then shrink the left pointer when the window violates the constraint.

Day 6: Stacks and queues

Stack problems usually involve "nearest larger/smaller element" or parsing balanced structures.

Patterns:

  • Monotonic stack (next greater element, largest rectangle in histogram)
  • Validate balanced brackets
  • Evaluate expressions

Problems to do:

  • Valid Parentheses
  • Daily Temperatures (monotonic stack)
  • Min Stack (design)
  • Evaluate Reverse Polish Notation

Day 7: Review + easy mocks

Revisit the problems you found hardest in Days 1–6. Solve 2–3 of them again cold (no peeking). Then do a 45-minute timed session: pick one medium problem, write a complete solution with complexity analysis, as if you were in an interview.


Week 2: Trees, graphs, DP, and mocks

Week 2 builds on the Week 1 foundation and adds the deeper topics that appear in mid-to-senior roles.

Day 8–9: Binary trees and BSTs

Patterns:

  • Recursive DFS (preorder, inorder, postorder) — most tree problems are a recursive DFS variant
  • BFS with a queue (level-order traversal, finding level-wise properties)
  • The "root to leaf path" pattern (path sum, all paths)

Problems to do:

  • Maximum Depth of Binary Tree
  • Invert Binary Tree
  • Binary Tree Level Order Traversal (BFS)
  • Lowest Common Ancestor of a BST
  • Validate Binary Search Tree
# DFS template — almost every tree problem fits this shape
def dfs(node):
    if not node:
        return base_case
    left = dfs(node.left)
    right = dfs(node.right)
    return combine(left, right, node.val)

Day 10: Graphs

Representations: adjacency list (most common in interviews), adjacency matrix.

Patterns:

  • BFS for shortest path (unweighted graph)
  • DFS/BFS for connected components, island counting
  • Topological sort (course schedule, task ordering) — use Kahn's algorithm (BFS) or DFS with a visited set

Problems to do:

  • Number of Islands (DFS flood fill)
  • Clone Graph (BFS + hash map)
  • Course Schedule (topological sort / cycle detection)
  • Word Ladder (BFS + level tracking)

Day 11: Dynamic programming

DP is about recognizing overlapping subproblems and optimal substructure — then either memoizing top-down or filling a table bottom-up.

Common DP shapes:

  • 1D array: Fibonacci, Climbing Stairs, House Robber
  • 2D grid: Unique Paths, Minimum Path Sum
  • Subsequence: Longest Common Subsequence, Edit Distance
  • Knapsack: Coin Change, 0/1 Knapsack

Problems to do:

  • Climbing Stairs (classic warm-up)
  • Coin Change (BFS or bottom-up DP)
  • Longest Increasing Subsequence
  • Word Break

Approach: define the state clearly first. "dp[i] is the minimum cost to reach step i." Write the recurrence before writing code.

Heap (priority queue): use for "top K", "K closest", "merge K sorted lists". In Python: heapq (min-heap by default; negate for max-heap).

Binary search: don't just use it for "find a value in a sorted array." Binary search on the answer is a powerful pattern: "find the minimum capacity to ship packages in D days" — binary search on capacity, check feasibility.

Problems to do:

  • Kth Largest Element in an Array (heap or quickselect)
  • Find Minimum in Rotated Sorted Array
  • Search in Rotated Sorted Array
  • Median of Two Sorted Arrays

Day 13: Full mock interviews

Do two 45-minute mock interviews today — back to back if possible. Use a platform with a real interviewer or a peer who knows the material. If solo, use a timer and talk out loud while solving.

What to practice:

  • Saying "let me think about the brute force first" — interviewers want to see you think in steps, not stall in silence.
  • Writing the function signature and a few test cases before coding.
  • Checking edge cases before you declare yourself done: empty input, single element, all duplicates, overflow.

Day 14: Weak spots + final review

Look back at your notes from the past 13 days. Identify the 2–3 pattern types where you're least confident and spend the morning on them. In the afternoon, do one light mock and rest. Don't cram new material the day before an interview.


How to practice each problem effectively

Step 1: Read carefully. Identify what the problem is asking and what constraints exist (array size, value range, sorted?).

Step 2: Think aloud about the brute force. Even if it's O(n²), saying "the naive approach would be nested loops" shows your thinking.

Step 3: Identify the pattern. What does this problem remind you of? Frequency map? Sliding window? BFS?

Step 4: Code the solution cleanly. Use meaningful variable names. Structure your code so an interviewer can follow it.

Step 5: State the complexity. Time: O(?) and Space: O(?). Be ready to explain why.

Step 6: Test with examples. Walk through the code with a small input, then check edge cases (empty, single element, already sorted).

Step 7: After the session: Write a one-line note ("Sliding window, shrink when char count > k") for each pattern you used. This reinforces the mental model.


Wrap-up

Two weeks is enough to go from rusty to competitive — but only if you focus on patterns over problem count. After your interview, whether you pass or not, keep the habit: one problem a day takes 20 minutes and keeps your skills sharp indefinitely. The candidates who consistently pass coding interviews aren't geniuses — they're people who've seen enough patterns that very little surprises them.

Practice 500 DSA problems on Hiprup