Problem · String
DFS Subsequences of a String (For MLE)
Learn this problemProblem statement
A DFS problem involving subsequences of a string. Given an input String, return a list containing every possible substring, with the requirement that they are sorted alphabetically. For example, given the input "abc", return ["a", "b", "c", "ab", "bc", "ac", "abc"].
Function
generateAllSubsequences(s: String) → List<String>Examples
Example 1
s = "abc"return = ["a", "ab", "abc", "ac", "b", "bc", "c"]The function should return all possible subsequences of the input string "abc" sorted alphabetically, which are: ["a", "ab", "abc", "ac", "b", "bc", "c"].
Constraints
🥝🥝