It's back! It's finally back! One of my favorite things on the internet is the yearly Advent of Code challenge. It's a programming challenge tha...
For further actions, you may consider blocking this person and/or reporting abuse
Hey!! So excited that it's this time again here is my code. I would have just done loops without sets but the servers were down when I was trying to get my full input so I just went ahead and did a tiny optimization :).
Oooh! That's a really slick way to drop out a level of nesting. I like it!
Hi! It was also my first time in Advent of Code.
There is my solution for the first day in Elixir: click, GitHub
Except input setup the code looks like:
SQL works for me. Easy and fast ;)
Get this table naming 'day1':
1.2. Solution
Here is my solution in rust (minus all the code required to grab the input and parse it)
Hey - I'm working on the problems in Rust this year, too! I'm putting all mine in Github, but will share here, too.
(I found a cool cargo plugin that provides helpful macros and makes doing AoC stuff easier - cargo-aoc)
I am also gonna be doing aoc this year. Here is my Python solution:
Yep, this'll be another year fighting the urge to pre-optimise xmas code 🤦
Anyway, here's a nice efficient implementation in JS... (linear for part one, which is nice. Square for part two which could be improved but, like, why?)
I'm liking Ryan's idea of using this to practice new languages and get out of the comfort zone (though JS is just so comfy now 😌 )
Plan is to make myself a twister-style spinner with 5 or so languages, and force myself to use whichever one the arrow lands on on the day.
I'm going to try to do my solutions in C. C is something I'm learning, so if anybody has any pointers (LOL), please don't hesitate to critique my code.
I didn't do anything crazy today. I just threw loops at it to see if it was fast enough. It solved before I could blink, so I'm not going to work any harder at improving speed.
I'm also doing it in C this year! I'm also fairly new to the language and pretty much the only thing I've done differently is use
fscanf
instead offgets
in conjunction withatoi
(+ I've optimised a little bit to do both parts in the same loop)
Python, why make it complicate if it is so siple?
My solution is the same but yours is also more slim!
Good job!
Hi !
Here is my solution in PHP.
I try to make a generic function that can handle 2, 3 or more number in the expense report.
Full size here : Advent of Code - Day 1
COBOL:
This is awesome! I'm so happy I get to add COBOL to the list 😁
Hey Y'all!!! I thought I'd actually try making this happen this year and I completed the first challenges today!! I think in later challenges I'll actually try importing the text file as it is, but I wanted to make it fun for myself. I did the solution this time in ruby, and its a program you'd run on irb, that asks for the expenses and the factor you need to group to find the magic number (2 or 3) and it prints out the number to enter at the end.
Here's the way I solved it:
Ooh filtering out numbers > 2020 is a really nice touch. I hadn’t thought of that 😁
Hi! A little bit late, I've start with AOC this year and waiting for tomorrow I've try the past event this is my solution in python for 2020 - DAY 1:
Very good content here Ryan!
I wasn't even going to do AoC this year after a bit of burnout last year. But I have no self-control. I have done day 1 in Haskell, Rust and C to compare performance. Rust wins by a hair.
github.com/neilgall/advent-of-code...
Only just heard of this, have some catching up to do! Here's my day 1 - similar to a couple of others already posted. Weirdly the part 1 problem came up in an interview just a couple of weeks ago!
Bit late to the party, here is my iterator focused solution in rust. input is a Vec, aka the parsed input data
Edit: solution 2, same concept, but more concise
Here are my solutions in Scratch. Enjoy! scratch.mit.edu/studios/28204945/
Not anything difficult or complex in my code
It is in rust
use std::fs;
fn main() {
let file = fs::read_to_string("D:\Coding\AdventOfCode\day_onw\src\Data.txt").expect("Not read").to_string();
let sum = 2020;
let nums = file.lines();
let mut result = Vec::new();
let mut vector = Vec::new();
for i in file.lines() {vector.push(i.parse::().unwrap())}
for i in nums {
let num = i.parse::().unwrap();
for a in file.lines() {
let num2 = a.parse::().unwrap();
if vector.contains(&(sum - (num + num2))) {
result.push(num);
result.push(num2);
result.push((sum - (num + num2)));
}
}
}
print!("{}",result[0]*result[1]*result[2]);
}
My solution in C#: (The timer is just for fun ..)
My JavaScript walkthrough:
Hello, I solves it like this github.com/emilpriver/Advent-of-co...