RSSAmplifier

Index on Blog · May 1, 2023

Restoring addresses with Haskell

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Leetcode has a very nice problem called Restore IP Addresses. The task is that for given string s containing only digits, we find all possible valid IPv4 addresses that can be formed by inserting dots into s. For example, from "25525511135" we can form only addresses 255.255.11.135 and 255.255.111.35. Solution in 16 lines First, we will construct three functions of type String -> [(Int, String)].…

Read on blog.ubavic.rs

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.