educative.io

Binary Level Order Traversal JS Solution

The solution for this problem and problems in merge intervals, use a library that has queue and heap data structures. During an interview what am I supposed to do? For sure I would not be able to use the library on a coding assessment/codesignal type interview. Please suggest an alternative

Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5726607939469312

Hi @Varun_Chillara

During technical interviews, it is usually the approach to solve a problem that matters, not a fully working solution. It is always good to write a fully working solution, but if you are restricted from using any library, you can demonstrate the approach you are trying.
For this case, the queue class is included, which is very simple in its implementation. If you have time, you can write your own queue class with basic enqueue() and dequeue() functionality and then use it in your solution.

@Usman_Younas Thanks for the reply. Can I use/Is it efficient to use an array and use the queue relevant methods, like shift and unshift on the array? Would that affect time and space complexity?