← All articles
12 min read

What to Do When You're Stuck in a Coding Interview (2026)

Getting stuck in a coding interview is normal, and how you recover is part of the score. Here is a 7-step recovery ladder with time thresholds, plus exact scripts for asking for hints without losing points.

If you're stuck in a coding interview, don't freeze and don't stay quiet. Work through a fixed sequence out loud: restate the problem, solve a small example by hand, state a brute force, find its bottleneck, simplify, and only then ask for a targeted hint. Most interviewers score how you recover from a stall, not just whether you stall, so a visible process can still earn a hire.

This guide gives you a 7-step "stuck recovery ladder" with time thresholds for a typical 45-minute round, exact scripts for asking for hints, and a plan for getting partial credit when the clock runs out.

Key Takeaways

  • Getting stuck is expected. Many interview problems include a twist or follow-up, and the interviewer is watching what you do next.
  • Silence costs you more than wrong ideas. Narrate every step, even "I'm checking whether sorting helps."
  • Climb the ladder in order: restate, example, brute force, bottleneck, pattern check, simplify, then hint. Each rung has a time limit.
  • Ask for a hint at around the 8 to 10 minute mark of real stuckness, and make it narrow: ask about one sub-step, not the whole solution.
  • If you pass the halfway point with no optimal path, code the brute force. Working, tested code beats a perfect idea you never wrote.
  • Practice recovery as a skill, with timed drills and mock interviewers who give deliberately small hints.

Why Is Getting Stuck in a Coding Interview Normal?

Getting stuck is a normal part of coding interviews. Interviewers often pick problems with a twist, a hidden optimization, or a follow-up, so they can see how you reason when the obvious approach stops working. If you solved everything instantly, they would learn little about you.

Many structured interview rubrics score several things separately: problem solving, coding quality, communication, and testing or verification. Our breakdown of what interviewers look for in coding interviews covers these in detail. Being stuck only touches one of them directly. The way you handle it touches all four.

That is why candidates who "didn't finish" sometimes get offers and candidates who "basically solved it" sometimes don't. If you want examples of how that plays out, see whether you can fail a coding interview and still get hired.

Blanking vs. being stuck

These are two different problems with different fixes:

  • Blanking is a stress response. Your working memory shuts down, and you can't think even about things you know. The fix is physical and concrete: slow your breathing, read the prompt aloud, type an example.
  • Being stuck is a reasoning problem. You understand the question but can't see the approach. The fix is a process, which is what the ladder below gives you.

If blanking is your main issue, our guide to technical interview anxiety goes deeper on the stress side.

The Stuck Recovery Ladder: 7 Moves With Time Thresholds

The stuck recovery ladder is a sequence of seven escalating moves, each with a rough time budget. You move up a rung when the current one stops producing progress. The timings below assume a 45-minute round with about 35 minutes for the coding problem. Scale them down for shorter screens.

RungMoveStart by (minutes stuck)What you say out loudWhat the interviewer sees
1Restate and clarify0"Let me restate this to make sure I have it right..."Careful listener, no wasted effort
2Work a small example by hand1"Let me trace a tiny input and see what the answer should be."Concrete reasoning
3State the brute force and its complexity3"The naive way is O(n^2) because..."A baseline exists; you can analyze cost
4Find the bottleneck4"The repeated work is recomputing this sum every time."Real problem solving starts
5Run a pattern checklist5"Could sorting, a hash map, or two pointers remove that?"Breadth of tools
6Simplify or relax the problem7"What if all values were positive? Then..."Strategic thinking
7Ask a targeted hint8 to 10"I think the key is avoiding the rescan. Am I on the right track?"Collaboration, self-awareness

After rung 7, if you still have no path and you are past the halfway point of the round, switch to the salvage plan covered later. Don't stay on the ladder forever.

Rung 1: Restate the problem and the constraints

Many "stuck" moments are actually misreadings. Restate the problem in your own words and confirm input size, value ranges, duplicates, and what to return for empty input. Constraints are clues: an input size near 10^5 usually means you need O(n log n) or better, while a size near 20 often allows exponential search.

Rung 2: Solve a small example by hand

