Skip to main content

What Are Speed Drills?

Speed drills are short, repetitive, high-intensity DSA implementation exercises designed to:
  • Improve code recall speed (from concept to code).
  • Build muscle memory for common algorithms and patterns.
  • Reduce the cognitive load in real interviews (so you think about approach, not syntax).
  • Increase your ability to write bug-free template code under pressure.
Think of them as the LeetCode equivalent of warm-up and sprint intervals in athletic training. You’re not solving new problems here — you’re practicing templates and pattern recognition until they become second nature.

What Comes Under Speed Drills? (Types of Drills)

Speed drills focus on the core algorithmic building blocks that form 90% of coding interviews. We’ll divide them by category.

1. Core Algorithmic Templates (Implement Blindly)

These are must be able to write in 2 mins items:
CategoryAlgorithmTime TargetNotes
GraphsDFS (recursive + iterative)2mMust handle visited[] + edge cases
GraphsBFS (queue-based)2mStandard template
GraphsTopological Sort (Kahn + DFS)3mPractice both
TreesPre/In/Post-order traversal2mWrite all 3 without thinking
TreesLevel-order traversal2mBFS variant
DPMemoization + Tabulation templates4mE.g., Fibonacci, Knapsack, LIS
ArraysTwo pointers2mMove left/right until condition
ArraysSliding window2mVariable window size
SearchingBinary Search + variants2mFirst/last occurrence, boundary
HeapsInsert, Pop, Heapify2mMin/max heap operations
Linked ListsReverse, Merge, Find cycle2mFast/slow pointer mastery
HashingFrequency map pattern1.5mdict counter
SortingQuickSort, MergeSort skeleton3miterative + recursive
RecursionBacktracking skeleton3mbase + loop + undo step
Stack/QueueMonotonic Stack + Queue3m“next greater element”
Bit ManipulationSet/Clear/Toggle/Get2mFundamental ops
MathGCD/LCM, Sieve of Eratosthenes3mMust recall syntax

2. Pattern-Based Recognition Drills

Once you can code the base templates fast, you move to pattern recognition speed drills — identifying the pattern from problem statements within 1–2 minutes. Common Drills:
Pattern NameTypical ProblemsKey Idea
Sliding Window“Max sum subarray”, “Longest substring without repeat”Expand & shrink window dynamically
Two Pointers“Container with most water”, “Three sum”Move inward to meet condition
Binary Search on Answer“Aggressive cows”, “Capacity to ship packages”Binary search feasible region
DFS/BFS Graph“Number of Islands”, “Rotten Oranges”Traverse connected components
Union-Find“Friend circles”, “Accounts merge”Grouping / connectivity
Topological Sort“Course Schedule”Dependency resolution
Backtracking“N-Queens”, “Subset sum”Explore + undo
DP 1D“House Robber”, “Fibonacci”dp[i] from dp[i-1], dp[i-2]
DP 2D“LCS”, “Knapsack”2D grid transitions
Prefix Sum“Subarray sum K”, “Range query”Precompute cumulative sums
Greedy“Intervals”, “Job sequencing”Sort + choose locally optimal
HashMap/Freq“Anagram check”, “Majority element”Counting & lookup
Heap“Kth largest”, “Merge k lists”Maintain min/max heap
Sorting + Merge“Intervals merge”, “Meeting rooms”Sort, then merge

3. Structural “Mini Drills”

These are mini 10–15 min sets of 4–6 tiny tasks, done fast and repeatedly. Example structure for a “Graph drill” session:
Drill 1: Write DFS (recursive) on adjacency list — stop timer.
Drill 2: Write BFS (queue) — stop timer.
Drill 3: Modify DFS to detect a cycle in directed graph.
Drill 4: Write Topo Sort (DFS + Stack).
Drill 5: Write Kahn’s algorithm (queue-based topo).
Drill 6: Add time & space complexity annotation.
Total time: 10–15 minutes. Repeat daily for different topics.

When to practice?

1. Daily Micro Speed Drill (5–15 minutes)

  • Every weekday, during your DSA session, end with speed drills.
  • Pick 1 topic per day (cycling weekly):
DayTopic
MonGraphs (DFS/BFS)
TueTrees
WedArrays / Two pointers
ThuBinary search / DP
FriMisc (heaps, math, stack)

2. Weekly Deep Speed Session (Saturday, 45–60m)

  • Every weekend morning (after 1–2h of regular DSA):
    • Pick 2 core patterns (e.g., DP + Sliding Window).
    • Write 5 problems each from memory, timed.
    • Compare to target thresholds (see below).
  • Track in your Speed Log Sheet (problem | pattern | time | correctness | notes).
ProblemPatternTime (m)PassNotes
DFS recursiveGraph2.0Fine
BFSGraph1.8Good
Detect CycleGraph3.5⚠️Review logic

4. Speed Targets & Measurement

Every 2 weeks, your median implementation time across 10 speed drills should hit the targets:
WeekTarget Template TimeExample
Week 1–25–6 minDFS from scratch
Week 3–43–4 minBFS, Two-pointer
Week 5–62.5–3 minDP skeleton
Week 7–82 minGraphs, Arrays, Linked list
Week 9–101.5–2 minSliding window
Week 11–121–1.5 minFinal performance

