Reported March 2024
Uberbacktracking

Output All Possible Strings

Reported by candidates from Uber's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Uber OA. Under 2s to a working solution.
Founder's read

Uber's 'Output All Possible Strings' problem hits candidates without much warning. You're being asked to generate or enumerate a set of strings based on some constraint or input format that the OA doesn't always spell out cleanly. The trap is thinking too hard about the exact rules instead of recognizing this as a backtracking or recursive enumeration task. StealthCoder will read the exact wording on screen and show you the pattern in seconds if you freeze up during the live OA.

Pattern and pitfall

This is a backtracking or recursive generation problem. The core move is building strings incrementally, exploring all valid branches, and pruning invalid ones. Most candidates either over-engineer by trying to pre-filter, or under-think and miss edge cases like duplicates or ordering. The pattern lives in depth-first-search with memoization or a recursive helper that explores each decision point. Common mistakes: forgetting to backtrack properly, not handling empty strings or base cases, duplicating results. StealthCoder is your safety net if the exact constraints get fuzzy mid-OA and you need a quick reminder of the skeleton.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Output All Possible Strings cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as letter case permutation. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Uber's OA.

Uber reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Output All Possible Strings FAQ

Is this a backtracking problem or just string concatenation?+

It's backtracking. You're exploring all valid combinations or permutations of strings. If the OA says 'output all' or 'generate all', you're recursing and exploring branches, not looping linearly. Backtracking lets you undo choices and explore alternatives.

How do I avoid duplicate strings in the result?+

Track what you've already generated using a set, or sort and skip duplicates during recursion. If input has duplicates, sort first, then skip adjacent identical characters in the recursive call to avoid branching twice from the same state.

What's the time complexity I should expect?+

Worst case is exponential: O(2^n) or O(n!) depending on the constraint. Uber expects you to recognize this is inherently explosive. Don't apologize for it. Make sure your solution is clean and correct, not micro-optimized for speed.

Should I use DFS, BFS, or recursion?+

Recursion (DFS) is cleaner for string generation. BFS works but you'd queue partial strings and build iteratively, which is messier. DFS with backtracking is the standard move for 'output all' problems.

How do I prepare in 48 hours if I haven't seen this exact problem?+

Practice letter-case permutation and generate-parentheses style problems. Nail your recursive template: base case, loop over choices, recurse, backtrack. Uber cares more about clean code structure than optimal pruning. Know your template cold.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Uber.

OA at Uber?
Invisible during screen share
Get it