Write a 4 to 6 element input and solve it manually, narrating as you go. Watch what your own brain does. If you found the answer by scanning once while remembering something, that "something" is often the data structure you need.

Rung 3: State the brute force

Say the simplest correct approach and its time and space complexity, even if it's obviously too slow. This does three things: it proves you understand the problem, it gives you a fallback to code later, and it gives you something to optimize. If you need a refresher on cost analysis, keep the Big O notation cheat sheet handy during prep.

Rung 4: Name the bottleneck

Look at the brute force and ask, "What work am I repeating?" Most optimizations remove repeated scanning, repeated sorting, or repeated recomputation of the same sub-result. Saying the bottleneck out loud often triggers the fix.

Rung 5: Run a pattern checklist

Go through common tools quickly and out loud: hash map, sorting, two pointers, sliding window, prefix sums, binary search, heap, stack, BFS or DFS, dynamic programming. Our coding interview patterns cheat sheet maps problem signals to these patterns, which makes this step much faster under pressure.

Rung 6: Simplify the problem

Solve an easier version first. Drop a dimension (1D instead of 2D), assume sorted input, assume no duplicates, or solve for k = 1 before general k. Then ask what breaks when you put the constraint back.

Rung 7: Ask for a targeted hint

By this point you've shown 8 to 10 minutes of structured effort, so a hint looks like collaboration, not surrender. The next section covers how to ask.

How Do You Ask for a Coding Interview Hint Without Losing Points?

Ask for a hint about one specific sub-step and show your current thinking first. A good hint request summarizes what you have, names where you're blocked, and proposes a direction for the interviewer to confirm or redirect. That makes the hint small, and small hints cost little.

Here are scripts you can adapt:

  • Confirm a direction: "I have an O(n^2) solution. I think the repeated work is recomputing the range sum. Is a precomputed structure the right direction, or should I be thinking differently?"
  • Choose between options: "I'm deciding between sorting first and using a hash map. Sorting loses the original indices, which I need. Does that rule it out?"
  • Check a constraint: "Can I assume the input fits in memory? If so, I'd store everything in a map first."
  • Ask for the smallest nudge: "I'm stuck on how to handle negative numbers here. Could you give me a small nudge on that part only?"

Avoid these:

  • "Can you just tell me the approach?"
  • "I don't know," followed by silence.
  • Asking for a hint in the first two minutes before trying anything.
  • Asking the same question again after getting an answer.

How to use a hint once you get it

How you use a hint matters more than whether you needed it. Repeat the hint in your own words, connect it to your bottleneck, and act on it within a minute or two. "Right, so if I store prefix sums in a map, I can check for the complement in O(1), which removes the inner loop." Then start coding.

If the hint doesn't land, say so honestly and ask one clarifying question about it. Nodding and then going silent is the worst outcome.

Stuck halfway through a live round with the clock running? TechScreen is an invisible AI interview assistant that gives you real-time hints, the right pattern, and a complexity breakdown during Zoom, Google Meet, CoderPad, and HackerRank sessions, without showing up on screen share. Start with 3 free tokens, no credit card required.

Get started free →

Worked Example: Climbing the Ladder on a Real Problem

Take a common medium problem: given an integer array and a target k, count the contiguous subarrays whose sum equals k. Values can be negative.

Rung 1: "So I return a count, not the subarrays. Values can be negative, and n could be up to around 2 times 10^4." That constraint already hints that O(n^2) may be borderline.

Rung 2: For [1, 2, 3] and k = 3, the answers are [1, 2] and [3], so the count is 2.

Rung 3: The brute force checks every start and end:

def subarray_sum_brute(nums, k):
    count = 0
    for i in range(len(nums)):
        total = 0
        for j in range(i, len(nums)):
            total += nums[j]
            if total == k:
                count += 1
    return count

"This is O(n^2) time and O(1) space."

Rung 4: "The repeated work is that, for every end index, I'm re-checking every possible start."

Rung 5: "Sliding window won't work because negatives mean the sum doesn't grow monotonically. Prefix sums might, since sum(i..j) is prefix[j] minus prefix[i-1]."

