Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
I think the Java solution has an error. For the two heap insertion for-loop, the...

Will

May 15, 2022

I think the Java solution has an error. For the two heap insertion for-loop, the index 'i' is offered into the heap, instead of the actual interval[i]. This would mean other parts of the code need refactoring too, as it leverages this index-based heap.

Maybe storing the index in the Interval class might be better (as a member variable, e.g. Interval.index).

1

0

Comments
Comments

On this page