5. How to Perform a Speed Drill (exact steps)

  1. Pick a template topic (e.g., BFS).
  2. Set timer (e.g., 3 minutes).
  3. Start writing from memory — no IDE autocomplete.
  4. Code complete function with small test harness (optional).
  5. Stop timer.
  6. Verify correctness quickly (does it compile/return expected).
  7. Record time + error count in log.
  8. Repeat 5–6 times with small variations (directed/undirected, recursive/iterative).
DrillTopicTime (min)ErrorsNotes
1DFS recursive2.30OK
2BFS queue2.10OK
3Topo Sort DFS3.41Missed stack push
4Topo Sort Kahn2.80Perfect
5Detect cycle3.20OK

6. Speed Drill Kit Setup

speed_drills/
├── graph_dfs_bfs.py
├── topo_sort_dfs_kahn.py
├── two_pointer_sliding_window.py
├── binary_search_variants.py
├── dp_memo_tab.py
├── heap_operations.py
├── linked_list_reverse_merge.py
├── stack_queue_monotonic.py
├── recursion_backtracking.py
├── bit_ops.py


Program

Key components:
  • Weekly short speed drills (daily micro-sessions)
  • Weekly long speed drills (one session per week)
  • Coverage mapping (which topics/pattern groups from the sheet map to which drill weeks)
  • Tracking & metrics (time logs, error logs, improvement targets)
  • Variation & review (once you’ve coded, revisit the hardest ones, add to SRS)

Mapping

Topic ClusterKey Patterns / Templates to Drill
Basic programming/build-up (first ~30)Print recursion, basic loops, sum, factorial — drill minimal extra but ensures syntax fluency.
Sorting & SearchingQuickSort/MergeSort skeleton, binary search variants, 2D array search.
Arrays & MathTwo pointers, sliding window, prefix sums, fast arithmetic.
StringsKMP/Z-algorithm, substring search, string matching templates.
Linked ListsReverse, merge, cycle detection, fast/slow pointer.
Stacks/QueuesMonotonic stack, implement stack/queue, next greater element.
Trees/BSTTraversals, LCA, level-order, reconstruct tree skeletons.
GraphsDFS/BFS iterative & recursive, cycle detect, topological sort, shortest path skeletons.
Dynamic Programming1D/2D dp, memo→tabulation conversions, knapsack, LIS.
Bit ManipulationBasic bit ops, masks, toggle, count bits.
Advanced DS (Tries, Segment Trees, Union-Find)Tries insert/search, union-find union/find template, segment tree build/query.
Mixed/Hybrid problemsCombine patterns: sliding window + bitmask, graph + dp, etc.

Weekly Short & Long Sessions (12-Week Drill Schedule)

WeekTopic FocusDaily micro-drill patternSaturday long drill (45-60min)
W1Arrays & Math basics1 array template per day (two-pointer / prefix)Pick 4 array problems from sheet, time each, target 4min each
W2Strings + SortingEach day: string template or sorting template (quick sort skeleton)Drill: 3 string problems + 2 sorting problems
W3Linked Lists + Stacks/QueuesDay: reverse list, merge list, monotonic stackDrill: 2 linked-list problems + 2 stack/queue problems
W4Trees/BST basicsDay: traversal skeletons, LCA skeletonDrill: 3 tree problems (easy→medium)
W5Graph fundamentalsDay: DFS, BFS templatesDrill: 4 graph problems (component, cycle detect)
W6Binary Search & Math/BitDay: binary search variants, bit opsDrill: 3 binary search + 2 bit-manip problems
W7Dynamic Programming (basic)Day: 1D dp, memo → tabulationDrill: 4 dp problems (easy/medium)
W8Backtracking & HybridDay: recursion/backtracking skeletonsDrill: 3 backtracking + 2 hybrid (dp+graph)
W9Advanced DS (Tries/Union-Find/Segment)Day: trie insert/search, union-find union/findDrill: 3 advanced DS problems
W10Greedy + Mixed PatternsDay: greedy skeleton (intervals) + mixedDrill: 2 greedy + 2 mixed pattern problems
W11Speed consolidationDay: pick weakest templates & redoDrill: 5 problems drawn from your error log, target 3min each
W12Final sweep & weak-pointsDay: alternate templates every dayDrill: 5 problems (mixed topics) with full speed target 2min where possible

Coverage Strategy over 450 Problems

  • Map the 450 problems into the topic clusters (as above). Each week you handle new problems + revisit older ones via speed drills.
  • Use a problem queue: Each week, assign “new problems” from the sheet (target: ~38 problems/week). Among them, select 5–10 as speed-drill candidates (i.e., templates you’ll learn to write fast).
  • Mark them in your spreadsheet with categories:
    • T = Template (for speed drills)
    • R = Re-solve (timed)
    • D = Deep-fix (hard / failed) Make sure every template problem appears in a daily micro-drill within that week/one after.

Example Week 1 Speed Drill Plan (detailed)

Week 1 (Arrays & Math Basics) Daily micro-drill topics:
  • Mon: Two-pointer skeleton (e.g., “3Sum”)
  • Tue: Prefix-sum skeleton (e.g., “Subarray Sum K”)
  • Wed: Sliding window skeleton (e.g., “Longest Substring Without Repeating”)
  • Thu: Basic sorting skeleton (e.g., “Merge two sorted arrays without extra space”)
  • Fri: Math/array variant (e.g., “Kadane’s algorithm for max subarray sum”)
  • Saturday long drill: pick 5 problems from sheet (Arrays medium/hard) → time each, review.
  • Sunday: Weekly topic test on Arrays (timed) + speed drill review (convert templates you failed into SRS cards).