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
🥝🥝
More Wayfair interview questions
- UCB1 Multi-Armed Bandit TraceONSITE INTERVIEW · Seen Sep 2026
- Container With Most WaterPHONE SCREEN · Seen Sep 2026
- Assign Distinct Letter Values to Minimize XORPHONE SCREEN · Seen Sep 2026
- Moving Cost by Volume and CategoryONSITE INTERVIEW · Seen Sep 2026
- Number of Divisible Substrings (For MLE)OA · Seen Sep 2024
- Smash The Bricks(NG)OA · Seen Apr 2024
- Validating Magical Binary Strings with RegEx (NG)OA · Seen Apr 2024
- First Three Badge Times per UserPHONE SCREEN · Seen Apr 2022
- Time of Maximum Mall OccupancyPHONE SCREEN · Seen Apr 2022
- Longest Common Contiguous User ActionsPHONE SCREEN · Seen Apr 2022
Similar questions at other companies
- Generate Balanced ParenthesesInMobi · OAInMobi interview questions
- DFS Subsequences of a String (For MLE)CoinDCX · PHONE SCREEN
- Expression Add OperatorsPinterest · PHONE SCREENPinterest interview questions
- Permutations of Unique CharactersSalesforce · PHONE SCREENSalesforce interview questions
- Phone Keypad Letter CombinationsGoogle · ONSITE INTERVIEWGoogle interview questions
- Permutations of Character PositionsPeopleStrong · ONSITE INTERVIEWPeopleStrong interview questions
- All Rearrangements of a StringAdobe · PHONE SCREENAdobe interview questions
- Valid PalindromeThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions
- Work ScheduleSnowflake · OASnowflake interview questions
- Work Schedules (for MTS2)Nutanix · OANutanix interview questions