I like that solution the best, indeed. Could be more performant if you did split the full string only once and then clear the dict in each iteration. Might then even beat my way, I guess.
ALSO: How did you markup that Spoiler text? We should all learn to use that.
My Day 6 solution is the first one that’s not too ugly to post:
Spoiler
'Day06 Parts 1 & 2
dim inTxt As String = tf1.Text 'Read all of the data into string inTxt
dim bufLen As Integer = 14 '(4 for part 1, 14 for part 2)
dim bfr As String = left(inTxt,bufLen)
dim nchr As Integer = 1
dim bTest As Boolean
do
bfr = mid(inTxt,nchr, bufLen)
nchr=nchr+1
bTest=True
for i as Integer = 1 to bufLen-1
for j as Integer = i+1 to bufLen
bTest = bTest and mid(bfr,i,1)<>mid(bfr,j,1)
next
next
loop until bTest or (nchr > len(inTxt)-bufLen)
MsgBox "The answer is: "+str(nchr+bufLen-2)
I haven’t compared mine to the others yet. So maybe it’s the same as someone else’s. It was fast enough to give an instant answer, which is all that’s needed for these puzzles. I have to get out of the mindset that efficiency matters, unless they start coming up with puzzles that really need it.
I am using Chrome and it doesn’t like to follow http content from https pages, as the forum is https, when I try to click your http link, it looks like it is not working because nothing happens.
Okay. Building file system trees and determining the directory sizes is what I’ve written many times before (-> Find Any File). Though I made some stupid mistakes in the second part (stayed up all night again), I am glad I finished first regardless (anything else would’ve been quite embarrassing). Still, I’d not be surprised if someone else later gets a better turnaround time.
And now I’m too restless (agitated?) to go to bed. Good thing there’s beer in the house Cheers!
I almost gave up on the Day 7 puzzle, but I guess I’m just too stubborn.
I had an elusive circular reference bug in my node tree that kept causing a stack overflow exception. It took forever to figure that out. Then when I finally got it working with the example data, it broke again with the real data. Finally sorted that one out (a node not being added in some cases when it should have been).
By then my brain was so fried that the relatively simple part 2 took me way longer than it should have.
Oh well, it’s done. I’m afraid to think about what’s coming next.
We are getting to more complicated or involved puzzles now, and I’m not one of those people who can do them that quickly. I’m still concerned (somewhat) about code quality rather than just solving the puzzle.
What I’m trying to say is, if I look at the puzzle tonight (or upcoming) and decide it will take too long, I’ll put it off. I don’t mind staying up until 1 am (that’s actually rather normal) or even all night if the situation warrants, but these puzzles don’t rise to that level of urgency.
The ones that get it done so fast are probaply playing with GPT-3 or ChatGPT. You can find them mentioned on Twitter and Mastodon. It’s a curious thing, but so far there’s no official way to tag them.
My day-night schedule also gets f**ked up by this competition. Couldn’t get to ned until 9 in the morning, got up at 4 in the afternoon. I’ll probably stop that. I just wish the leaderboard would record the start time, then it would be much easier for all of us to compete at our own time. I requested with the organizers that but didn’t get any reaction.
Spoiler
Also: I’m amused that almost everyone took an unexpected long time for part 2, just like me. I first had trouble getting the code right to calculate the limit that needs to be found, and only later realized that the recursive size finding function had to be changed from finding the lower values into finding the higher ones. I made the mistake of duplicating the function, rename it and change its compare operators. But I then got the wrong dirs out of it. Took me a while to realize that the recursion still called the old function, not itself. So, duplicating and renaming wasn’t smart here - adding a parameter for lower/higher would’ve been safer because then the compiler would have told me that the recursive call is missing an argument. Sloppy work on my part