Practice Problem

String to Integer (atoi)

Difficulty: Medium

Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer. Handle leading whitespace, optional sign, digit parsing, and integer overflow/underflow.