Software Engineering Intern Interview Question

How do you approach a coding problem you have not seen before?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Make sure you understand the problem before coding: restate it, ask about inputs, edge cases and constraints, and work through a small example by hand. Describe a simple, correct solution first, even a brute force one, and state its complexity. Then look for a better approach, often with a hash map, sorting or two pointers. Code it cleanly while explaining your reasoning, and test it with normal and edge cases.

Why interviewers ask this

Technical interviews for interns are mostly about problem solving process, not memorised answers. The interviewer wants to see that you clarify before coding, think out loud, start with something correct and improve it deliberately. They also watch how you test your own code and react when stuck. A candidate who jumps straight into typing and goes silent is much harder to assess than one who explains each step.

How to structure your answer

  • Clarify the problem, constraints and edge cases.
  • Work through an example and propose a simple solution.
  • Improve it and explain the complexity trade off.
  • Write the code, then test normal and edge cases.

Example answer

Spoken example, first person

I try not to start typing straight away. First I restate the problem in my own words and ask questions: how big can the input be, can it be empty, can there be duplicates or negative numbers. Then I work through a small example by hand, because that often shows me the pattern. Next I describe the simplest solution I am confident is correct, even if it is slow. If I need to find two numbers in a list that add up to a target, I would say checking every pair works but is order n squared. Then I look for something better. With that problem, storing the numbers I have already seen in a hash set lets me do it in one pass, which is linear time but uses extra memory, and I explain that trade off before writing it. While coding I talk through what I am doing, so the interviewer can follow along and point things out. When I finish, I trace through my example and then the edge cases, like an empty list or no valid pair. If I get stuck, I say what I am stuck on rather than going quiet.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What would you do if you could not think of any solution at all?
  • How do you decide which data structure to use?
  • How would you test this function if you could not run it?

Related software engineering intern questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot