Ad
  • Custom User Avatar

    I agree with the previous commentator, I forgot about sets and sorting)).
    I consider this solution to be the most understandable and concise than the solution at the top of the list. The only question regarding the speed of code execution is - what will be faster, sorting or converting to a set?