You take more time on explanation rather than code that is nice but could you add time and space complexity in it evenif it is easy to understand. And thanks
@TheCodeThoughtsАй бұрын
Thanks for your valuable suggestions, yes I do agree I will take care of these things here onwards, I know for candidates having beginner phase needs explanation thoroughly. By the way the space complexity is O(n) , because we are creating a Max heap of size n, same as nums size. And Time Complexity is O(k log n). Because we are doing k-times pop operation from Max heap so its O( k Log n).