use minheap of size k....pop ele.s from stacks and insert in heap....O(n.logk)
S
samir
@samir
2
Reputation
2
Posts
151
Profile views
0
Followers
0
Following
Posts made by samir

RE: Given n stacks of ints, find the maximum sum of k numbers by popping out any stacks

RE: Sum of Count of Different bits
 Count frequency of odd and even numbers in array
 ANS += even_frequency * odd_frequency
 Divide each number by 2
 Repeat for 32 times(assuming numbers are 32 bit)
Time Complexity : O(n.logn)