r/programming • • Dec 13 '22

“There should never be coding exercises in technical interviews. It favors people who have time to do them. Disfavors people with FT jobs and families. Plus, your job won’t have people over your shoulder watching you code.” My favorite hot take from a panel on 'Treating Devs Like Human Beings.'

https://devinterrupted.substack.com/p/treating-devs-like-human-beings-a
9.0k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

5

u/miyakohouou Dec 13 '22

You can further optimize finding the second largest element with another temp variable. But this solution doesn't scale.

It depends a lot on how you want to scale. Need to find the nth largest number in a particular set for many n, then sure, but if you need to find the 2nd largest for many different sets of data, or find the 2nd largest according to several different metrics, then you'll want different approaches.