-
A simple and stupid OCaml solution w/o any third-party libraries :)
-
Judoscale
Save 47% on cloud hosting with autoscaling that just works. Judoscale integrates with Django, FastAPI, Celery, and RQ to make autoscaling easy and reliable. Save big, and say goodbye to request timeouts and backed-up task queues.
-
Rust, quite slow though, because the script I had to get the input automatically didn't use EST initially and I had to fix it, losing like 5 minutes. But was quite easy with Itertools::tuple_windows (though array_windows in std would have been even nicer, once that lands on stable).
-
-
Here is link number 1 - Previous text "BQN"
-
-
function day01(input::String = readInput(joinpath(@__DIR__, "..", "data", "day01.txt"))) reports = parse.(Int, split(input)) part1 = count(a > b for (a, b) ∈ zip(reports[2:end], reports[1:end-1])) sums = [a + b + c for (a, b, c) ∈ zip(reports[1:end-2], reports[2:end-1], reports[3:end])] part2 = count(a > b for (a, b) ∈ zip(sums[2:end], sums[1:end-1])) return [part1, part2] end Github: https://github.com/goggle/AdventOfCode2021.jl/blob/master/src/day01.jl
-
Here is link number 1 - Previous text "F#"
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
My solution is here.
-
on the matter of tips: - there are "functional" solutions using zips and filters which are shorter. An example with a very nice setup here: https://github.com/MichalMarsalek/Advent-of-code - there is a possible optimization for second part (you will find it explained in the blogpost above).
-
I'm actually doing this in F# this year, to learn F#, but I felt like solving it in one line in python just for fun.
-
-
Python day 1 solution (GitHub). Using Numpy's convolve function for sliding window calculation
-
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
I got 12th on part 1 and 55th on part 2. Video of me solving: https://youtu.be/pkLfyRwDMMw. Python3 code: https://github.com/jonathanpaulson/AdventOfCode/blob/master/2021/1.py
-
-
Here's my solution in F#.
-
-
Here's mine using Rust iterators
-
Python 3, 628/611
-
Pascal 3362/2895
-
Python (849/602)
-
Clojure
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 and 2024 in Scala (by sim642)
My Scala solution.
-
Scala 3
-
Link to solution
-
Raku (neé Perl 6) - Source including file reading and output printing
-
C# https://github.com/Perska/AoC2021/blob/master/AoC2021/Days/Day01.cs
-
Nothing fancy
-
advent-of-code-2021
Solutions for Advent of Code 2021, written in JavaScript using node.js (by johnbeech)
-
Pretty simple day 1! I took so darn long to remember how pandas worked. My solution / used zip to shift and compare as well as using pandas' rolling sum feature for part 2
-
full solution
-
GitHub: https://github.com/caderek/aoc2021/tree/main/src/day01
-
C
-
Go, 653/1522
-
Full Code
-
HASKELL
-
-
-
adventofcode
Advent of Code (http://adventofcode.com) solutions written in Python 3 (by viliampucik)
Python 3 - Minimal readable solution for both parts [GitHub]
-
Part 1
-
Javascript [Part 1] [Part 2]
-
Elm https://gitlab.com/sakisan/adventofcode/-/blob/2021/Elm/Day01.elm (didn't do any clean up after it got me the answer)
-
Common Lisp 365/3502
-
C++
-
advent-of-code
Discontinued Solutions for Advent of Code problems in various languages. (by Andrew-William-Smith)
Solution on GitHub
-
-
AoC2021
Discontinued Advent of Code 2021. A Rusty submarine? [GET https://api.github.com/repos/wilkotom/AoC2021: 404 - Not Found // See: https://docs.github.com/rest/repos/repos#get-a-repository] (by wilkotom)
-
-
Pretty straightforward Rust solution https://github.com/jeremylt/advent2021
-
This year, I'm hoping to write solutions in both Factor and Red.
-
-
Python with zip, a nice refresher: ``` from typing import List
-
Clojure, mainly list manipulation and `core`.
-
Solutions in both OCaml and awk: https://github.com/chenson2018/advent-of-code/tree/main/2021/01
-
-
Kotlin solution
-
Full Code
-
adventofcode
My collection of Advent of Code solutions in a slightly overkill project setup 🙃👻 (by marcelblijleven)
My Python solution
-
Rust
-
My solution in Adventlang 🎅
-
-
-
Python: Code
-
-
If you want to see really good solutions, check out Vik Fearing! (https://mobile.twitter.com/pg_xocolatl and his repo for advent of code: https://github.com/xocolatl/advent-of-code)
-
-
I'm still learning rust, and the API surface seems huge :'D... I used iterators for my solution.
-
-
``` https://github.com/r0f1/adventofcode2021/blob/master/day01/main.py
-
github
-
-
C# solution. Was around 1:57. I would have been earlier but I accidentally counted the length of the input instead of the increasing pairs, so I had to wait the penalty time.
-
Mine (not very sophisticated) solution in python.
-
First time doing the AoC. C# solution: https://github.com/HashTag42/AdventOfCode/blob/main/2021/2021-01/2021-01.cs
-
Typescript funtimes!
-
C# repo. Happy AoC everyone!
-
JS Day1 in a one liner https://github.com/TheAngularGuy/aoc2021
-
-
-
Hello everyone! I'm using AOC2021 to get familiar with numpy, so here is my (inelegant) numpy solution.
-
Dyalog APL
-
GitHub
-
Very basic Python. Pretty nice introductory puzzle. I can't wait to see what shenanigans we get up to with this submarine.
-
Python, using no external libraries. Today's problem is pretty simple, so I doubt it'll be much help today, but generally my main goal with my solutions (well, besides getting the correct answer in a reasonable amount of time, obviously) is to write them in such a way that someone who is having trouble with the problems can read through it and understand how it works.
-
@Github
-
-
Link to Code
-
My ruby solution: [2021 Day 1] Not the best, but Ruby is very new for me.
-
My Java solution: 2021 Day 1
-
A solution in Python
-
Like every year, i have my haskell solutions and reflections every day here :) https://github.com/mstksg/advent-of-code-2021
-
-
Python
-
C
-
A fairly neat and clean python solution (written in Jupyter Notebook)
-
I actually did the same as you when I first solved it But I saw other people use the l[3] > l[n-3] trick, it didn't make much sense at first but now I get it and it's quite clever. Basically take [1 2 1 3], the windows would be w1=[1 2 1] and w2=[2 1 3], as 2 and 1 appear in both windows what really matters is w1[0] and w2[2] which are unique to each: 1+(2+1) < (2+1)+3 == 1 < 3.
-
C++
-
Rust: https://github.com/rv3392/advent-of-code-2021/blob/master/src/day1.rs
-
Learning Rust, so there is my solution: https://github.com/finalfire/aoc21/blob/main/src/day1.rs
-
Using Linq and AoCHelper. Input has already been parsed to an IEnumerable. See full code here.
-
advent-of-code-2021
Advent of Code 2021 solutions in Ruby (https://adventofcode.com/2021) (by damyvv)
Hallo mede-Nederlander ;). Thanks for your comment, I will post all my solutions [here](https://github.com/damyvv/advent-of-code-2021). And you can find all my solutions from last year [here](https://github.com/damyvv/AoC_2020). Ruby is so powerful, I truly enjoy coding with it. If you have any questions about Ruby, let me know, I'll be happy to answer them if I can.
-
Hallo mede-Nederlander ;). Thanks for your comment, I will post all my solutions [here](https://github.com/damyvv/advent-of-code-2021). And you can find all my solutions from last year [here](https://github.com/damyvv/AoC_2020). Ruby is so powerful, I truly enjoy coding with it. If you have any questions about Ruby, let me know, I'll be happy to answer them if I can.
-
CSpydr is my own programming language, which I'm developing since almost a year. (my AoC2021 repo)
-
CSpydr is my own programming language, which I'm developing since almost a year. (my AoC2021 repo)
-
Part 1 and Part 2
-
JS solutions, already settled back into the habit of relying on reduce functions
-
-
day 1 solution on github
-
It's part of the MoreLinq library. The Window() function code is here.
-
C# solution
-
Day 1 Golang solution: github
-
-
Rust, zipped iterators.
-
Haskell
-
As tests have been super useful to me for AoC in the past, I applied some TDD and wrote tests, too. Basically, I just started learning this really beautiful language, so I'm rather thankful for comments and feedback.
-
I don't think anyone else has done this before. So here's day 1 part 1 & 2 implemented in pure LLVM IR. https://github.com/DaveTCode/aoc2021-llvm/blob/main/day1/day1.ll
-
My simple solution: Day01.cs
-
Kotlin -> [Blog/Commentary] - [Code] - [All 2021 Solutions]
-
My solution in C++
-
My Javascript solution
-
My solution in Python, using boolean sums.
-
-
Code: https://github.com/Rakicy/AOC2021/blob/main/day01.py
-
Here's my solution in Clojure. Feel free to correct me as I'm still beginner.
-
Part 1
-
Prep
-
Part 1
-
I used Algorithms and took inspiration from Kotlin with it's zipWithNext function.
-
Python 3. Part 1, Part 2.
-
-
Rust. The windows() method is really the MVP of the day
-
-
Solution
-
First time participating on AoC :D, it's been a fun first day! So here is my solution in Kotlin.
-
My Naive Haskell Solution: https://github.com/Maeevick/adventofcode2021/blob/main/src/D1.hs
-
This is my solution: https://github.com/rhbvkleef/aoc2021/blob/master/lib/solutions/day1.ex
-
AoC_2021
Discontinued [GET https://api.github.com/repos/DamienPirsy/AoC_2021: 404 - Not Found // See: https://docs.github.com/rest/repos/repos#get-a-repository] (by DamienPirsy)
-
https://github.com/Two9A/advent-2021/blob/main/01.py https://github.com/Two9A/advent-2021/blob/main/02.py
-
Link to repo: https://github.com/LactoseGK/aoc2021
-
Docker instructions (includes my account's inputs): https://github.com/jasonincanada/aoc-2021/blob/main/Docs/Docker.md
-
At Haskell Foundation we are working on Haskell School, far to be finished but the repo is public: https://github.com/haskellfoundation/HaskellSchool/
-
thanks, I just started learning clojure with aoc and used your solution to get a hang of the syntax and everything. you could reuse your function for task 1 like this
-
Java on github: https://github.com/MissMormie/adventOfCode2020/blob/main/src/main/java/days2021/day1_SonarSweep.java
-
Part 1 & 2
-
Rust. Long and modularised, and hopefully pretty: https://github.com/matiu2/aoc-2021/blob/main/day1/src/shared.rs
-
-
Swift: https://github.com/lukeredpath/AdventOfCode2021/blob/main/Sources/AdventOfCode2021/01.swift
-
Full code: https://github.com/tcbrindle/advent_of_code_2021/blob/main/dec01/main.cpp
-
The repository is available on Github
-
GitHub
-
Using Golang https://github.com/wesreisz/advent_of_code
-
Source and tests
-
Go, Day 1, Part 1
-
-
Haskell 658/970
-
Github Solution
-
(time (format t "part 1:~a~%" (increasing-pairs (read-numbers "../inputs/01.txt")))) (time (format t "part 2:~a~%" (increasing-threes (read-numbers "../inputs/01.txt")))) You can find the repo for it here: https://github.com/pbohun/aoc-2021
-
Not the best. Seen much better solutions in this thread. https://github.com/rajputrajat/advent_of_code_2021/blob/master/day1/src/main.rs
-
On GitHub
-
Quite a nice little solution if I say so myself. The full solution is here.
-
Advent-of-Code-2021
A Kotlin-based repository of my solutions for the Advent of Code challenge of 2021. (by vini2003)
Kotlin
-
Clippy
A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
An opinionated linter for Rust https://github.com/rust-lang/rust-clippy
-
-
part one
-
adventofcode
https://adventofcode.com :yellow_heart: :blue_heart: :purple_heart: :heart: :green_heart: (by kjempelodott)
Rust. My code has owls :3 https://github.com/kjempelodott/adventofcode/blob/master/aoc2021/src/bin/day1.rs
-
part1
-
part 1 part 2
-
My Haskell solution (using Justin Le's scaffolding):
-
rust_advent_of_code
Discontinued Code related to Advent of Code 2021 using Rust [Moved to: https://github.com/JCardoen/AdventOfCodeRust2021]
Implementation in Rust (first day using Rust) https://github.com/JCardoen/rust_advent_of_code/blob/master/src/day_one/one.rs
-
I'm glad you found my solution helpful. Check out the latest version. I think it's even neater.
-
My solutions in Rust: https://github.com/LinAGKar/advent-of-code-2021-rust/blob/main/day1a/src/main.rs and https://github.com/LinAGKar/advent-of-code-2021-rust/blob/main/day1b/src/main.rs
-
Day1: Golang
-
Hey! This is my Java solution: https://github.com/zebalu/advent-of-code-2021/blob/master/src/main/java/io/github/zebalu/aoc2021/Day01.java
-
clojure
-
My solution in Kotlin: https://github.com/ThomasBollmeier/advent-of-code-kotlin-2021/blob/1419d954754147f215f96986282429d318372751/src/Day01.kt
-
I have wanted to learn Haskell for years. This is my chance. https://github.com/GaalDornick/AdventOfCodeSolutions/blob/main/src/adventofcode/year2021/day1/app/Main.hs
-
More details including docker container to run available here: https://github.com/ecrooks/aoc2021_SQL
-
My solution in Scala 3 : github
-
Code is at https://gitlab.com/NeilNjae/advent-of-code-21/-/blob/main/advent01/Main.hs
-
-
First time doing one of these, I'm a very novice programmer, but here's the important part of my C++ solution
-
I'm trying in Go this year, just because I'm working on learning it.
-
-
Python 3.9 Solution (GitHub)
-
Oh, that's actually from the arrow-macros. I omitted the boilerplate which loads a couple libraries like it, fset, alexandria, uiop, etc. You can see everything here.
-
-
Here's how I did it : https://github.com/RyZum/adventofcode2021/blob/main/Day1/Program.fs
-
Check repo for complete code and F# code.
-
Wren
The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.
I was initially going to do these in Python (and I still am) but someone in Discord got me to give Wren (https://wren.io/) a try. Here's my solution for both parts: import "io" for File
-
advent-of-code-2021
Discontinued Trying to solve https://adventofcode.com/ [Moved to: https://github.com/ThePituLegend/advent-of-code] (by ThePituLegend)
-
-
Elixir A bit long because I'm still learning, but that was FUN! https://github.com/avatus/advent_of_code/blob/master/2021/sonar_sweep/lib/sonar_sweep.ex
-
Day 1 JavaScript Solution: https://github.com/Nishoake/2021-advent-of-code-js/tree/main/solutions/01
-
I'm also doing Kotlin.
-
Here's my TypeScript solution: https://github.com/Rigidity/AoC-2021/blob/main/src/day1.ts
-
-
advent-of-code-scala
Complete 2022 to 2015 entries for the annual Advent of Code challenge, written in concise idiomatic functional Scala.
Solution in Scala
-
Code in repo
-
advent_of_code
This repository contains solutions to each of the problems in Advent of Code 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 and 2024 in C++ (and 2020 in Python as well)
Solutions in C++: Part 1 Part 2
-
Unfortunately I needed to change slightly the input adding commas. See https://github.com/bellaz89/lolAOC
-
-
My trash solution (compared to using zip like people way more clever than me): https://github.com/plan-x64/advent-of-code-2021/blob/main/advent/day1.py
-
Part 1 Part 2
-
https://github.com/adamz01h/adventofcode_2021/tree/master/day_1
-
Java 17 (with Lombok and Spring) Code: Day1.java
-
My solution in Python. At first I summed all three numbers for part 2 but then I saw the optimization in the comments and implemented that.
-
Here's my solution : https://github.com/mariush-github/adventofcode2021/blob/main/01.php
-
(define (solve-part2 input) (let [(filtered (map (λ (l) (apply + l)) (windows 3 input)))] (apply + (map bool->number (map (λ (ab) (apply < ab)) (windows 2 filtered)))))) `` Wherewindows` is defined in a helper library. Full code is here
-
My "production-ready" (at least that is the intention) solution for day 1 in Python (part1+part2)
-
-
JavaScript (nodeJS): GitHub
-
github link
-
JQ
-
part 1
-
Github
-
Part 1 involved tracking the previous value and comparing against that - I didn't even need an intermediate list storing all of the numbers.
-
GitHub/DepthSweeper.java
-
-
-
InfluxDB
InfluxDB high-performance time series database. Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.