Picking garbages in groups

In today’s post, I will describe my solution to Advent of Code year 2017, day 9’s challenge. Let’s read the challenge description before the explanation. Part 1 Part 1 of the problem expects us to report the total number of groups, as collected from the stream of characters. The rules are simple: { marks the beginning of the group unless that’s found in the garbage } marks the end of the group unless that’s found in the garbage First group encounter will have the level of 1, nested groups will have their levels as their depth, as an example, the innermost group of {{{}}} will have level of 3. Groups are separated by commas. Now that is the easy part, let’s get to the garbage. ...

November 2, 2021 · 8 min · 1517 words · Mafinar K.

Stacked Reactions

tl;dr I solved Advent of Code Year 2018, Day 5 and here is the code. When I first encountered LIFO (i.e. Stack) data structures back in my Algorithmics course, I found the implementation to be easy compared to, say linked lists, however, to identify its use in a real life problem (for instance, parenthesis matching) was something I had struggled with. I mean, I would probably be able to solve one with stitching expressions and statements together, but to immediately realize that the problem is addressable with a stack never came to me easily. I eventually overcame that (Or so I think), and today’s post, and the advent of code puzzle involved, involves a LIFO. ...

August 2, 2021 · 7 min · 1313 words · mafinar

Many Ways to Reach a Floor

This is day 1 of my #100DaysOfFSharp and in this post I will talk about what I learned today. I tried solving Advent of Code 2015’s Day 1 - an easy problem that packed a lot of F# education for me. The problem is stated in the link but the tl;dr of it is climbing up and down based on a specific instruction - ( means going up while ) means down. And the input is a lot parenthesis- reminiscent of Lisp jokes. The title of the problem: Not Quite Lisp ...

July 14, 2021 · 8 min · 1542 words · mafinar