Problem
Ask
Submissions
Solution

Solution: Restore IP Addresses

Statement

Naive approach

The naive approach would be to check all possible positions of the dots. Because an IP address requires inserting three dots, and if the input string contains 1212 digits, then there are 1111 possible positions between the digits where a dot can be placed. So, we initially have 1111 choices for the first dot, then ...

Problem
Ask
Submissions
Solution

Solution: Restore IP Addresses

Statement

Naive approach

The naive approach would be to check all possible positions of the dots. Because an IP address requires inserting three dots, and if the input string contains 1212 digits, then there are 1111 possible positions between the digits where a dot can be placed. So, we initially have 1111 choices for the first dot, then ...