I started out with isize because I just knew that the second half would add negative numbers somehow. Then it didn't. :/
I got part 1 done rather quickly comparatively. I then spent far to long arguing with the rust compiler over lifetimes of slices and the ability to sum on borrowed vs. non-borrowed values.
Ultimately I moved into using a more C-style for-loop driven solution, where we walk down the entry vector until we're too big, and then step down to the next item.
Didn't get the elegant interator-driven solution, but meh - a win's a win. :)
+1 Rust solution.
I started out with isize because I just knew that the second half would add negative numbers somehow. Then it didn't. :/
I got part 1 done rather quickly comparatively. I then spent far to long arguing with the rust compiler over lifetimes of slices and the ability to sum on borrowed vs. non-borrowed values.
Ultimately I moved into using a more C-style for-loop driven solution, where we walk down the entry vector until we're too big, and then step down to the next item.
Didn't get the elegant interator-driven solution, but meh - a win's a win. :)
As always, on Github.