Loading...
You are given a string of digits ip. Return every way to split it, in order and using every digit exactly once, into a valid IP address of the form A.B.C.D.
A split is valid when:
ip, in order, split into exactly four parts0 and 2550 unless the part is exactly "0"Return the valid IP addresses in sorted order. If no split is valid, return an empty list.
Input: ip = "25525511135"
Output: ["255.255.11.135","255.255.111.35"]
Input: ip = "0000"
Output: ["0.0.0.0"]
Input: ip = "1111"
Output: ["1.1.1.1"]
ip.length ≤12ip consists only of digits 0 to 9Click "Run" to test with sample cases or "Submit" to run all tests.