Hi, everyone! I’ve started my own blog;)

good_news_everyone

It’s first post about banal old exercise, given a string, generate all permutations of it Here’s solution on java

public static Stream<List<String>> permute(List<String> input) {
        if (input.size() == 1) {
            return Stream.of(input);
        } else {
            return input.stream().flatMap(el ->
                    permute(input.stream().filter(j -> j != el).collect(toList()))
                            .peek(l -> l.add(0, el)));
        }
    }