zltzlt 发表于 2020-2-28 18:14:35

ArmandXiao 发表于 2020-2-28 16:50
抱歉 我的 的确是9种

{:10_312:}

kinkon 发表于 2020-2-28 22:35:48

TJBEST 发表于 2020-2-25 15:48
先写一个可能会超时的,递归的,后面再想想别的方法优化

这个算法真牛掰,不但不超时,还是秒级别的

zp121 发表于 2020-3-1 12:16:37

强,强

776667 发表于 2021-5-21 11:46:51

from itertools import combinations

def fun337(x):
    result = list(set( + ))
    for i in range(2,len(x)):
      for j in combinations(x,i):
            n = ''.join()
            if n not in result:
                result.append(n)
    return len(result)
页: 1 2 3 [4]
查看完整版本: Python:每日一题 337