Challenge me, only one line except sort() line


  • 0
    M
    class Solution:
        # @param S, a list of integer
        # @return a list of lists of integer
        def subsets(self, S):
            S.sort()
            return [[S[j] for j in range(len(S)) if i & (1 << j)] for i in range(2**len(S))]

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.