Description

Given a string, return whether it is a valid number. Valid numbers include integers, decimals, and scientific notation.

Examples

Input:s = "0"
Output:true
Explanation:

0 is a valid number.

Input:s = "e"
Output:false
Explanation:

'e' alone is not a valid number because it is an exponent indicator without any digits before or after it.

Input:s = "2e10"
Output:true
Explanation:

'2e10' is valid scientific notation: the base '2' and exponent '10' are both valid integers separated by 'e'.

Constraints

  • 1 ≤ s.length ≤ 20

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!