DFS Subsequences of a String (For MLE)
Updated
Problem 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
🥝🥝
Source note: Author-written prompt excerpt retained for source fidelity.
More CoinDCX Phone Screen questions
Similar questions at other companies
- Expression Add OperatorsPinterest · PHONE SCREENPinterest interview questions
- Permutations of Unique CharactersSalesforce · PHONE SCREENSalesforce interview questions
- All Rearrangements of a StringAdobe · PHONE SCREENAdobe interview questions
- DFS Subsequences of a String (For MLE)Wayfair · OAWayfair interview questions
- Phone Keypad Letter CombinationsGoogle · ONSITE INTERVIEWGoogle interview questions
- Permutations of Character PositionsPeopleStrong · ONSITE INTERVIEWPeopleStrong interview questions
- Generate Balanced ParenthesesInMobi · OAInMobi interview questions
- Enumerate Weekly Work SchedulesAgoda · PHONE SCREENAgoda interview questions
- Valid PalindromeThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions
- Generate Wildcard Binary StringsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions