In a coding interview, the interviewer is evaluating how you think as much as whether your final code runs. A short explanation before you type makes your reasoning visible and prevents avoidable rework.
Restate the problem
Summarize the input, expected output and important constraints in your own words. Confirm anything ambiguous before choosing a data structure.
Start with the straightforward approach
Briefly name the simplest correct solution, even if it is not optimal. This creates a baseline and shows why your improved approach is worth using.
Explain the better approach
Name the data structure or pattern, then describe the steps in plain language. Keep this to three or four sentences before you begin coding.
Call out edge cases
Mention empty input, duplicates, boundaries and invalid values when they apply. You do not need an exhaustive list; choose the cases most likely to break the solution.
Finish with complexity
State time and space complexity and connect each one to the operations in your approach. If there is a trade-off, say what you gain and what it costs.




