Hard

Quiz

#65 Valid Number

APPROACH

Return whether string s is a valid number. Valid examples: "2", "-0.1", "2e10", "+6e-1". Invalid examples: "abc", "1a", "1e", "e3", "99e2.5", "--6". A valid integer is an optional sign followed by digits; a decimal is an optional sign with digits around a dot; an exponent suffix is 'e' or 'E' followed by an integer.

1 of 4
1:00

What is the optimal approach for this problem?