Given a string s, determine whether it represents a valid number.
A valid number can be:
• Integer: Digits with an optional + or - sign.
Example: "-5", "+12", "0".
• Decimal: Digits with a decimal point, with an optional + or - sign.
Examples: "3.14", "4.", ".9".
• Scientific Notation: An integer or decimal followed by e or E and then an integer (the exponent).
Examples: "2e10", "-1.5E-3".
Invalid numbers include strings with letters in the wrong place, multiple signs, or malformed exponents.
Input: s = "7.5"
Output: true
Explanation:
It’s a valid decimal number.
Input: s = "-3E8"
Output: true
Explanation:
It’s a valid scientific notation number.
Input: s = "12e"
Output: false
Explanation:
The exponent is incomplete.
Accepted:
Submission: