Back to course home
0% completed
Vote For New Content
Solution: Restore IP Addresses
Problem Statement
Given a string s containing digits only, return a list of string containing the valid ip addresses that can be formed by inserting the dots(.) in between string characters.
A valid IP address consists of four parts, each ranging from 0 to 255, separated by dots. It's important to note that leading zeros in any part of the IP address are not allowed, except for the number 0 itself.
- For example,
"1.1.21.1", and"1.12.1.1"arevalidip addresses, and"1.1.021.1"is invalid ip address.
Examples
- Example 1:
- Input:
"11211"
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!