The address with two meanings
A validation service accepts one spelling while a downstream network library can interpret another address.
What’s going wrong
A batch IPv4 validator canonicalizes accepted addresses. Some strings accepted here have a different meaning in downstream parsers.
Input is an array of strings. Print an array with each accepted dotted-decimal IPv4 string or null. Exactly four ASCII decimal octets are required, each 0 through 255, one to three digits. A zero octet is written exactly "0"; all other octets start with 1 through 9. Whitespace, signs, shorthand and alternate radices are invalid. Preserve input order. Repair parse, keeping ordinary valid addresses accepted.
Expected behavior
Accept exactly one unambiguous decimal spelling for each IPv4 address and reject malformed or ambiguous text.
Reproduction
["010.0.0.1"]
[null]
["10.0.0.1","0.0.0.0","255.255.255.255"]
["10.0.0.1","0.0.0.0","255.255.255.255"]
["10.00.0.1","10.0.0.01"]
[null,null]
Before you begin
- String parsing
- Validation
- Integer conversion
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.