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.
@CodingGarden Жыл бұрын
Ah! I've never used a lookahead in a regex before...
@tapiwakundishora6195 Жыл бұрын
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?
@ManjaroBlack Жыл бұрын
I used /(one|two…)/g and didn’t need a lookahead.
@kerrykreiter445 Жыл бұрын
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!!!
@jurgentreep Жыл бұрын
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.
@Michael1463410 ай бұрын
did this recently, hard as shit. I'm 17 and just started getting into javascript heavily. Been programming on and off for years.
@ArtistFormallyKnownasMC Жыл бұрын
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. 😊
@sevenstars0711 Жыл бұрын
I wonder why i got a different answer for part 1, and it's correct. Did they change the input file?
@bbbb12281 Жыл бұрын
Everyone get's different input, so you can't just copypaste the answer.
@sevenstars0711 Жыл бұрын
@@bbbb12281ohhh, that's cool, thanks!
@mike-2342 Жыл бұрын
I was not a fan how they added `oneight` etc, just seemed more annoying than it was worth. Especially since they didn't factor it in properly in their test cases. It had an example, but didn't actually use the numbers in the example result.
@dev_kame425 Жыл бұрын
I'm on it since 3 hours. Bro is doing it in 5 minutes OMG I did the second part in the first part...
@paulallies Жыл бұрын
Return of the King! He's Back!
@willzin-da-esfiha Жыл бұрын
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.
@smithshaw1151 Жыл бұрын
Yo, Long time dude! Welcome back! Love your content
@nero3700 Жыл бұрын
Glad to see you back CJ! Does this mean we will be getting daily video's for the next 25 days? 😇
@7edim Жыл бұрын
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
@barunshrestha942510 ай бұрын
same here what did you do to remove the error is was it even an error?
@ArtistFormallyKnownasMC Жыл бұрын
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. 😊
@CodingGarden Жыл бұрын
We raided Mel (juiceboxhero)! www.twitch.tv/juiceboxhero
@ArtistFormallyKnownasMC Жыл бұрын
@@CodingGardenthank you so much!! 😊
@nomorelivin Жыл бұрын
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' ]
@joynalmiah549 Жыл бұрын
When you split it with just add a like this worked for me
@cornshed Жыл бұрын
Replace wouldn't work anyway
@CodingGarden Жыл бұрын
Yeah, I'm see from others that things like "twone" and "eightwo" make it tricky to just replace.
@martijnkunstman9971 Жыл бұрын
@@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
@martijnkunstman9971 Жыл бұрын
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");
@juanmacias5922 Жыл бұрын
@@martijnkunstman9971lmfao you kind of just made my day hahaha
@JonCurls Жыл бұрын
@@martijnkunstman9971 praise!
@Operaatoors Жыл бұрын
I actually tried to replace all words with numbers and do the same as first part, but still fail :( On PHP with strtr
@Operaatoors Жыл бұрын
basically strtr (replacing words with numbers would never work), because of eightwo :) PS, creators most likely knew that!
@StephenSheridanOnline Жыл бұрын
It was painful to watch you make life so difficult for yourself. But fair play for sticking with it!!
@sebastienrodrigues8509 Жыл бұрын
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
@joseisraeldiazzapata5179 Жыл бұрын
Where were you Cj? u.u
@ArtistFormallyKnownasMC Жыл бұрын
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!!
@CodingGarden Жыл бұрын
You can hear me chat about it in the livestream VOD here: kzbin.info/www/bejne/javWiX-pdpWkbrM