Ad
  • Default User Avatar

    That would work. However, it is a solution inefficient in terms of memory, as you are creating another list having the same size of the original.
    There are better ways, as seen in other people's solutions.