Closed
Description
original problem: https://leetcode-cn.com/problems/validate-ip-address/
while std::net::IpAddr::parse
successfully parse the address, but the leetcode problem doesn't regard the address as "legal",
test DEMO:
use std::net::IpAddr;
fn main() {
if let Ok(IpAddr::V4(_)) = "01.01.01.01".parse() {
println!("parsed!"); // it gets in!
}
}
Usually, we consider IPv4 address containing only non-leading-zero number 0-255 legal, but not those with leading-zero numbers in. Should we change the behavior?