N
Nudge
← Back to home
Guide

How to get unstuck on LeetCode without seeing the solution

A staged way to ask for just enough help, keep ownership of the reasoning, and learn something you can use on the next problem.

By Jerry, founder of Nudge · Published August 13, 2026

When you get stuck on LeetCode, identify the exact point where your reasoning stops, try one small experiment, then ask for the smallest hint that addresses only that block. Escalate from a question to a pattern cue to pseudocode, and look at a full solution only after you can explain what you already tried.

The goal is not to prove that you can suffer indefinitely without help. It is to keep ownership of as much of the solution as you can. A useful hint changes what you notice; it does not remove the remaining decisions. That matters in interview practice because recognition is not the same as recall. Research comparing retrieval practice with concept mapping found stronger later learning from actively retrieving knowledge, and a broad review of study techniques rated practice testing highly across many learning conditions. Those studies are not about LeetCode specifically, but the principle is relevant: doing the retrieval yourself is different from following reasoning that is already on the page. See Karpicke and Blunt (2011) and Dunlosky et al. (2013).

A seven-step way to get unstuck

  1. Restate the problem. Say what the input, output, constraints, and one valid example mean in your own words. If you cannot do that, the block is comprehension, not code.
  2. Solve a tiny case by hand. Use the smallest non-trivial input and write every decision down. The operations you repeat by hand often expose the state your algorithm needs to track.
  3. Name the exact block. Finish this sentence: “I know ___, but I cannot determine ___.” Be specific: choosing a data structure, proving a greedy choice, defining a recurrence, or fixing one failing case.
  4. Try one bounded experiment. Trace another example, print one variable, sketch the call tree, or write the brute-force version. Give the experiment a clear question to answer instead of changing code at random.
  5. Ask for one minimal hint. Share the block and what you tried. Ask for a question or cue, not an implementation.
  6. Work again before escalating. Turn the hint into your own next step. If you are still stuck, request one level more detail: first a pattern cue, then an invariant or recurrence, then pseudocode.
  7. Explain and revisit. After solving, summarize the key move without looking and return to the problem later. This final retrieval is where the solution becomes something you can produce rather than merely recognize.

How long should you struggle before asking for a hint?

There is no universal timer. Ask for help when you have stopped generating useful experiments—not merely when the work feels hard. On a new pattern, that point may arrive quickly. On a familiar pattern, you may give yourself longer to retrieve it. A good checkpoint is whether you can state a new hypothesis to test in the next few minutes.

If you are repeating the same trace, rewriting the same loop, or staring without a concrete next test, a small hint is usually more useful than another arbitrary stretch of time. Work on productive failure suggests that attempting a problem before instruction can support later learning when the attempt is followed by well-designed guidance; it does not imply that unaided struggle should continue forever. See Sinha and Kapur (2021).

How to ask an AI for a hint without getting the answer

General AI assistants tend to produce complete responses, so constrain both the content and the format. Paste this prompt, then replace the brackets with your own reasoning:

I am practising this problem and do not want the solution, code, pseudocode, or the name of the optimal technique. I think [your current reasoning]. I am stuck on [one precise block]. Ask me one question that helps me inspect that block. Do not reveal the next step unless I ask for another hint.

If that is too subtle, ask for one stronger level at a time: “Give me a pattern cue without naming the full approach,” then “Help me state the invariant,” then “Show structure-only pseudocode with no language-specific implementation.” Start a fresh conversation if the assistant has already revealed too much; it cannot put the answer back once you have seen it.

What a useful hint should—and should not—do

A useful hint points at the specific gap, leaves a decision for you, and is small enough to act on. “What information is lost when the left pointer moves?” is a hint. Naming the optimal pattern, providing the recurrence, and then writing the loop is a compressed solution.

That middle ground is why Nudge is built hint-first. It can place a short comment beside the relevant code and use the coaching stage—planning, stuck, or close—to adjust the kind of help it offers. Editor code is shared only when a Pro user explicitly types @code. The aim is still the same when using any source of help: reveal the next useful observation, not the finished path.

When should you look at the full solution?

Look when incremental hints no longer create a meaningful next step, when the missing prerequisite is outside your current knowledge, or when your session has shifted from retrieval practice to learning a genuinely new technique. Before opening it, save your attempted approach and write down the exact gap.

Read the solution in sections. Pause before each major step and predict what comes next. Then close it and rebuild the approach from a blank editor. Worked examples can help novices learn complex procedures, but the benefit depends on actively processing the example rather than copying it. A review of the worked-example literature discusses this effect and the role of self-explanation: Atkinson et al. (2000).

What to do after you solve it

  • Write the trigger: what detail should make you consider this approach next time?
  • Write the invariant or recurrence in one sentence, without copying the editorial.
  • Record the point where you got stuck and the smallest hint that moved you forward.
  • Re-solve from a blank editor later, without your notes. If you need the same hint again, schedule another attempt.
  • Compare with the official solution only after your own review; look for differences in complexity, invariants, and edge cases.

If recognizing the underlying technique is the recurring block, use our guide to the core LeetCode patterns as a review map, not as a label to consult before every attempt.

Frequently asked questions

Is using a hint on LeetCode cheating?

During practice, a hint is a learning choice, not a score to defend. The useful question is whether the hint leaves you responsible for the reasoning you intended to practise. During a real assessment or interview, follow its rules and do not use outside assistance unless it is explicitly allowed.

Should I always avoid the solution?

No. A well-explained solution is useful when you lack a prerequisite or are learning a new pattern. Attempt first, identify your gap, study the relevant section, and then reproduce the approach without looking.

What is the smallest useful hint?

Usually it is a question about the first uncertain decision in your reasoning. It might direct you to trace one case, name missing state, or test an invariant. It should not settle every decision that follows.

What if an AI gives me the full answer anyway?

Stop reading as soon as it crosses the boundary you set. Write down only the first useful observation, hide the response, and continue. For the next attempt, specify forbidden output—code, pseudocode, complexity, and technique names—before sharing the problem.

How do I know whether I learned the pattern?

Return later and solve from a blank editor. You should be able to explain why the approach fits, state its invariant or recurrence, and handle edge cases without reconstructing someone else's wording.

If you want to see what a hint-first coach looks like in practice (inline hints in the editor, a side panel that asks before it tells, and @code to pull your real code into the conversation), see how Nudge works.

Related guides