Subsets
A medium-tier problem at 81% community acceptance, tagged with Array, Backtracking, Bit Manipulation. Reported in interviews at Coupang and 20 others.
Subsets is the canonical backtracking problem you'll see at Meta, Amazon, Microsoft, and a dozen other shops. It's marked medium but the acceptance rate sits near 81 percent because most candidates nail the pattern once they see it. The trap isn't the algorithm; it's overthinking whether to use recursion, iteration, or bit manipulation when all three work. If you hit this live and blank on the generation strategy, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Subsets"
Subsets is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.
Get StealthCoderThe problem asks you to generate all 2^n subsets of a given array. The backtracking approach builds subsets by deciding include/exclude for each element, recursing on the remainder. The iterative approach starts with an empty subset and doubles the count each time you add a new element. The bit manipulation approach maps each integer from 0 to 2^n - 1 to a subset using bit flags. Most engineers default to backtracking because it's intuitive, but iteration is cleaner and avoids stack overhead. The common mistake is forgetting to copy the current subset before adding it to the result; passing references will corrupt your answer. Understand the three approaches well enough to explain one in 90 seconds during the assessment. StealthCoder is your hedge if the problem lands and you freeze on the generation logic.
Pattern tags
You know the problem.
Make sure you actually pass it.
Subsets recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Subsets interview FAQ
Is this actually asked at FAANG?+
Yes. Ten companies in the top tier have reportedly asked it: Meta, Amazon, Microsoft, Uber, TikTok, Bloomberg, Mastercard, Wix, Fiverr, and Coupang. It's a staple warm-up or medium-difficulty round problem. Expect it if you interview at scale.
What's the trick I'm missing if I can't solve it?+
There's no buried trick. The pattern is straightforward: either recurse by including/excluding each element, or iterate by expanding your subset list one element at a time. If you're stuck, you're overthinking. Write out a 3-element example by hand first.
How does backtracking relate to the other approaches?+
Backtracking is recursive depth-first exploration. Iteration builds subsets level by level. Bit manipulation uses integers as masks. All three generate 2^n subsets correctly. Backtracking is easiest to understand; iteration is most efficient; bit manipulation is clever but not faster. Pick the one you're most confident explaining.
Do I need to handle duplicates or is the array always unique?+
Input data is not specified. Assume unique elements unless told otherwise. If duplicates appear, sort first and skip repeated elements at each recursion level. The core pattern stays the same; you just add a deduplication guard.
What time and space complexity should I cite?+
Time is O(n * 2^n) because you generate 2^n subsets and copy each one, which takes O(n) on average. Space is O(n * 2^n) for the output, or O(n) for recursion depth if you don't count the result. Mention both to show you understand the trade-off.
Want the actual problem statement? View "Subsets" on LeetCode →