DEV Community

Discussion on: Interview Qs Decoded - # 1

Collapse
 
lifelongthinker profile image
Sebastian

Depends on the implementation. I was biased to think of LINQ (C#).

If the object returned by 'sortDescending' contains less than two items, the index approach will throw an exception.