Description
Given a string, return whether it is a valid number. Valid numbers include integers, decimals, and scientific notation.
Examples
Input:
s = "0"Output:
trueExplanation:
0 is a valid number.
Input:
s = "e"Output:
falseExplanation:
'e' alone is not a valid number because it is an exponent indicator without any digits before or after it.
Input:
s = "2e10"Output:
trueExplanation:
'2e10' is valid scientific notation: the base '2' and exponent '10' are both valid integers separated by 'e'.
Constraints
- •
1 ≤ s.length ≤ 20