Toot

Written by Walker Boh🛡 on 2024-12-19 at 15:00

Day 19 #adventofcode in the books.

You were given a set of strings and tokens and you had to find out which of the strings could be made from the tokens.

Sounds simple right ? Except the tokens are variable lengths and some of the longer tokens can be contained in constructs of the shorter ones, so simple check/replace is out...

Tried a few different things before I came to a recursive solution, that worked but was too slow for the real data.

So it was time to break out DP.

Converted the algo from recursive to DP and it worked.

Part 2 was counting the variations of tokens that could make the strings up.

This was a simple modification to my existing code.

[#]typescript performed admirably for this.

=> View attached media

=> More informations about this toot | View the thread | More toots from walkerb@infosec.exchange

Mentions

Tags

=> View adventofcode tag | View typescript tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113680085753444180
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
270.767161 milliseconds
Gemini-to-HTML Time
0.499904 milliseconds

This content has been proxied by September (ba2dc).