Took me 2.5 hours for both the stars. 90% of time was trying to make my logic work in rust and rest 10% was me contemplating if I should just use python
Would Python make the algorithm any less of a pain to write? I feel like this question was very intentionally made to be very annoying with its edge cases lol
@@Reydriel for me personally algorithm was not that hard to make within the first 2 minutes I knew what I wanted to do with small modifications here and there along the way ( And in no way am I a good CP I am pretty sure my logic would be doo doo water for any decent CP ) but the fact that I have just started with the rust lang. But in the end it was fun.
More or less the same, 1:50h for me, failed the first time I submitted because of an off by one error. Most of the time was struggling with rust (learning it with this year AoC, I have read through like 1/3rd of the rust book before this) and struggling with neovim (also learning it with this year AoC, I have been using vim motions for months tho) I much prefer my solution to LLL's, however the second part is super slow, takes like half a second to run, because the time complexity is ass, plus I used regex to find the numbers. However conceptually is super simple.
@@ficolas2 I too want to learn vim (neovim) but just cant stand it. Tried for the first time last week but couldn't figure out how to move away from the terminal window and focus on the editor without using the mouse lol. Maybe if I can find someone who will instantly help me out for the first few weeks until I develop some basic knowledge then I will happily move away from my vscode haha
@@siddharthbisht8522 I would really recommend doing what I did. First use vimMotions in vscode (or ideavim in intelliJ), and get used to it, before moving to neovim. Otherwise it is so overwhelming. I watched the primeagen's videos on vim motions, and now I can't live without them. Sometimes I am writing something in a Google docs and attempt to do some vim shenanigans...
How it started: *rust copium* How it went: “This is disgusting” “the classic off by one error” (lol, lmao even, rust safety go brrrr) It’s beautiful, brings a tear to my eye. Rust culture aside, solid video homie
Love this idea since day 1, i'm doing something similar where each weekday is a different (set) language, so Monday - PHP (never touched before and am scared for tomorrow) Tuesday - Pyhon Wednesday - Rust (just started learning) Thursday - C# (havent used in years) Friday - Java Saturday - C++ (barely used) Sunday - Typescript
I spent a long time on this, and the whole time thinking "I must be so stupid"... Then I watch this and find I did almost the same logic in my solutions, one with and one without Regex. Thanks for making me not feel stupid, that a programmer magnitudes much better and more experienced than me didn't have a solution that to me is unintelligeable. :)
I approached this one as an axis aligned bounding box collision detection problem - just treat every symbol as a 3x3 box centered at the symbol, find what collides with it.
Really glad it wasn't just me! My algorithm was similar; I read the array left to right, top to bottom and when it found a digit started reading that into a buffer until there wasn't any more digits while keeping track of x and y for those digits, then checked if there was any symbols around it (previous line, before and after, next line). To avoid index issues in the array I added a line of dots to the beginning and end and a dot at the start and end of each line. That worked fine, but I found the second star much harder. I did the same thing but only recorded if there was a * around the number, then walked in a circle around the * to look for a second number, and assumed there was no duplicate two numbers in the array.
I looped over chars ,and each time i encountered a digit, i searched around the digit for a symbol & marked the cur_num as valid if yes. Part2 was similar. For each *, searched around, then found the start of any number & kept an array of start-positions to prevent duplicates.
My solution was starting by defining a function where you would give it x / y coords where there is a single digit, and it would return the full part number where that coords belongs to, with that function working the rest was pretty straightforward
13:06 I think it's because you cant format and write code properly, because you using vim, instead of normal IDE Also I don't understand why Vim can't add whitespaces when you go to a new line?
I'm doing aoc in Uiua. I hated every second of this task and gave up on the second star of the day. But I gotta say, looking at you doing it in rust, I'm starting to see why some people love array programming. My solution is a total of 486 characters (including whitespace), and for every component, I can reason its correctness.
Haskell was put on the wheel! It's a very powerful language and is the most popular of functional programming languages. It has its roots in academia but it's used in the industry often. Its strength is in symbol manipulation making it perfect for this challenge. Benchmarks on Haskell programs have shown it to be very fast too.
Surprisingly - according to GitHub language usage statistics - Elixir is the most popular functional programming language measured by the number of repositories using it. Just thought it was an interesting fun fact :)
As a rust dev, this season's advent of code really makes me want to just switch to C++ due to the strict nature of Rust trying to prevent you doing bad things with strings, even I know damn well the input strings are just pure ascii chars 😂. Well I can use a library for doing ascii things but currently I don't want that
I'm trying out rust for this AoC, and so far, I have only really struggled with strings because of trying to access a hashmap with a String, that had as key type &str. Since the strings just have normal characters, I just did .chars(), and accessed them normally. Rust so far has been a weird experience, and I kinda like that. My experience with is is, read through like 1/3rd of the rust book, and started the AoC this year
I did it in Rust, i collected the lines into a list with an "all-dots" line at the beginning and end, walked that list with a window of 3, and zipped the 3 slices from the windows with a window of 7, if the center most char is a symbol, i basically check all possible combinations of chars for numbers, one of the checks being using another window of 3 over window(7) slice so in total, i call 'slice::window' 5 times my solution only works because the input does not have any symbol at the start or end of lines
Surprisingly out if all the codes so far (I’ve gone up to 4). This was by far my cleanest and most efficient whilst implementing. Really struggled day 1 part 2 because if the stupid joined numbers. This 1 took me like 30 mins for both part 1 and 2. Walk array recursively find numbers sum
Cool series! I feel like I hit many similar emotions while solving today's challenge. Especially "I don't like this solution there should be a better way to do this" ... damn I felt that
Wrote this day in Rust as well. Surprisingly not painful. It helped that I made the smallest thing a separate function. The very first thing I did was make a function that extracted the part code from a line, from wherever you started on that line if you started on a digit.
Wanted to see how to do it cleverly since I was unhappy with my solution. Accidently you boosted my confidence ;) But now I know how to use enumerate(). Thanks for that.
I don't know why, but I misinterpreted the question as numbers touching parts (other numbers touching symbols) also being parts themselves. My unimplemented solution was gonna be something like: 1. 2-pass connected components (need to figure out 8-way neighbour helper function for non-dots) 2. For each blob in raster order, if a symbol exists, sum parseable digits. The intended reading is obviously way easier...
I'm currently working on Day 3 in rust, and I'm happy I decided against the sort of approach you took here. I'm using regexes to locate numbers and symbols, and I'm doing a 2 pass approach: Each line has it's own vector of indices adjacent to a symbol on that line. Pass 1 locates each symbol and inserts the appropriate indices into the appropriate vectors. Pass 2 checks each number on each line, checking whether any of the adjacency indices are within the number's start/end range. Currently trying to figure out where my bug is, because I'm convinced I have exactly 1 bug preventing me from getting the right answer currently but code blindness has set in and I'm going mad because I haven't even tracked down which number it fails to count.
This is my algorithm for the first half of the problem (also in Rust btw): ooooooo o69420o ooooooo All the o's in the above diagram are all the positions you gotta check for a symbol (i.e all its neighbours). If you observe, for all the digits you just need to check the cell above and cell below, except for the first and last digit. To fix this, just assume the middle line's first 'o' and last 'o' are also digits. Now, for all "digits", you just need to check the cell above and below. However, that would mean you would need to check for those two 'o's separately. So, you CAN do that, or you can be lazy like me and instead for each "digit", you check for cell above, cell below and yourself for being a symbol. Since digits are guaranteed to not be a symbol, this is just equivalent to checking for the middle 'o's as the check for yourself will always return false for digits. Sure, computation wasted, but effort saved.
For part 1, I just looked for a symbol and generated a list of adjacent coordinates and iterated through to see if first they are valid coordinates and if they contain a number. If it is then find left and right of number, convert to int, and replace with periods to avoid duplicates. Part 2 was trivial with that solution. All in it took about 45 minutes. Was very proud compared to day 2. Language Go.
I did the complete opposite thing. For part 1, I looked at the surroundings of each number to figure out if a symbol is nearby. For part 2 I had a Hashmap with the key being the coordinate of the Symbol and the value being the 2 nearby numbers, or 0 if none are there. (Rust)
My friend coded a fkin matrix logic based blazingly fast simd solution for this in python+numpy like it's nothing while i struggled with my for loops, kill me
Mulling in my head a good way to solve the problem algorithmically. I suspect if you were to redefine the numbers as a set of rectangles (co-ords for top left and bottom right) mapped to their equivalent value, and the symbols also to a set of rectangles that are plus one to each side on the symbol in the centre, and then do a intersection of symbols rectangles to numbers rectangles, then you can sum where you get a hit. I feel like this could be brought down to a few easier to manage passes transforming the data gradually.
I ended up rewriting my solution like 3 times. Today was an annoying one, but after 4 hours I got part 1 working. Luckily part 2 was relatively easy even though I had to rewrite my entire algorithm to handle it.
I also used Rust, also had off by one error, lol. But I kinda like my solution better, I feel like you made it little bit more complex than it needed to be.
I did this challenge, and I didn’t store any structures whatsoever and I felt my solution was so naive. But then I had to do part 2 differently. Sounds like if you do part1 the correct way part2 is simple extension, maybe?
Not a good year to try advent of code in Rust with Colemak-DH with Miryoku keymap on split keyboard when every single one of these things is new to me. lol. I definitely have an urge to just use python.
Rust is like a beautiful girl who you fall in love with, she seems to fall in love with you, and it turns out there's a dozen other guys she's in love with.
@@Romenamath why does it even tell you if it's higher or lower? That isn't particularly useful for debugging in most cases. Is that there literally only to make brute-force easier and thus bait cheaters?
This looks like a mess, I dont know maybe it would've been better to look for a solution like trying to work with regex or something related. Think/plan well before writing any code. Theres also special built in functions to parse/trim inputs in Rust you couldve used.
I'm doing same thing, pick random language for day, but my list is smaller than yours. Day 3, javascript 😢, I'm literally 15 times slower than with Lua yesterday
Like first you want a function `detectSymbols : Arr [m, n] Char -> Arr [m, n] Bool`, as well as `dilate : Arr [m, n] Bool -> Arr [m, n] Bool` which smears every True to the 9 positions around it. Then something like `detectPartNumbers : Arr [m, n] Char -> Arr [m, n] Bool -> Arr [m, n] Bool` which marks as True all digits of numbers which overlap with the patches of True in the input. Then you can replace every symbol marked False with whitespace, run `words : String -> List String` on each line and concatenate all results. Then simply parse all the extracted numbers.
@@LowLevelTV I mean, it made me use a 2d coordinates library (wrapping_coords2d). It also made me realize that a proper coordinate library is missing in Rust, so I guess I will write one to be at peace.
"It's gonna work but it's disgusting" -My exact thoughts while working on my own solution
My exact thoughts working on v0 of anything I've ever written
Yep, same lol. I hate working with multidimensional arrays.
"Unnecessary parentheses around 'if' condition"
I will not be silenced.
didnt ask + dont care + ratio
@@ninetysixvoid Ratio failed, lulz.
@@LowLevelTV Lmao
Took me 2.5 hours for both the stars. 90% of time was trying to make my logic work in rust and rest 10% was me contemplating if I should just use python
Would Python make the algorithm any less of a pain to write? I feel like this question was very intentionally made to be very annoying with its edge cases lol
@@Reydriel for me personally algorithm was not that hard to make within the first 2 minutes I knew what I wanted to do with small modifications here and there along the way ( And in no way am I a good CP I am pretty sure my logic would be doo doo water for any decent CP ) but the fact that I have just started with the rust lang. But in the end it was fun.
More or less the same, 1:50h for me, failed the first time I submitted because of an off by one error.
Most of the time was struggling with rust (learning it with this year AoC, I have read through like 1/3rd of the rust book before this) and struggling with neovim (also learning it with this year AoC, I have been using vim motions for months tho)
I much prefer my solution to LLL's, however the second part is super slow, takes like half a second to run, because the time complexity is ass, plus I used regex to find the numbers. However conceptually is super simple.
@@ficolas2 I too want to learn vim (neovim) but just cant stand it. Tried for the first time last week but couldn't figure out how to move away from the terminal window and focus on the editor without using the mouse lol. Maybe if I can find someone who will instantly help me out for the first few weeks until I develop some basic knowledge then I will happily move away from my vscode haha
@@siddharthbisht8522 I would really recommend doing what I did. First use vimMotions in vscode (or ideavim in intelliJ), and get used to it, before moving to neovim. Otherwise it is so overwhelming.
I watched the primeagen's videos on vim motions, and now I can't live without them. Sometimes I am writing something in a Google docs and attempt to do some vim shenanigans...
How it started: *rust copium*
How it went: “This is disgusting” “the classic off by one error” (lol, lmao even, rust safety go brrrr)
It’s beautiful, brings a tear to my eye. Rust culture aside, solid video homie
It was fun watching the pain and the sudden realization it was right.
Even when you write Rust, your code style is still so similar to C.
Clippy throws a fit every other line
Love this idea since day 1, i'm doing something similar where each weekday is a different (set) language, so
Monday - PHP (never touched before and am scared for tomorrow)
Tuesday - Pyhon
Wednesday - Rust (just started learning)
Thursday - C# (havent used in years)
Friday - Java
Saturday - C++ (barely used)
Sunday - Typescript
I'd argue that php is a better lang than snake. Worry not and embrace the $
I created a list where I chose random languages from each day and got "Haskell, nim, Fortran"... Haskell was by far the easiest to work with
Chat please get AWK on the list next time
Can't wait to see the final episode ended off with Malbolge, where the solution takes until next christmas to find!
I don't think anyone is *that* good to finish it in a single year
I think we all agree to select Malbolge whenever the RUclips chat obtains the privilege to vote
haha funny impossible to read language
You can by now algorithmically construct malbolge programs. They will be nowhere near optimal but they will work.
I think you need to add COBOL to the wheel.
YES!
omg yes!!!! That would be fun to watch
Definitely
I spent a long time on this, and the whole time thinking "I must be so stupid"... Then I watch this and find I did almost the same logic in my solutions, one with and one without Regex.
Thanks for making me not feel stupid, that a programmer magnitudes much better and more experienced than me didn't have a solution that to me is unintelligeable. :)
I approached this one as an axis aligned bounding box collision detection problem - just treat every symbol as a 3x3 box centered at the symbol, find what collides with it.
Nice. In part 1, how did you prevent double-counting if a number is adjacent to two symbols?
Do a uniqueness check on the x and y coordinate of the first character of the number
Use a set
Really glad it wasn't just me! My algorithm was similar; I read the array left to right, top to bottom and when it found a digit started reading that into a buffer until there wasn't any more digits while keeping track of x and y for those digits, then checked if there was any symbols around it (previous line, before and after, next line). To avoid index issues in the array I added a line of dots to the beginning and end and a dot at the start and end of each line. That worked fine, but I found the second star much harder. I did the same thing but only recorded if there was a * around the number, then walked in a circle around the * to look for a second number, and assumed there was no duplicate two numbers in the array.
I looped over chars ,and each time i encountered a digit, i searched around the digit for a symbol & marked the cur_num as valid if yes.
Part2 was similar. For each *, searched around, then found the start of any number & kept an array of start-positions to prevent duplicates.
OH MY GOD THATS SO MUCH BETTER
This is also pretty much how I solved it
I did the same for part 1, for part 2 i serached for stars and looked around them for numbers
Yeah that's what I ended up doing. Except that instead of looping over chars I just used a find on the line. So I had to do less work manually myself.
Didnt expect anyone to pronounce chars as "Chairs"
Started off pronouncing it like the "char" in "chart", then midway switched to pronouncing it like "care".
My solution was starting by defining a function where you would give it x / y coords where there is a single digit, and it would return the full part number where that coords belongs to, with that function working the rest was pretty straightforward
13:06 I think it's because you cant format and write code properly, because you using vim, instead of normal IDE
Also I don't understand why Vim can't add whitespaces when you go to a new line?
Remember, "Haskell makes you a better programmer" ;-)
I'm doing aoc in Uiua. I hated every second of this task and gave up on the second star of the day. But I gotta say, looking at you doing it in rust, I'm starting to see why some people love array programming. My solution is a total of 486 characters (including whitespace), and for every component, I can reason its correctness.
Haskell was put on the wheel! It's a very powerful language and is the most popular of functional programming languages. It has its roots in academia but it's used in the industry often. Its strength is in symbol manipulation making it perfect for this challenge. Benchmarks on Haskell programs have shown it to be very fast too.
Surprisingly - according to GitHub language usage statistics - Elixir is the most popular functional programming language measured by the number of repositories using it. Just thought it was an interesting fun fact :)
As a rust dev, this season's advent of code really makes me want to just switch to C++ due to the strict nature of Rust trying to prevent you doing bad things with strings, even I know damn well the input strings are just pure ascii chars 😂. Well I can use a library for doing ascii things but currently I don't want that
I'm just calling .as_bytes() and work with byte slices lmao
Just Vec if you know it's ASCII. It should have string methods implemented for it
I'm trying out rust for this AoC, and so far, I have only really struggled with strings because of trying to access a hashmap with a String, that had as key type &str.
Since the strings just have normal characters, I just did .chars(), and accessed them normally.
Rust so far has been a weird experience, and I kinda like that. My experience with is is, read through like 1/3rd of the rust book, and started the AoC this year
I'm using C++ and the parsing is just awful. I've tried using views, string_views and even """"modern"""" C++ but i'm missing rust so much on this one
I converted everything to bytes: "".as_bytes().to_vec(); A lot easier to handle
I did it in Rust, i collected the lines into a list with an "all-dots" line at the beginning and end, walked that list with a window of 3, and zipped the 3 slices from the windows with a window of 7, if the center most char is a symbol, i basically check all possible combinations of chars for numbers, one of the checks being using another window of 3 over window(7) slice
so in total, i call 'slice::window' 5 times
my solution only works because the input does not have any symbol at the start or end of lines
So you kept saying "If Haskell gets on this list, I'm f'd"... but... like... you KNEW this would 100% guarantee they choose Haskell. Right?
I want to see a challenge completed in assembly.
it wouldnt even be hard just annoying af
Surprisingly out if all the codes so far (I’ve gone up to 4). This was by far my cleanest and most efficient whilst implementing. Really struggled day 1 part 2 because if the stupid joined numbers. This 1 took me like 30 mins for both part 1 and 2. Walk array recursively find numbers sum
Dude, 7 layers of nesting is enough for an elephant to nest into
#1 rule of livestreams You never tell chat what you don't want them to do
Cool series! I feel like I hit many similar emotions while solving today's challenge. Especially "I don't like this solution there should be a better way to do this" ... damn I felt that
some guy out there is doing AoC in the game "turing complete", basically assembly but worse
Holy how, I need a link
Legend
These 3 days were "How to make nasty things to parse tutorial"
they were actually quite nice and well-defined compared to a lot of problems I've encountered in real life...
@@KingJellyfishII feel you
Wrote this day in Rust as well. Surprisingly not painful. It helped that I made the smallest thing a separate function. The very first thing I did was make a function that extracted the part code from a line, from wherever you started on that line if you started on a digit.
This is the way. We must decompose the problem! 🙂
Wanted to see how to do it cleverly since I was unhappy with my solution. Accidently you boosted my confidence ;)
But now I know how to use enumerate(). Thanks for that.
9:41 this brings me great anxiety and bad memories. I'm never doing AoC again.
Love this series
I don't know why, but I misinterpreted the question as numbers touching parts (other numbers touching symbols) also being parts themselves. My unimplemented solution was gonna be something like:
1. 2-pass connected components (need to figure out 8-way neighbour helper function for non-dots)
2. For each blob in raster order, if a symbol exists, sum parseable digits.
The intended reading is obviously way easier...
I'm currently working on Day 3 in rust, and I'm happy I decided against the sort of approach you took here. I'm using regexes to locate numbers and symbols, and I'm doing a 2 pass approach:
Each line has it's own vector of indices adjacent to a symbol on that line.
Pass 1 locates each symbol and inserts the appropriate indices into the appropriate vectors.
Pass 2 checks each number on each line, checking whether any of the adjacency indices are within the number's start/end range.
Currently trying to figure out where my bug is, because I'm convinced I have exactly 1 bug preventing me from getting the right answer currently but code blindness has set in and I'm going mad because I haven't even tracked down which number it fails to count.
This is my algorithm for the first half of the problem (also in Rust btw):
ooooooo
o69420o
ooooooo
All the o's in the above diagram are all the positions you gotta check for a symbol (i.e all its neighbours).
If you observe, for all the digits you just need to check the cell above and cell below, except for the first and last digit.
To fix this, just assume the middle line's first 'o' and last 'o' are also digits. Now, for all "digits", you just need to check the cell above and below.
However, that would mean you would need to check for those two 'o's separately. So, you CAN do that, or you can be lazy like me and instead for each "digit",
you check for cell above, cell below and yourself for being a symbol. Since digits are guaranteed to not be a symbol, this is just equivalent to checking for the middle 'o's as the check for yourself will always return false for digits. Sure, computation wasted, but effort saved.
For part 1, I just looked for a symbol and generated a list of adjacent coordinates and iterated through to see if first they are valid coordinates and if they contain a number. If it is then find left and right of number, convert to int, and replace with periods to avoid duplicates. Part 2 was trivial with that solution. All in it took about 45 minutes. Was very proud compared to day 2. Language Go.
I did the complete opposite thing. For part 1, I looked at the surroundings of each number to figure out if a symbol is nearby. For part 2 I had a Hashmap with the key being the coordinate of the Symbol and the value being the 2 nearby numbers, or 0 if none are there.
(Rust)
Would love it if you added a timer so we could now more or less how much time it takes you to do these
My friend coded a fkin matrix logic based blazingly fast simd solution for this in python+numpy like it's nothing while i struggled with my for loops, kill me
Mulling in my head a good way to solve the problem algorithmically. I suspect if you were to redefine the numbers as a set of rectangles (co-ords for top left and bottom right) mapped to their equivalent value, and the symbols also to a set of rectangles that are plus one to each side on the symbol in the centre, and then do a intersection of symbols rectangles to numbers rectangles, then you can sum where you get a hit. I feel like this could be brought down to a few easier to manage passes transforming the data gradually.
It's the season, so this guy chose the Christmas tree of death. 7:09
"It's gonna work but it's disgusting" - Whenever I get a date now that I'm over 30.
I ended up rewriting my solution like 3 times. Today was an annoying one, but after 4 hours I got part 1 working.
Luckily part 2 was relatively easy even though I had to rewrite my entire algorithm to handle it.
I LOVE THIS SERIEESS
Title is the definition of a workman blaming his tools :D
Haskell is my favorite language. It's not hard, it's just different.
Also, parsing input in Haskell is a breeze, you're gonna like it!
I felt like Day3 was significantly harder than most day 3 questions on AOC
I solved both parts by building up a list of numbers and a list of symbols, then examining those lists to calculate the answers
I also used rust, but I used pest as my parser, since it gives me the spans of the numbers and symbols
I also used Rust, also had off by one error, lol. But I kinda like my solution better, I feel like you made it little bit more complex than it needed to be.
Please add speedrun timer!
You have to add tcl, postscript, perl and forth to that list
I kept thinking I was done on this one only to run into another small issue.
Oh yeah, I remember running into the same issue. But I think I solved it by adding a column of dots to the right of my inputs 🤣
Should you not be building these as unit testable modules though and using TDD? ;)
title: rust betrayed me
content: off by 1 error
Next poll should include Fortran 🔥
watching this as much entertaining as hurting at a same time hahahah, I do same way though, all of us I guess
How you got the first star without handling '/' as a valid character?
How about dart? Is it included already?
Just watched the first haskell stream on Twitch, that was pure pain.
I like Rust but I easily create logic bugs because I force idomatic code too hard. When the problem doesn't fit the closest idom, it hurts.
whats your operation system and browser?
I did this challenge, and I didn’t store any structures whatsoever and I felt my solution was so naive. But then I had to do part 2 differently. Sounds like if you do part1 the correct way part2 is simple extension, maybe?
This problem was not hard, but boy was it annoying to code😢
Not a good year to try advent of code in Rust with Colemak-DH with Miryoku keymap on split keyboard when every single one of these things is new to me. lol. I definitely have an urge to just use python.
Yeah, I'd initially made that off-by-one error as well.
So, as someone who hasn't used Rust and hasn't used PHP since PHP 5, I have to conclude PHP is currently better than Rust? :-P
I was able to get the first part fairly quickly but after hours on the second part I stepped away. The code was absolutely disgusting.
Just hoping for Fortran or Forth to come on that list. 🤞
Forth +1, but I wanna see him feel the pain of Haskell first 👹
Why stop at haskell: ATS! ATS! ;D
These videos are awesome
I messed up both parts at first. I had a pretty nice solution for part 1, but I had to completely rewrite it for part 2. (I also use Rust BTW)
First ,your videos are great 👍.
Why he hates Haskell do much? 😂
Yes! Please now let the wheel fall on Haskell next time!
Rust is like a beautiful girl who you fall in love with, she seems to fall in love with you, and it turns out there's a dozen other guys she's in love with.
This makes my solution look clean wtf.
first year participating in this challenge do they get harder/more annoying every day? kinda seems that way so far
Fortran should be an alternate lang -definitely Cobol
I just wanna see a code challenge done in IBM COBOL.
Sorry
Rust is still there next to Haskell
public static void chair star rawr main
@@LowLevelTV Dons't forget the uwu type declaration
How do these challenges prevent cheating? Love the videos keep em coming!
these type of challenges are for fun. I don't think people cheat here as they have nothing to gain by cheating
Also input for each person is slightly different so if you don't have the code but only somebody else's answer it's not going to work
@@Romenamath why does it even tell you if it's higher or lower? That isn't particularly useful for debugging in most cases.
Is that there literally only to make brute-force easier and thus bait cheaters?
While not a language per se I want to see SIMD on the wheel.
my struggle for this problem was trying so subtract a int from a usize, i kept doing usize as isize but didnt seem nice to do
Why did you have a isize to begin with? I don't quite see where you'd get the signed value from
@@Romenamath This, or alternatively saturating_sub
This looks like a mess, I dont know maybe it would've been better to look for a solution like trying to work with regex or something related. Think/plan well before writing any code. Theres also special built in functions to parse/trim inputs in Rust you couldve used.
The only regex you can use is "\d+" really, you aren't gonna do the locating the symbols with a regex
Unless you hate yourself
@@ficolas2 I think you can do something like \d|\* for digits and star as an example but I'm not sure. Still I'd look further into it.
@@ollicron7397 but what would you get with that? The problem is that you need to check the Lines at the top and bottom, and diagonally too.
We need Rust 2.0 with added features that will make off by one errors harder to make.
I would love to see Lua❤
Life is too short to learn DSA
I'm doing same thing, pick random language for day, but my list is smaller than yours. Day 3, javascript 😢, I'm literally 15 times slower than with Lua yesterday
I'm solving this year's challanges in Go and boy was today difficult. And it's only day 3. 🤣
Hell yeah, it's Haskell time
Can someone confirm pls - was that was 9 levels of indentation?
You gotta do VOICEs like Prime
Forth. That's the language for the wheel. ;)
this one would be so nice to do with Haskell tho
Like first you want a function `detectSymbols : Arr [m, n] Char -> Arr [m, n] Bool`, as well as `dilate : Arr [m, n] Bool -> Arr [m, n] Bool` which smears every True to the 9 positions around it. Then something like `detectPartNumbers : Arr [m, n] Char -> Arr [m, n] Bool -> Arr [m, n] Bool` which marks as True all digits of numbers which overlap with the patches of True in the input. Then you can replace every symbol marked False with whitespace, run `words : String -> List String` on each line and concatenate all results. Then simply parse all the extracted numbers.
"Length of the digit" was confusing me... surely that's always 1 😉
Writing this in Rust was... fun.
no
@@LowLevelTV I mean, it made me use a 2d coordinates library (wrapping_coords2d). It also made me realize that a proper coordinate library is missing in Rust, so I guess I will write one to be at peace.
Tbh i think you pick the wrong structure for this problem, i just made an integer matrix and in half a hour was done :(
Haskell!
i’m sorry to say but i think your getting haskell 😂 also i made the same mistake when I did it myself lol