Ad
  • Custom User Avatar

    I don't want to change the original array, so I made a clone of it. Just in case, as it could be in real life, when you can't change the arr which is given to you. I did it for my self. In this situation, it's not necassary.
    And this is not clever solution :) I mean my algorithm.

  • Custom User Avatar

    What was the point oc cloning the original array. Could you not just have sorted it, and used it the way it is.