Sort by

recency

|

47 Discussions

|

  • + 0 comments

    Python oneliners:

    from itertools import combinations
    def solve(s):
        return sorted(''.join(x) for r in range(1,1+len(s)) for x in combinations(s,r))
    

    Or for the fun to use accumulate instead of range(len()):

    from itertools import combinations, accumulate
    def solve(s):
        return sorted(''.join(x) for r in accumulate(s) for x in combinations(s,len(r)))
    
  • + 0 comments

    Can it will be helpful Trusted Commercial Glass Repair Professionals for my business?

  • + 0 comments

    And what does it mean to be a contractor? Well, contracting is one of the most popular forms of self-employment. In the absence of an official Concetti Contracting definition, a contractor is widely regarded as a one-person business who provides services to clients via their own limited company on a temporary basis.

  • + 0 comments

    Python Solution, I'm using a recursive method here

    def generateSubsets(s):
        if not s:
            return ['']
        subsets = generateSubsets(s[1:])
        return subsets + [s[0] + subset for subset in subsets]
    
    
    def solve(s):
        pl = generateSubsets(s)
        pl.sort()
        pl.pop(0)
        return pl
    
  • + 0 comments

    My Python code that passed all the test cases:

    from itertools import combinations
    def solve(s):
        n = len(s)
        combs = []
        for i in range (1, n+1):
            # find all combinations of size 'i' from 's'
            temp = combinations(s, i)    
            # add those combinations to the list 'combs'
            combs += [''.join(e) for e in temp]
        combs.sort()
        return combs