Rung 6: "If I know the prefix sum at j, I need to know how many earlier prefixes equal prefix[j] minus k. That's a lookup."

If you got here, you don't need rung 7. If you didn't, a good hint request would be: "I think prefix sums are involved, but I don't see how to avoid checking all earlier prefixes. Should I store them somehow?"

from collections import defaultdict

def subarray_sum(nums, k):
    seen = defaultdict(int)
    seen[0] = 1
    prefix = 0
    count = 0
    for x in nums:
        prefix += x
        count += seen[prefix - k]
        seen[prefix] += 1
    return count

"O(n) time and O(n) space. The seen[0] = 1 handles subarrays that start at index 0."

Notice that the brute force wasn't wasted. It defined the bottleneck, and the bottleneck pointed to the fix.

How Do You Salvage Partial Credit When You Can't Solve It?

If you're past the halfway point with no viable path to the optimal solution, switch from searching to shipping. Partial credit comes from evidence, and evidence means working code, tests, and clear analysis.

Use this salvage order:

  1. Announce the switch. "Given the time, I'll code the O(n^2) version cleanly, then talk about how I'd optimize."
  2. Code the brute force well. Good names, clear structure, no shortcuts. This is where your coding score comes from.
  3. Test it. Walk through your small example and at least one edge case (empty input, single element, duplicates, negatives). Our debugging interview guide has a quick tracing method.
  4. State the complexity and the bottleneck. Show you know exactly why it's slow.
  5. Sketch the optimization in words. Even an incomplete idea, like "I think a monotonic stack could give each element's next greater value in one pass," shows direction.

What scores higher?

Situation at the end of the roundTypical impression
Optimal solution, coded, tested, explainedStrong signal
Brute force coded and tested, clear bottleneck analysis, partial optimal ideaOften enough for a lean-hire, depending on level and company bar
Optimal idea explained, code half-written and untestedMixed, often weaker than the row above
Long silences, no working code, no clear approachWeak signal

These are general patterns, not a guarantee. The bar changes by level and company, and senior roles usually expect you to reach the optimal approach with less help.

What Do Interviewers Write When You're Stuck?

Interviewers typically write down factual observations during or right after the round, then turn them into a score. When you get stuck, they note when it happened, what you tried, whether and how you asked for help, and what you did with it.

Here are illustrative examples of the kind of notes that help and hurt. They are not quotes from any real feedback packet, but they reflect the factual, observation-based style many interviewers aim for.

Notes that still support a hire:

  • "Started with a brute force and stated O(n^2). Identified repeated work without prompting."
  • "Got stuck on handling negatives. Asked a specific question about it. Used the hint immediately and finished."
  • "Did not reach optimal, but brute force was clean and well tested. Described the right direction for the optimization."

Notes that hurt:

  • "Long silent periods. Unclear what the candidate was thinking."
  • "Started coding before understanding the problem; had to restart twice."
  • "Received a hint on using a hash map but did not apply it."
  • "Asked for the approach before attempting anything."

The difference between the two lists is visibility and momentum, not raw talent. That's why practicing how to think out loud in a coding interview pays off so much when you get stuck.

Practice Drills to Get Better at Being Stuck

You can train recovery directly. Normal problem grinding trains solving; these drills train the moments when solving fails.

DrillHow it worksWhat it builds
Ladder timerPick an unfamiliar medium. Set alarms at 1, 3, 5, 7, and 10 minutes and force yourself onto the next rung at each one.Muscle memory for the sequence
Brute force sprintCode a correct brute force for any problem in under 10 minutes, with tests.A reliable salvage plan
Silence auditRecord yourself solving aloud. Mark every gap longer than 20 seconds.Habit of narrating while thinking
Narrow-hint mockHave a peer give only one-sentence hints, and only when you ask a specific question.Writing good hint requests
Constraint flipSolve a problem, then change one constraint (allow negatives, make it 2D, stream the input) and re-solve.Comfort with simplify-and-extend reasoning
Cold startStart a problem within 30 seconds of reading it, by typing an example first.Breaking the blank-page freeze

Run at least a few mock interviews with a real person, because a live listener changes how you think. Our list of the best mock interview platforms compares paid and free options.

