Restore IP Addresses
Problem statement
Given a string digits containing only decimal digits, return every valid IPv4 address obtained by inserting exactly three dots. Return the addresses in lexicographic order.
Each segment must be from 0 through 255 and cannot have a leading zero unless it is exactly 0.
Function
restoreIpAddresses(digits: String) → String[]Examples
Example 1
digits = "25525511135"return = ["255.255.11.135","255.255.111.35"]Example 2
digits = "0000"return = ["0.0.0.0"]Constraints
1 <= digits.length <= 20.