algorithm - For a given string which contains only digits , what's the optimal approach to return all valid ip address combinations? -
example:
given “25525511135”
output : [“255.255.11.135”, “255.255.111.35”]. (sorted order)
kindly let me know if depth first search on here ?(that's thing striking me )
why important have 'optimal' approach answering this?
there not many permutations simple approach of checking every combination fits ip format , filtering out have out of range numbers work.
it's unlikely bottle neck whatever part of.
Comments
Post a Comment