All possible IP Address combinations

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)

Comments

  1. -Permutation of the numbers.
    -For each permutation, check inet_aton(num, *inp) is successful.

    ReplyDelete
    Replies
    1. Bhaskar, you cannot permutate the numbers. Look at the example - There were no permutations.

      Delete

Post a Comment

Popular posts from this blog