61. Valid Number
HardString
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.
Examples
Input: 53.5e93
Output: true
Explanation: Mantissa 53.5 with exponent e93.
Constraints
- 1 <= s.length <= 20
- s consists of only English letters (both uppercase and lowercase), digits (0-9), plus '+', minus '-', or dot '.'.
Loading...
Run checks all cases above. Submit evaluates all test cases.