Trains the technique from
LeetCode 93Restore IP AddressesThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A relay panel is identified by four numeric fields joined with -, for example 12-7-0-240. Each field is held in a single byte, so its value runs from 0 to 255, and each field is written in its shortest form: either the single digit 0, or a number whose first digit is not 0.
A technician copied a panel address down without the separators, leaving only digits, a string of decimal digits.
Return every panel address that produces exactly digits once its three separators are dropped, in any order. Return an empty list when no address produces it.
Example 1
Both addresses reproduce 01203 when the separators come out, and each of their fields is either a lone 0 or a number that does not open with 0.
Example 2
Every field shown lies between 0 and 255 and none opens with a 0 it does not need, so both addresses qualify.
Example 3
Four fields need at least four digits between them, and only one digit was copied down.
The values you return may be in any order.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def panel_addresses(digits: str) -> list[str]:public List<String> panelAddresses(String digits)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.