Back to problems

Generate Lexicographically Sorted String Subsets

Algorithm · Microsoft · Medium

All Subsequences in Lexicographical Order Medium · Topics · Company Tags · Hints You are given a string s that consists of distinct characters. From s you can form a subsequence by deleting zero or more characters while preserving the order of those that remain. Your task is to generate every possible subsequence—including the one with no characters at all (the empty subsequence). After generating all subsequences, sort them in lexicographical order (standard dictionary…

Checking your access…