Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 65. Valid Number
Determine whether a given string matches the grammar of a numeric literal: an optional sign, then either an integer or a decimal (allowing formats like "123", "123.", ".123", or "123.456"), optionally followed by an exponent part "e" or "E" with an optional sign and digits. Handle edge cases such as lone dots, missing digits around the decimal or exponent, and invalid characters.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late September, 2025
Senior
Leetcode 65. Valid Number But without the exponent condition. All the other conditions were valid.
Mid July, 2025
Meta
Manager
For example, all the following are valid numbers: "2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7", "+6e-1", "53.5e93", "-123.456e789", while the following are not valid numbers: "abc", "1a", "1e", "e3", "99e2.5", "--6", "-+3", "95a54e53".
Mid May, 2025
Meta
Mid-level
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.