• If you're aiming for optimal then it's almost certainly less computationally intensive to precalculate all of the values using addition rather than using Gauss' formula each and every time you need a value.

  • Is that what it's doing? I don't know anything about scala.

    I tried to memoize my Gauss results - it was slower than recalculating every time. The list is pretty short I suppose.

    You don't actually need to run any optimisation for fuel anyway. Median and mean should be within 1 of the right answer for part 1/2 respectively. You just have to check the nearest couple of ints

  • n(n+1)/2 is simpler 😅 I should have remembered the story about gauss being sent out of the classroom until he had summed all of the positive integers to 1000.

    I'm recomputing that recursive for every crab. It passed my tests but clearly loads of scope for optimisation.

About

Avatar for frankenbike @frankenbike started