Ad
  • Custom User Avatar

    How is this marked as best practice? This would take O(n^2). Very bad actually.

  • Custom User Avatar

    I concur. I was looking at this and noticed that it traverses the list of N items twice just to get the odd, even lists.
    Also... I don't think the parseInt map was necessary. Would that be considered another pass to the list? 3N iterations instead of N? Clever that it is only 4 lines of code.... But not very effecient for large N.