Programming

Advent of Code F# — Day 24

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 24 See details of the chal­lenge here. Today’s chal­lenge is a mix of Breadth-First Search (or Lev­el Order Tree Tra­ver­sal) and the Trav­el­ling Sales­man Prob­lem. First, let’s parse the input file into a 2D array to make it eas­i­er for …

Advent of Code F# — Day 24Read More »

Advent of Code F# — Day 20

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 20 See details of the chal­lenge here. Today’s input looks like this: 1873924193–1879728099 2042754084–2076891856 4112318198–4113899685 1039794493–1057170966 3791841434–3797494664 1518668516–1518748952 1946127596–1953926346 4058215215–4086224696 3429681642–3455096313 2599576643–2604275147 1800210010–1801990849 1761160149–1766904471 2774395403–2774748831 1520470679–1542287000 2343327790–2346083217 … First, let’s read the input into a list of tuples rep­re­sent­ing the …

Advent of Code F# — Day 20Read More »

Advent of Code F# — Day 19

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 19 See details of the chal­lenge here. I ini­tial­ly approached today’s chal­lenge as a dynam­ic pro­gram­ming exer­cise, but it quick­ly tran­spired that there’s a much bet­ter way to do it once I realised that part 1 is in fact the …

Advent of Code F# — Day 19Read More »

Advent of Code F# — Day 18

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 18 See details of the chal­lenge here. To solve both part 1 and 2:   Links Day 18 chal­lenge descrip­tion Advent of Code 2015 Solu­tion for Day 17 All my F# solu­tions for Advent of Code Github repo

Advent of Code F# — Day 17

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 17 See details of the chal­lenge here. First, let’s add a hash func­tion (that returns the MD5 as a hexa­dec­i­mal string as we have done so often this year). Then, add a step func­tion that’ll take a (x, y) posi­tion and the path …

Advent of Code F# — Day 17Read More »

Advent of Code F# — Day 16

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 16 See details of the chal­lenge here. I also tried an imple­mem­ta­tion using string instead of bool[] and there is no dis­tin­guish­able dif­fer­ence in terms of per­for­mance. Now that we have the solve func­tion we can answer both part 1 …

Advent of Code F# — Day 16Read More »

Advent of Code F# — Day 15

ps. look out for all my oth­er solu­tions for Advent of Code chal­lenges here.   Day 15 See details of the chal­lenge here. Today’s chal­lenge is pret­ty straight for­ward, and a brute force approach would have suf­fice — try every t from 0 to inifin­i­ty and return the first t that sat­is­fies this equa­tion for all …

Advent of Code F# — Day 15Read More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close