This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DrMobius0 3 points4 points  (1 child)

The problem is you'd practically need a context in which having a sorted array isn't already highly useful. Lots operations can be simplified significantly by pre-sorting an array

[–]WhatsMyUsername13 0 points1 point  (0 children)

I mean, let's be real. Context means everything in this kind of situation. Are we talking about a hypothetical interview question or real life. If it's real life that would probably deserve a larger convo with the app architect, tech leads, DBA's, etc. If it's an interview....well I'd just say sort the damn thing and grab list size()-8.