Coding Interview Tutorial 41: Restore IP Addresses [LeetCode]

preview_player
Показать описание
Learn how to generate all possible IP addresses from a string. The total number of IP addresses is a constant (2^32), so the time complexity of the algorithm presented is O(1).

This is an important programming interview question, and we use the LeetCode platform to solve this problem.

Рекомендации по теме
Комментарии
Автор

This solution is 100% easier to understand than the accepted answer on Leetcode! Both give you the same runtime complexity. In my opinion, maintainability trumps minor optimizations anytime

shanphreak
Автор

Simple, clear and great explanation! Thanks!

jonnatanortiz
Автор

Very simplistic and logical explanation. Really liked the approach!! Keep explaining solutions like this only :)

shubhisood
Автор

This is absolutely the best explanation, so clear. Please upload more thanks.

MDMonirulIslam-plyu
Автор

Very lucid explanation. I always dreaded approaching this problem as the general perception was that it involves some form of backtracking. But you made me break away from that thought. This shows how keeping things simple wins over everything else. Good job !!

Legendary-Akshit
Автор

Keep going man . You have quality channel contents☝

Dev
Автор

Thank you for the explanation, yet I have a question, why didn’t we run a 4th for loop for the 4th part of a string?

fufuto
Автор

i don't understand why is that when not valid, continue will help, invalid means (len(s)>3 or int(s) > 255 or s is like "012"), continue will not help for both above invalid cases, right?

paladinf
Автор

can you please explain how the time complexity is o(1) ? for each ' i', we are doing 3 combinations of j and for each j, we are doing 3 combinations of k ...so not able to follow how it is o(1)

punitpawar
Автор

This is straight logic! I love your tutorial! Keep it up!

christo-j
Автор

Great Solution:)
Thank you so much for keeping up to date!
Can you please upload your code on github as well??

driveb