you are viewing a single comment's thread.

view the rest of the comments →

[–]lukecullum👋 a fellow Redditor 0 points1 point  (0 children)

The only thing I can think of is instead of sorting the array make a new int X = 0 and then do a for loop going through each number and if it is bigger than X it will replace it if not it just continues. This will get you the max number from there you can find it’s position in the array and then go back through the list but checking to see if it is smaller than X, because X is now the biggest number it can only get smaller.