Day 1
Happy Advent!
AoC has begun!!! A nice start to the month :)
Taking in the input and splitting it into a list of one string per item. Part 1 was a simple matter of seeing how many numbs in the list are greater than the number immediately before it. I created a simple list comprehension to go through each index (start from 1, as index 0 is N/A) and comparing the int-casted form of string to the previous one in the list. Unfortunately, a dumb typo of putting the -1 after the brackets cost me a minute, and a place on the global leaderboard!
Part 2 could then be coded in a few minutes normally - but the trick here to doing it fast was to (not only understand the problem fast) recognise the fact that if a running total is involved, two numbers are common and hence shared between the windows. Take, for example, 0,1,2,3,4
Window A = 0+1+2 (3)
Window B = 1+2+3(6)
Clearly, both share a 1 and 2, hence we can ignore that during our comparison. Using some basic maths, we can see that the difference is:
Window B - Window A = (1+2+3) - (0+1+2)
= 1+2+3-0-1-2
= 3-0
= 3
Quickly generalising this, we see that all we need to do is compare every number to the number 3 indexes before it as there is no need to take into account the middle two shared numbers. Finding this pattern in a matter of seconds is how the leaderboard programmers managed it! Ultimately, this meant that all I had to do to change my code from pat 1 was to change the starting index to begin from Window B, or index 3 (allowing me to compare said number to the number 3 indexes before it), and change the comparison to -3 instead of -1.
Now.... that was a nice warm up - still 24 days/48 stars to go!
[and lots of sleep deprivation]