Haskell Sudoku

Last time, I mentioned that I tried to write sudoku solver in haskell and it was using too much memory and time. So I tried to solve it again and this time I was able to do it, I guess I just needed more motivation. We will be using this file format as input to our suodku program: 92634.7.1 .5..264.9 .7.8.1... ...9..2.7 342.....5 1.....8.. 6854...12 ..4..29.. .1.538.7. and it will be represented as an array of numbers and ....

November 29, 2022 · 11 min · Upendra Upadhyay

Advent of Code 2023 Day 5

AOC-2023-5 If You Give A Seed A Fertilizer This problem was hardest yet and took longest to solve. so the problem asks us to create a map from seed to location such as: seed -> soil -> fertilizer -> water -> light -> temprature -> humidity -> location where we are given certain mappings from one entity to another, eg: seed 1 corresponds to soil 10 and given this mapping and intial seed list we need to find the minimum location....

March 1, 2024 · 2 min · Upendra Upadhyay

Advent of Code 2023 Day 4

AOC-2023-4 Scratchcards This problem was easy in the sense that it required just required correct parsing and following the rules to get the result in the problem. Part 1 Part 1 just required correct parsing and computing the solution. Part 2 Part 2, says that for each winning card with n numbers, we will get extra copies of next n cards, so to maintain the number of extra cards we used a state monad, to keep track of how may extra copies each card have....

February 29, 2024 · 1 min · Upendra Upadhyay

Advent of Code 2023 Day 3

AOC-2023-3 Gear Ratios In this problem, we had to parse the input problem and find all the symbols like: #, *, + and $. All numbers that are adjacent to symbols are important for us, and we need to compute the result. Part 1 In this part we had to compute the sum of numbers adjacent to the symbol decsribed above. To get the results I was going for the graph traversal algorithm, and to do that in haskell I used containers library to get Data....

February 28, 2024 · 1 min · Upendra Upadhyay

Advent of Code 2023 Day 2

AOC-2023-2 Cube Conundrum In this problem, we have to parse the input text and compute the result; this problem was not particularly hard or tricky and just required correct parsing. code for day 2 is at: https://github.com/upendra1997/advent-of-code-2023-hs/blob/main/day2/day2.hs

February 27, 2024 · 1 min · Upendra Upadhyay