I am facing problem on time complexity of this problem. 3 images of 3 different solutions has been attached :
-
maxHeap O(NlogK) - 0.85 seconds
-
minHeap (seems to be O(KlogN) ) - TLE.
-
sorting O(NlogN) - 0.67 seconds
Execution Time taken is just opposite to what expected. Minimum time complexity have TLE and Maximum Time Complexity have minimum(0.67secs) time taken.
What is going on here??? Please explain
P.S : I have tried the same question on gfg, hackerearth and leetcode with all three approaches and in every platform I got similar response (All 3 solutions got accepted but have different execution times). So, I think there is no doubt on test cases.