Problems > Valid Integer > Editorial

Valid Integer — Solution & Editorial

Back to the Problem

Strip one optional sign, require all digits, and forbid a leading zero unless the number is exactly 0.

Complexity: O(|S|)