Search⌘ K

DIY: Valid Number

Explore how to determine if a string can be interpreted as a valid decimal number. Learn to implement checks for digits, exponents, signs, and decimals in Go, sharpening your skills for coding interviews through a practical problem related to validating number formats.

Problem statement

Validate if a given string can be interpreted as a decimal number or not. Here is a list of characters that can appear in a valid decimal number:

  • Numbers - 0-9

  • Exponent - "e"

  • Positive/negative sign - "+"/"-" ...