The question states "It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one." Where are we supposed to gather these from?
It seems like we are trying to match the requirements the test cases use, but we can't see those without already using them. I've already run into several requirements the test cases declare that I wouldn't have thought were correct, such a "3." being a valid number, or "+ 1" being invalid. I can see that they match a given definition of number, but what definition is it?
Yes I too feel the same, it is more like trailing the test cases. Especially, "3." is a valid definition, yet the test case would fail.
It has odd and contradictory requirements, for example: "96 e5" is invalid where as clearly it wants spaces to be ignored
After much searching, I have found this:
The strtod (“string-to-double”) function converts the initial part of string to a floating-point number, which is returned as a value of type double.
This function attempts to decompose string as follows:
A (possibly empty) sequence of whitespace characters. Which characters are whitespace is determined by the isspace function (see Classification of Characters). These are discarded.
An optional plus or minus sign (‘+’ or ‘-’).
A floating point number in decimal. The decimal format is:
***A nonempty sequence of digits optionally containing a decimal-point character—normally ‘.’, but it depends on the locale (see General Numeric).
***An optional exponent part, consisting of a character ‘e’ or ‘E’, an optional sign, and a sequence of digits.
If the number follows this pattern, excluding the trailing non-whitespace characters, then our solution is to return true. Otherwise, false.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.