Space complexity review

If I use heapify() on the input array (ropeLengths) instead of having a separate minHeap array, can the space complexity become O(1) since heapify() works in-place?

1 Like

it depends on if you are allowed to modify the input list since in the end your heap will be empty.

1 Like

That’s clever. :slight_smile: