Determine if a given string represents a valid number. A valid number is either an integer or a decimal number, with an optional leading + or - sign.
Valid numbers: "2", "0089", "-0.1", "+3.14", "-.9", "3.", ".5"
Invalid numbers: "abc", "1a", "", ".", "+-3", "1.2.3"
Rules:
+ or - sign may appear at the start'.' is alloweds = "3.14"trues = "-0.1"trues = "abc"false0 <= s.length <= 100s consists of characters: digits (0-9), '.', '+', '-', and letters.No scientific notation (e.g., "1e5" is not considered in this problem).Run your code to see results
Use Cmd+Enter to run