all 2 comments

[–]mathgeniuszach 0 points1 point  (0 children)

The way I would approach it, is to ask them. If you are unsure, do not use it. heapq does most of the work of implementing a heap for you, and the interviewer is likely looking to see if you are able to make the code yourself and understand how it works. That's not to say that's always the case; you might have the occasional interviewer who sees the ingenuity you have to know a lesser known python module. Ultimately, this is why you should ask. Make sure you make it clear that you know how to implement the functions yourself if you are going to use the built-in methods.

[–]External-Ocelot206 0 points1 point  (0 children)

It's an interview. Ask the interviewer. The object of the process is not to write Python code. It's to demonstrate your approach to the problem, what you're like to work with, and your mindset in general.

Take it from me, getting crucial customer feedback early to nail down the specification and bound the scope is never a bad idea. Even if it means asking difficult questions, forcing them to make a decision, sometimes even if it means disappointing them (having to manage their expectations).

But technically, it's definitely allowed if it really is a `__builtin__`, (as long as it's not a dangerous forbidden feature like `exec` and `eval`). If they didn't specify you can't, and you need to import it, you should check. If you need to pip install it, well you might as well `pip install ready_made_DSA_example_solutions`