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:
| Phase | Time | What to Do |
|---|---|---|
| Read All Problems | 3–5 min | Skim all three problems. Identify the easy one to start with. Note constraints and edge cases. |
| Problem 1 (Easy) | 10–15 min | Solve quickly. This is your confidence builder. Do not over-optimize. |
| Problem 2 (Medium) | 15–20 min | Plan before coding. Write pseudocode, identify the pattern, then implement. |
| Problem 3 (Hard) | 20–25 min | If stuck after 5 minutes of planning, write brute force first, then optimize. |
| Review | 5 min | Check 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:
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:
| Step | Action | Time |
|---|---|---|
| Understand | Restate the problem. Clarify inputs, outputs, constraints. Ask: what are the edge cases? | 2 min |
| Match | Match to a known pattern: sliding window, two pointers, BFS, DP, etc. | 1 min |
| Plan | Write pseudocode. Walk through one example by hand. | 3 min |
| Implement | Translate pseudocode to code. Use meaningful variable names. | 10 min |
| Review | Trace through your code with the example. Check edge cases. | 2 min |
| Evaluate | State 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:
The 4-Week Speed Building Plan
| Week | Focus | Target |
|---|---|---|
| Week 1 | Easy problems only. 15 min each. Focus on UMPIRE method. | 5 problems/day |
| Week 2 | Easy + Medium mix. 20 min each. Start identifying patterns. | 3–4 problems/day |
| Week 3 | Medium problems. 25 min each. Practice moving on when stuck. | 3 problems/day |
| Week 4 | Full mock exams (this course). 60 min sessions. Review everything. | 1 exam/day |
Common Time Wasters to Avoid
| Time Waster | How to Fix |
|---|---|
| Coding before planning | Always write pseudocode first. 3 minutes of planning saves 10 minutes of debugging. |
| Debugging with print statements | Trace through code mentally or on paper. Use a debugger only as last resort. |
| Optimizing too early | Get brute force working first. Optimize only if you have time. |
| Not reading constraints | Constraints tell you the expected complexity. n ≤ 10&sup5; means O(n log n) or O(n). |
| Perfectionist variable naming | Use short but clear names: l, r for pointers, res for result, cnt for count. |
Lilly Tech Systems