If you keep getting stuck on the same kinds of problems, the issue is probably a pattern gap, not a recovery gap. Work those patterns until you recognize them on sight, and keep an eye on why qualified candidates still fail technical interviews so you don't repeat the common mistakes.

Quick Reference: Your Stuck Checklist

Keep this list in mind during the round:

  1. Restate the problem and confirm constraints.
  2. Solve a tiny example by hand.
  3. Say the brute force and its complexity.
  4. Name the repeated work.
  5. Check hash map, sort, two pointers, window, prefix sums, binary search, heap, stack, graph search, DP.
  6. Solve an easier version.
  7. Ask one narrow hint after about 8 to 10 minutes of real effort.
  8. Past halfway with no path? Code the brute force, test it, explain the optimization.

Being stuck isn't the failure. Being stuck and invisible is.

Want a safety net for the moments this checklist doesn't cover? TechScreen runs invisibly during your screen share and suggests the next step, the matching pattern, and clean code when you're stuck in a live coding interview. Try it with 3 free tokens and test it on a mock round first.

Get started free →

Frequently Asked Questions

Does asking for a hint fail a coding interview?

No, a single well-timed hint rarely fails a coding interview on its own. Interviewers usually record how much help you needed and what you did with it. A narrow hint that you turn into working code quickly reads far better than ten minutes of silence. What hurts is asking for the whole answer, asking repeatedly for the same thing, or needing a hint and then still not making progress. Ask for direction on one specific sub-step, not for the solution.

How long should I stay stuck before asking the interviewer for help?

In a standard 45-minute round, a reasonable rule is to work the problem out loud for about 8 to 10 minutes of real effort before asking for a targeted hint. During that time you should restate the problem, try a small example, state a brute force, and look for the bottleneck. If you have done all of that and still have no direction, asking is better than burning more of the clock, because you need time left to code and test.

What should I do if I completely blank at the start of a coding interview?

Slow down and get your hands moving. Read the problem aloud, restate it in your own words, and ask one or two clarifying questions about input size and edge cases. Then write a tiny example and solve it by hand. Blanking is usually a stress response, and concrete actions like typing an example break it faster than trying to think harder. Saying 'Let me work a small case first' also tells the interviewer you have a process.

Can you pass a coding interview without the optimal solution?

Yes, it happens often, especially when the candidate communicates clearly, writes clean working code for a correct but slower approach, tests it, and can explain where the bottleneck is and how an optimal approach might remove it. Many interviewers score problem solving, coding, communication, and verification separately. A correct brute force with strong signals in those areas can earn a lean-hire, while a half-finished optimal attempt with no working code often scores lower.

Is it better to code a brute force or keep thinking about the optimal solution?

If you are past roughly the halfway point of the round with no clear path to the optimal approach, code the brute force. Working code is evidence; an idea in your head is not. Tell the interviewer you are coding the simpler version first and will optimize if time allows. Often, writing the brute force exposes the repeated work that the optimal solution removes, so it can lead you to the better answer anyway.

What do interviewers write in feedback when a candidate gets stuck?

Interviewers typically write factual notes: when you got stuck, what you tried, whether you asked for help, what hint was given, and how fast you used it. Notes like 'needed a hint on using a hash map, then implemented it cleanly and tested edge cases' are common and not fatal. Notes like 'went silent for long stretches' or 'could not use the hint' are the ones that hurt, because they describe how you would behave when stuck on the job.

How can I practice getting unstuck before a real interview?

Practice the recovery itself, not just problem solving. Set a timer and force yourself through each step of a recovery ladder on unfamiliar problems: restate, small example, brute force, bottleneck, simplify, then hint. Do mock interviews with a peer who gives deliberately narrow hints. Record yourself solving aloud and check for long silences. Also practice coding a clean brute force in under ten minutes, because that is your safety net in a real round.

Ready to use AI assistance in your next interview?

TechScreen is the invisible AI assistant trusted by engineers interviewing at Google, Meta, Amazon, and hundreds of other companies. Start with 3 free tokens — no credit card required.

Ace your next interview →