Lessons · Python · what to say when stuck
What to say when you are stuck
Say three things, in order: what you know, what you are unsure about, and the small case you would try first. Then try it.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Interviewers grade the thinking they can hear. Thirty seconds of silence tells them nothing; a stated plan, even a wrong one, shows how you work, and a specific question ('set or sort here?') gets a useful answer where 'any hints?' gets a sigh.
How to think about it
When the room goes quiet, narrate. Pick the smallest input that still has the problem in it, work it by hand out loud, and let the pattern you see become the code. If an attempt fails a case, walk that input through the code line by line.
Worked example
# Stuck? Say the three things, in order:
# 1. "What I know: each number needs its earlier partner."What you know.
# 2. "What I'm unsure about: sort first, or a dict of what I've seen."What you are unsure about.
# 3. "The small case I'd try: [2, 7] with target 9."The case you will work by hand.
target = 9
nums = [2, 7]The small case.
print(nums[0] + nums[1] == target)True: checked by hand, out loud
Your turn
Ask for a hint the useful way.
# Say: "I am choosing between here; is either one off the table?"
Solve one with the tests running
The trap
Going silent to think it through in your head. From the other side of the table, silence and no ideas look the same.