Untitled

 avatar
unknown
plain_text
5 months ago
449 B
2
Indexable
class Solution:
    # @param A : list of integers
    # @param B : list of integers
    # @return a list of integers
    def solve(self, A, B):
        m = 32
        p = [0] * m
        n = len(A)
        for i in range(m):
            c1=0
            for k in A:
                if(k>>i) & 1:
                    c1 += 1
            c2 = n-c1
            p[i] = c1*c2
        r = []
        for i in B:
            r.append(p[i])
        return r
Editor is loading...
Leave a Comment