3 ms·
This is a classic heap problem. However, Python doesn’t have a proper collections library, so to solve it I would try to import a specialized module like heapq,
by kafkaesq 10y ago
This is a classic heap problem. However, Python doesn’t have a proper collections library, so to solve it I would try to import a specialized module like heapq, which usually wasn’t included in the interview environments.
This is an odd thing to say - heapq has been part of the standard library since 2.3. The fact that it isn't part of collections... just doesn't mean very much.
With a few exceptions, Python was clearly frowned upon. Of course, no one ever explicitly told me I couldn’t use Python to solve a problem. The coding environments always had a Python interpreter, but the interviewers would usually suggest that I use “a compiled language” (read: Java)
Well, actually they were explicitly telling him, right there. But if their interviewing teams would let a candidate go on and code in the "wrong" language (obviously a huge waste of both the candidate's time and theirs)... then they have much worse problems than any of us are likely to be able to help them with.
- asphyxiac 10y agoThere's probably an entirely different discussion that can be had about interviewing techniques for data science positions.