Back to problems

Restore IP Addresses

Algorithm · ByteDance · Medium

Restore IP Addresses Medium · Topics · Company Tags · Hints Given a string s that contains only digit characters, your task is to split it into exactly four contiguous parts. Each part, when interpreted as a decimal integer, must satisfy these rules: It falls between 0 and 255 (inclusive). It does not have a leading zero, unless the part is the single digit "0" itself (e.g., "0" is valid, but "01" or "00" is not). Place a dot ('.') between the parts to assemble a valid IPv4…

Checking your access…