Mental Model
Convert each character digit in the string to a number and build the integer step by step.
Analogy: Like reading a number on a sign one digit at a time and writing it down to form the full number.
Input string: " -42abc" Positions: [0] [1] [2] [3] [4] [5] [6] Characters: ' ' '-' '4' '2' 'a' 'b' 'c' Integer building: result = 0 result = result * 10 + digit Pointer ↑ at start of string
