Just did this problem, and while I had little issue solving it I can’t help but think this solution is very, well, clunky.

Given a set of number does anyone have the computationally fastest way to solve it? Or would it just be a coders choice of which sort algorithm to use?

I feel like this could be done recursively but I’m garbage at recursive and don’t know.

To any code gods could get back to me that would be Great!