You are viewing a single comment's thread. Return to all comments →
Very nice. I like your way more of sorting it first. I would do largest = arrSorted and second_largest = arrSorted. I will use for future scenarios, thanks.
Sorting it first, although elegant, will increase the time complexity. Your original solution is more efficient, don't you think?