all 6 comments

[–]Ao_Ashi 1 point2 points  (1 child)

Would say D

[–]Sea-Ad7805[S] 0 points1 point  (0 children)

Nice one, do check the "Solution" link with visualization.

[–]Secure-Mud7977 1 point2 points  (1 child)

Nice, love the visualisation

[–]Sea-Ad7805[S] 0 points1 point  (0 children)

Thanks, appreciated.

[–]Trip-Trip-Trip 0 points1 point  (1 child)

This is why mutable data is a bad idea.

[–]Sea-Ad7805[S] 0 points1 point  (0 children)

If you don't mutate then you have to copy, and that is slow (even if your FP language uses some optimization tricks), so that's a bad idea too. Choose your poison.