Thursday, March 3, 2016

LeetCode Q93: Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)

Solution, recursion. There are 4 sections in IP address in which there are at most 3 possible situations. Verify whether each case is valid.



Round 2 solution:

No comments:

Post a Comment