First time Im doing the AoC. I thougt it was easy to just replace the words to numbers, but there are overlapping ones (such as 'twone' and 'eightwo'), so that made it a bit trickier than expected). Thanks to that now I do know a bit more of how to use lookahead in regex.
This is so helpful. I’m very grateful to watch in real time your thought process on solving these challenges. Your expertise is obvious and sharing it with us is very much appreciated! You are like a skilled surgeon looking for the exact right scalpel to use. So insightful and rewarding. Thank you!!!
It was sooooo good being on a live and getting to “see” everyone. What a pleasant holiday surprise!! I was still working on my Network+ TestOut course, so I got bumped to two other streams after. Haha I remembered to follow one for them. 😊
I’m impressed at how much complexity you can handle. Once my ternary expression goes 2 deep I’m out haha. I ended up finding all occurrences in the string and creating a tuple with index and the digit. Then just sort the array and pick the first and last and combine them.
I generated an array of tuples with the number and the position that it appears, both full writen numbers and algarisms. Then sorted it and grabbed the first and last positions. To improve the memory handling I load one line per time in memory and perform the operations. It was hard man. I took about 2 hours to finish this one.
Yo, Long time dude! Welcome back! Love your content
9 месяцев назад+2
I did it with regex and my example data is getting parsed correctly but the full dataset isn't correct. So yeah feel like I'm gonna spend hours on the first day since I have some stupid error. xD
For someone who was there, could you tell me who we raided on Twitch so I can give them a follow? I was busy working and forgot. Then I got bumped to a second stream. 😊
IDK why my array is returning like this like having an extra '/r' ...so that's why my values can't be read from end [ '1abc2 ', '# pqr3stu8vwx ', '# a1b2c3d4e5f ', '# treb7uchet' ]
Your solution is so hard. Try. Replace « one » by « o1e » « two » by « t2w » … « seven » « s7n » … Next replace \D by empty string Take first take last 2azrwone> 2azt2o1e> 221> 21 That’s all
@@CodingGarden just do this: d = d.replaceAll("one", "o1e"); d = d.replaceAll("two", "t2o"); d = d.replaceAll("three", "t3e"); d = d.replaceAll("four", "f4r"); d = d.replaceAll("five", "f5e"); d = d.replaceAll("six", "s6x"); d = d.replaceAll("seven", "s7n"); d = d.replaceAll("eight", "e8t"); d = d.replaceAll("nine", "n9e"); that works
d = d.replaceAll("one", "o1e"); d = d.replaceAll("two", "t2o"); d = d.replaceAll("three", "t3e"); d = d.replaceAll("four", "f4r"); d = d.replaceAll("five", "f5e"); d = d.replaceAll("six", "s6x"); d = d.replaceAll("seven", "s7n"); d = d.replaceAll("eight", "e8t"); d = d.replaceAll("nine", "n9e");
He said during the live all was well, just busy with some things. Other than some 😢 family news that his wife had gotten laid off. The Twitch notification made my jaw drop and I opened it so fast hoping it was real!!
First time Im doing the AoC. I thougt it was easy to just replace the words to numbers, but there are overlapping ones (such as 'twone' and 'eightwo'), so that made it a bit trickier than expected). Thanks to that now I do know a bit more of how to use lookahead in regex.
Ah! I've never used a lookahead in a regex before...
I ran into that issue too! i ended up abandoning regex lol. What did you end up doing? if you used regex what was your expression?
I used /(one|two…)/g and didn’t need a lookahead.
This is so helpful. I’m very grateful to watch in real time your thought process on solving these challenges. Your expertise is obvious and sharing it with us is very much appreciated! You are like a skilled surgeon looking for the exact right scalpel to use. So insightful and rewarding. Thank you!!!
did this recently, hard as shit. I'm 17 and just started getting into javascript heavily. Been programming on and off for years.
It was sooooo good being on a live and getting to “see” everyone. What a pleasant holiday surprise!! I was still working on my Network+ TestOut course, so I got bumped to two other streams after. Haha I remembered to follow one for them. 😊
I’m impressed at how much complexity you can handle. Once my ternary expression goes 2 deep I’m out haha.
I ended up finding all occurrences in the string and creating a tuple with index and the digit. Then just sort the array and pick the first and last and combine them.
Glad to see you back CJ! Does this mean we will be getting daily video's for the next 25 days? 😇
I'm on it since 3 hours. Bro is doing it in 5 minutes
OMG I did the second part in the first part...
Return of the King! He's Back!
I generated an array of tuples with the number and the position that it appears, both full writen numbers and algarisms. Then sorted it and grabbed the first and last positions.
To improve the memory handling I load one line per time in memory and perform the operations.
It was hard man. I took about 2 hours to finish this one.
Yo, Long time dude! Welcome back! Love your content
I did it with regex and my example data is getting parsed correctly but the full dataset isn't correct. So yeah feel like I'm gonna spend hours on the first day since I have some stupid error. xD
same here what did you do to remove the error is was it even an error?
I wonder why i got a different answer for part 1, and it's correct. Did they change the input file?
Everyone get's different input, so you can't just copypaste the answer.
@@bbbb12281ohhh, that's cool, thanks!
For someone who was there, could you tell me who we raided on Twitch so I can give them a follow? I was busy working and forgot. Then I got bumped to a second stream. 😊
We raided Mel (juiceboxhero)! www.twitch.tv/juiceboxhero
@@CodingGardenthank you so much!! 😊
It was painful to watch you make life so difficult for yourself. But fair play for sticking with it!!
IDK why my array is returning like this like having an extra '/r' ...so that's why my values can't be read from end
[ '1abc2
', '# pqr3stu8vwx
', '# a1b2c3d4e5f
', '# treb7uchet' ]
When you split it with
just add a
like this
worked for me
Your solution is so hard.
Try. Replace « one » by « o1e » « two » by « t2w » … « seven » « s7n » …
Next replace \D by empty string
Take first take last
2azrwone> 2azt2o1e> 221> 21
That’s all
I actually tried to replace all words with numbers and do the same as first part, but still fail :( On PHP with strtr
basically strtr (replacing words with numbers would never work), because of eightwo :) PS, creators most likely knew that!
Replace wouldn't work anyway
Yeah, I'm see from others that things like "twone" and "eightwo" make it tricky to just replace.
@@CodingGarden
just do this:
d = d.replaceAll("one", "o1e");
d = d.replaceAll("two", "t2o");
d = d.replaceAll("three", "t3e");
d = d.replaceAll("four", "f4r");
d = d.replaceAll("five", "f5e");
d = d.replaceAll("six", "s6x");
d = d.replaceAll("seven", "s7n");
d = d.replaceAll("eight", "e8t");
d = d.replaceAll("nine", "n9e");
that works
d = d.replaceAll("one", "o1e");
d = d.replaceAll("two", "t2o");
d = d.replaceAll("three", "t3e");
d = d.replaceAll("four", "f4r");
d = d.replaceAll("five", "f5e");
d = d.replaceAll("six", "s6x");
d = d.replaceAll("seven", "s7n");
d = d.replaceAll("eight", "e8t");
d = d.replaceAll("nine", "n9e");
@@martijnkunstman9971lmfao you kind of just made my day hahaha
@@martijnkunstman9971 praise!
Where were you Cj? u.u
He said during the live all was well, just busy with some things. Other than some 😢 family news that his wife had gotten laid off.
The Twitch notification made my jaw drop and I opened it so fast hoping it was real!!
You can hear me chat about it in the livestream VOD here: ruclips.net/video/WzsXLsA0q8Q/видео.html