Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
AdventOfCode2023
My solutions to the problems in Advent of Code 2023. All solutions are written in Golang (by ankit8697)
-
advent-of-code
Helping Santa deliver all the Christmas gifts by solving coding puzzles at https://adventofcode.com/ (by iav0207)
-
advent-of-code-2023
Solutions to Advent of Code 2023 puzzles https://adventofcode.com/2023 (by Lysander6)
-
AoC2020
Advent Of Code, yearly puzzle extravaganza in the days leading up to Christmas. (by GoldenQubicle)
-
advent-of-code-2023
About Solutions for Advent of Code 2023, written in JavaScript using node.js (by johnbeech)
-
Advent-Of-Code-2023
Archive of my solutions. I will be doing my best to golf all of them for fun. (by Nico-Posada)
-
advent-of-code-2015
Solutions for Advent of Code 2015, written in JavaScript using node.js (by johnbeech)
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
I would be interested to know how you performed your benchmarks. I got down to 102.30 µs / 107.12 µs (i5-1240P, no IO). Maybe its faster because I don't use a HashMap, but idk if my method of benchmarking is correct [Code].
Yes! ...although I wrote today's code without reference to my old solution to the exercism exercise, I have to say now looking back, sometimes less types is more 🤔
Day7.fs
[LANGUAGE: Perl5] 76/123 Solution Video
[LANGUAGE: Python 3] Embarrassing/Embarrassing Ugly raw solution code
Solution here. I really wanted to make a common score function for part 1 and part 2, but in the end decided it's not worth the extra energy to figure it out in a clean way so I did it because my brain couldn't shut up about it. I still like my approach, where I just generate a score string for each hand, and then sort the input list with it.
code
[LANGUAGE: C] 7571/5056 Took me a while to solve part 1 but Part 2 was a really easy modification. I used C's built in qsort function to calculate the ranks which is cool.
Part 1 GitHub
Who wants spaghetti?
GitHub
For part 2, the sort order of the cards changes. For constructing the type of the hand, just place the jokers in with the most frequent other count. If no others you have a 5 of a kind anyway. github
Part 1
Github
Part 1 and part 2 were surprisingly similar - for both, I parsed the cards, mapping letter cards to their rank ordering (so for part 1, t = 10, j = 11, and so on, and for part 2, t = 10, j = 1, q = 11, and so on (although I could have just modified j = 1, I guess...), and recording the bid, as a word - I decided that I would pack the input data into a qword per hand so that I could apply my qsort function that I'd already written with minimal modifications.
Full code here
Part 1
Link
This challenge was perfect for sclin!
Part 1
Part 1
Day 7
Part 1, Part 2
Part 1 Part_2
Github
[Language: C++] Source code in GitHub. A bunch of if-else blocks in a ~160 LoC function :-O plenty of space for improvement to simplify, surely. Positively, I think it is still quite readable and easy to follow what's going on.
Link to file in github
Cool, I'll def use your input for further debugging. My solution passes on the given example, but part 2 answer to the real input is not accepted :(
[LANGUAGE: Scala] code
Github day 6
[LANGUAGE: noulith] fork
[Language: Python]
Yes! ...although I wrote today's code without reference to my old solution to the exercism exercise, I have to say now looking back, sometimes less types is more 🤔
Code here
https://github.com/Busata/advent_of_code/blob/main/src/bin/2023_07.rs Part one took some debugging because I detected full houses wrong Part two was relatively easy by having the correct data at hand (:drums:) So far so good in learning Rust.
Github link
https://github.com/Lysander6/advent-of-code-2023/blob/master/day_07/src/lib.rs (part 2 only, as I couldn't be bothered to preserve code for first part - it can be seen in git log anyway)
Solution
https://github.com/p3rki3/AoC2023/blob/main/Day7_solution.py Part 1 - I did by processing the input file, scoring each hand and then sorting using a custom sort function.
All solutions: https://github.com/glebm/advent-of-code
Solution is here
Why sort numbers when everything is a string?
Full code
github
https://github.com/OlympusTiger/Advent-of-Code/tree/main/2023/Day7
CODE
code here
The commit
code
Commit
Edit: you don't need to determine the type of hand, but you can directly compare the card counts. Second version @GitHub.
My code
Complete code with lots of comments: https://github.com/ednl/adventofcode/blob/main/2023/07.c
https://github.com/drkameleon/arturo-aoc-2023/blob/main/day-07/day-07-b.art.
Link Github 2023 Day 07
Solution
A good reason to learn how Ord works in Haskell Github link. (+ tried to outsmart part 2 by directly storing pair of 3 instead of it's a pair but did not need it in the end...)
I wanted to do this as organized as possible. Seeing other solutions now, I realize it could have been way simple. At least my ocd is satisfied
Camel Cards: A sonnet
part1
Short and simple solution with dict and Counter
[LANGUAGE: Python] Code (13 lines)
Code
Code
Code for both part 1 and 2
Full repo: GitHub
Part 1: https://github.com/Queueue0/aoc2023/blob/main/day7/part1.go
A very verbose solution - enjoyed this one!
Code: github
Almost hand-rolled every combination in part 2 before doing substitutions. And so much boilerplate to satisfy sorting requirements.
This is my solution of part 1 and part 2 for today. Implemented the Ord-Trait to handle the Equal-Case accordingly by passing to the card array comparison. A Joker in part 2 increases the number of the cards with the highest count in hand.
Code: GitHub
Part1
Part 1: Parsed the input first, creating two scores for each hand, the first was how good the hand was giving 7 for a five of a kind, down to just 1 for high card. The second was an integer value of the hand in sudohex (T -> a, J -> b, Q -> c, K -> d, A -> e). I then just ran a quick sort on the array, using these two values to compare. (Thinking about it, I could have just appended the score from the first calc to the sudohex as it would have been the most significant digit).
Part 2: https://github.com/PetchyAL/AoC2023/blob/main/solutions/day07/day7_part2.py
Part 1 and Part 2
[LANGUAGE: Rust] I'm very proud of this solution. I found a discriminant that lets me recognize the type of hand with a single check. Each part takes less than 150 microseconds to run. Almost zero allocations (only 1 vec). https://github.com/adriandelgado/advent-of-code/blob/main/src/y2023/d07.rs
Link
Link
[LANGUAGE:F#]https://github.com/vorber/AOC2023/blob/main/src/day7/Program.fsAfter the difficulty roller-coaster of the previous days I expected this one to be a bit more challenging :)
Full program and Blog post.
https://github.com/tcsullivan/advent-of-code/tree/master/day7.
Link to Repo
github
a.py (part 1) / b.py (part 2)
2023 - D8 - OCaml
Solution on GitHub
[LANGUAGE: OCaml] https://github.com/thinnerthinker/aoc2023/blob/main/bin/day07.ml
https://github.com/muffinhydra/Advent-of-Code-2023-GO
Github
Solution on GitHub
Code: https://github.com/JanneSalokoski/advent-of-code-2023/blob/main/day-7.py
Pretty easy challenge today, [here's my code](https://github.com/LeoLewandowski/AOC2023/blob/main/calendar/7.js)
Day 7 Parts 1 & 2 in a single line of Python (one-liners on lines 60 and 105; multi-line solutions above them).
Day 7 4760 / 6404
Github
This is how I solved it. (It's only this long because I copy-pasted the functions solving part1 to apply the modifications.) This was the most fun puzzle so far.
I really loved this one, I enjoyed doing it and I'm happy with how I managed to deal with it. You can see my solution to both parts on my GitHub.
github
Pretty proud of my 16 lines solution for day 7. https://github.com/sayan01/advent-of-code-2023/blob/master/07/p.py
Solution Part 1
fdlk/advent-2023 on GitHub
I have a poker library, but it doesn't help, as this is very different from actual poker. Was surprised I had no bugs (once it compiled).
I assigned numeric values to each hand and used sort_by over the values: https://github.com/TheBITLINK/AoC2023/blob/main/day7/src/main.rs
[LANGUAGE: Rust] Ordering trait and nice pattern matching example ~100 lines
[Language: PICK Basic] Like other's I had to use a different example data set to see if my logic was on the right track. Also, execution for both parts is not under a second, but it is under 15 secs. My code: https://github.com/ewm76903/2023_AOC_PICKBASIC/blob/main/DAY_7
Part 1:
Github
part1: https://github.com/balintbalazs/advent-of-code/blob/2023/src/bin/day7.rs
[Language: Julia] (on GitHub)
https://github.com/omeldar/Advent-of-Code/2023/haskell/day07.hs
This solution is probably a great example of 'how not to do it'. Overengineered in some parts, just plain dumb-hardcoded in others, but I spent so much time debugging without realizing that I misunderstood the rules that I pretty much stopped caring.
Link to java code
[LANGUAGE: nim] https://github.com/runekaagaard/aoc-2023/blob/master/day07.nim
Link to Solution
I love golfing in ruby, and I was golfing this one too. I got 125 bytes for pt1 and 165 for pt2 (those counts don't include the shebang line). Here are my solutions: https://github.com/Nico-Posada/Advent-Of-Code-2023/tree/main/Day-7
Not the best solution, especially after part 2. But not too bad either
Solutions: Github
[Language: JavaScript] github Spent a while trying to get part2 correct. Just to realize i missed the "J cards are now the weakest" line... Fun problem though!
Github link
I got down to 30 µs (Apple M2) for both parts combined, excluding I/O: https://github.com/orlp/aoc2023/blob/master/src/bin/day07.rs.
Part 1 -> simple implementation, sort the list using a custom function. The main component is the function extractInfo which returns the number of pairs and the number of times the card with the most duplicates appears.
Solution on GitHub
The only code differs for two parts is as follows - https://github.com/bhosale-ajay/adventofcode/blob/master/2023/ts/D07.test.ts - under 80 lines.
I also use the given bases to make sure the hand type is always more significant to the tie breaks. Here's the code.
Longer than I would like to, but it works quite fast : adventOfCode2023/Day_7 at master · monpie3/adventOfCode2023 (github.com) + few tests
Go: https://github.com/torbensky/advent-of-code-2023/blob/main/day07/main.go I really liked the byte ordering approach that I took!
Part 1
Github Link
part 1
Today took a long time, but I am pretty happy with my solution, and I learned quite a bit!
[LANGUAGE: Python] https://github.com/Hoinkas/AdventOfCode2023/blob/main/SeventhDay/SeventhDayPuzzle_Hoinkas.py
I have a solution for Day 07 part one here. My solution for part 2 is working on the test input but not the puzzle input. I've tried a few things now and I'm kind of stuck for ideas. Does anyone know of any extended test data or common edge cases they could suggest?
GitHub Part 1, GitHub Part 2
Too lazy to implement part 2 separately :P
Day7 Part 1 / Part2
Part 1 & 2
Day 7 Solution
Not designed to be efficient but it is hopefully readable --> Github Code
solution
github