Beginner

How to Practice Under Time Pressure

The difference between solving a problem in 30 minutes versus 15 minutes is often the difference between passing and failing a coding interview. This lesson teaches you the frameworks, habits, and mental models that make you faster without sacrificing correctness.

The 60-Minute Interview Framework

Most coding interviews give you 45–60 minutes to solve 2–3 problems. Here is how to allocate your time across a 3-problem exam:

PhaseTimeWhat to Do
Read All Problems3–5 minSkim all three problems. Identify the easy one to start with. Note constraints and edge cases.
Problem 1 (Easy)10–15 minSolve quickly. This is your confidence builder. Do not over-optimize.
Problem 2 (Medium)15–20 minPlan before coding. Write pseudocode, identify the pattern, then implement.
Problem 3 (Hard)20–25 minIf stuck after 5 minutes of planning, write brute force first, then optimize.
Review5 minCheck edge cases, fix off-by-one errors, add comments if time allows.

When to Move On

Knowing when to abandon a problem is a critical skill. Use the 5-Minute Rule:

The 5-Minute Rule: If you have been staring at a problem for 5 minutes without making progress on your approach (not coding — approach), move on. Come back with fresh eyes after solving other problems. A partial solution on 3 problems beats a perfect solution on 1.

Decision Tree for Moving On

Can you identify the problem pattern?
  YES -> Do you know the algorithm?
    YES -> Code it. You should finish in 15-20 min.
    NO  -> Write brute force (5-10 min), then try to optimize.
  NO  -> Spend 5 min brainstorming.
    Found approach? -> Code it.
    Still stuck?    -> Move to next problem. Come back later.

Partial Credit Strategy

In real interviews and on platforms like LeetCode contests, partial credit matters. Here is how to maximize your score even when you cannot find the optimal solution:

📝

1. Always Write Brute Force

A working O(n²) solution scores more than an incomplete O(n) solution. Get something that passes small test cases first.

🎯

2. Handle Edge Cases

Empty input, single element, duplicates, negative numbers. Mentioning these shows thoroughness even if your main algorithm is suboptimal.

📈

3. State Your Approach

Write comments explaining your intended algorithm even if you cannot finish coding it. Interviewers give credit for correct thinking.

📊

4. Analyze Complexity

Always state time and space complexity. This shows you understand the problem deeply, even if your solution is not optimal.

The UMPIRE Method

Use this systematic approach for every problem to avoid wasting time going in the wrong direction:

StepActionTime
UnderstandRestate the problem. Clarify inputs, outputs, constraints. Ask: what are the edge cases?2 min
MatchMatch to a known pattern: sliding window, two pointers, BFS, DP, etc.1 min
PlanWrite pseudocode. Walk through one example by hand.3 min
ImplementTranslate pseudocode to code. Use meaningful variable names.10 min
ReviewTrace through your code with the example. Check edge cases.2 min
EvaluateState time and space complexity. Can you optimize?2 min

Building Speed: Practice Habits

Speed comes from pattern recognition, not from typing faster. Here is how to build it:

💡
Key Insight: Solving 100 problems slowly teaches you less than solving 50 problems under time pressure and reviewing your mistakes. Always practice with a timer.

The 4-Week Speed Building Plan

WeekFocusTarget
Week 1Easy problems only. 15 min each. Focus on UMPIRE method.5 problems/day
Week 2Easy + Medium mix. 20 min each. Start identifying patterns.3–4 problems/day
Week 3Medium problems. 25 min each. Practice moving on when stuck.3 problems/day
Week 4Full mock exams (this course). 60 min sessions. Review everything.1 exam/day

Common Time Wasters to Avoid

Time WasterHow to Fix
Coding before planningAlways write pseudocode first. 3 minutes of planning saves 10 minutes of debugging.
Debugging with print statementsTrace through code mentally or on paper. Use a debugger only as last resort.
Optimizing too earlyGet brute force working first. Optimize only if you have time.
Not reading constraintsConstraints tell you the expected complexity. n ≤ 10&sup5; means O(n log n) or O(n).
Perfectionist variable namingUse short but clear names: l, r for pointers, res for result, cnt for count.
Pro Tip: Before your next mock exam, write down the patterns you know on a cheat sheet: two pointers, sliding window, BFS/DFS, binary search, DP, backtracking, heap, monotonic stack. During the exam, scan this mental list when matching a problem to a pattern.