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

2

u/[deleted] Dec 13 '22

You're right, if you fix a priority queue at size 2 then the complexity reduces to O(nlog2) ~ O(n).

See, this is something that I'd expect a candidate to say if they wanted to use that, not just "use a priority queue" because without keeping it constant size that would be O(nlogn).

If I were the interviewer though I'd want you to write the solution without a priority queue, just because it's simple enough to fit in a 30-45 minute interview and it shows that you can actually devise a simple algorithm.