In worse cases we push all elements to both heap, so NlogN +NlogN. Not sure why it is mentioned NlogN+klogN. for example, initial capital is so high to cover all projects and k=1.
Hi @EHM I believe you are right.
As I see it its
O(NlogN) for the first iteration adding to the min heap,
O(NlogN) inside the second loop for adding all profits as a worst case if we can afford all +
O(k) for the loop itself.