A five step approach for any problem
Following the same steps each time helps you avoid panic and gives the interviewer clear checkpoints.
- Clarify: input types, size, edge cases and expected output
- Example: walk through one or two small examples by hand
- Plan: describe a brute force idea, then an optimised one with time and space complexity
- Code: write clean, readable code with meaningful names
- Test: dry run with normal and edge cases, then fix bugs
Topics and patterns to practise
Focus on patterns rather than memorising problems. Once you recognise a pattern, many questions become variations.
- Arrays and strings: two pointers, sliding window, prefix sums
- Hash maps and sets for counting and lookups
- Stacks, queues and linked lists
- Trees and graphs: BFS, DFS, recursion
- Sorting, binary search and heaps
- Basic dynamic programming for mid level roles
Communicate while you code
Silence makes interviewers guess. Narrate briefly: I will use a hash map to store counts so lookups are constant time. If the interviewer gives a hint, take it and say how it changes your approach.
In service company and online assessment rounds, correctness and passing test cases matter most. In product company live rounds, clarity of reasoning and code quality carry more weight.
Common mistakes
Many candidates know enough to solve the problem but lose points on process.
- Coding immediately without clarifying
- Ignoring edge cases like empty input or duplicates
- Not stating time and space complexity
- Messy variable names and long unstructured functions
- Not testing the code before saying done
Practise effectively
Practise with a timer, in the language you will use, and explain aloud as if someone is listening. InterviewPlan AI Coding Help supports practice and explanation, and mock interviews help you rehearse communication under time pressure.