0

How to read a problem statement

Foundationsused in ~100% of apps

Most people fail problems they could have solved, because they answered a slightly different question. Nobody teaches reading. Every course starts at writing code, which is step five of five.

Core idea. Before you type anything, pull five things out of the statement in writing: the input, the output, the rules, the size, and the strange cases. Same five, every problem, forever. It takes two minutes and it saves you the hour you would have spent solving the wrong thing.
Playground, this isn't a screenshot
A real problem statement
You are given an array of integers nums and an integer target. Return the indices of the two numbers that add up to target. Each input has exactly one answer, and you may not use the same element twice. You can return the answer in any order. Constraints: 2 <= nums.length <= 10000, and -1000000000 <= nums[i] <= 1000000000.
↑ play a little first, then dig in