Pregunta de entrevista de ENSO

Write a function to return a list of all subsequences of a string in sorted order, excluding the empty string.

Respuesta de la entrevista

Anónimo

9 nov 2016

from itertools import combinations def build_subsequences(s): return sorted(''.join(ss) for i in range(1, len(s)+1) for ss in combinations(s, i))