Valid IP Addresses

STRING
BACKTRACKING

Problem

Given a string s containing only digits, return all possible valid IP addresses that can be obtained from s.

A valid IP address consists of exactly four integers, each integer is between 0 and 255, separated by dots, and cannot have leading zeros.

Return all possible IP addresses in any order.

Examples

assembleIPs("14224211130") // returns ["142.242.11.130", "142.242.111.30"]
Loading...