class Solution:
    def connectSticks(self, A: List[int]) -> int:
        """
        main idea: to minimize cost ==> to connect smallest stick  pair as possible => PQ? 
        tc O(NlgN) sc O(N)
        """
        n = len(A)
        if n <2:
            return 0
        heapify(A)
        res = 0
        while len(A)>1:
            x = heappop(A)
            y = heappop(A)
            cost = x + y
            res += cost 
            heappush(A,cost)
        return res 

TODO