Programming

Ransom Note problem in F#

A problem that has shown up multiple times in my preparation for technical interviews is the so called Ransom Note problem. To solve this in F# is pretty simple. In the interest of efficiency I decided to use a mutable Dictionary instead of the F# Map to store the no. of times a letter appears in the …

Ransom Note problem in F# Read More »

Advent of Code F# – Day 6

ps. look out for all my other solutions for Advent of Code challenges here.   Day 6 See details of the challenge here. The input for today’s challenge looks like this: cmezkqgn nmzrgcft ydpndcps zjihhows kvptxsrx ubbvugwq … Since the only difference between the 2 parts of this challenge is how the characters in a column are …

Advent of Code F# – Day 6 Read More »

Advent of Code F# – Day 5

ps. look out for all my other solutions for Advent of Code challenges here.   Day 5 See details of the challenge here. Let’s start by adding a hash function that’ll take an input string and return the hexdecimal representation of its MD5 hash. From there, we can create an infinite sequence of hash values generated …

Advent of Code F# – Day 5 Read More »

Advent of Code F# – Day 4

ps. look out for all my other solutions for Advent of Code challenges here.   Day 4 See details of the challenge here. The input for today’s challenge looks something like this: bkwzkqsxq-tovvilokx-nozvyiwoxd-172[fstek] wifilzof-wbiwifuny-yhachyylcha-526[qrazx] jvyyvzpcl-jhukf-shivyhavyf-487[zhtsi] kwvacumz-ozilm-kivlg-kwvbiqvumvb-694[gknyw] mvhkvbdib-kmjezxodgz-mvwwdo-omvdidib-837[dmvbi] nzydfxpc-rclop-qwzhpc-lnbftdtetzy-171[cptzd] vhehkyne-unggr-inkvatlbgz-813[gnehk] tcorcikpi-hnqygt-octmgvkpi-570[nzewo] xmtjbzidx-wvnfzo-jkzmvodjin-447[uyzlp] willimcpy-mwupyhayl-bohn-mufym-734[stjoc] sbejpbdujwf-cvooz-xpsltipq-961[azfnd] … So our first task is to turn these into a more usable …

Advent of Code F# – Day 4 Read More »

Advent of Code F# – Day 3

ps. look out for all my other solutions for Advent of Code challenges here.   Day 3 See details of the challenge here. First, let’s capture the input for today’s challenge in a text file, say Day03Input.txt. Then, let’s create a module to capture the common steps between both parts of the challenge. There’s really not …

Advent of Code F# – Day 3 Read More »

Advent of Code F# – Day 2

ps. look out for all my other solutions for Advent of Code challenges here.   Day 2 See details of the challenge here. Let’s start by capturing the model and input data in a module. Since I’m armed with the hindsight of having seen both parts of today’s challenge I’ve refactored the common logic into a solve function: there’s …

Advent of Code F# – Day 2 Read 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