Given a string s, return whether s is a valid number. A valid number is composed of an optional sign, a decimal or an integer, and an optional exponent part. Formally: an optional '+' or '-'; then either a decimal (digits with an optional single '.' and at least one digit on some side) or an integer; then an optional exponent — 'e' or 'E' followed by an optional sign and one or more digits.
Example 1
Input: s = 53.5e93
Output: true
Explanation: "53.5" is a valid decimal, and "e93" is a valid exponent (e followed by digits), so the whole string is a valid number.
Example 2
Input: s = 0
Output: true
Explanation: "0" is a plain integer, which is a valid number.
Example 3
Input: s = e
Output: false
Explanation: An exponent must follow a number, and "e" has no digits before it, so it is not valid.
A valid number has a fixed grammar: optional sign, a mantissa (integer or decimal), and an optional exponent. A single anchored regex captures it precisely.
Run checks all cases above. Submit evaluates all test cases.