Reported March 2024
Uber

Generate Arrays

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 Generate Arrays question hit the OA circuit in March 2024 and it's a straightforward array construction problem that catches people off guard because the trick isn't algorithmic, it's about reading the constraint carefully. You're building an array from scratch based on some generation rule, and the gotcha is usually in the edge case handling or in realizing you need to simulate rather than calculate. StealthCoder will have this pattern locked in seconds if you blank on the simulation logic.

Pattern and pitfall

The core of Generate Arrays is simulation. You're not searching or sorting an existing array, you're constructing one according to a specific rule. The pattern usually involves iterating through some range, applying a transformation or condition at each step, and appending to a result array. The common failure is misreading what 'generate' means in the problem statement, overthinking it mathematically when iteration is the answer. The secondary trap is off-by-one errors in loop bounds or in the condition that decides what gets added. The trick is to trace through a small example by hand first, confirm your understanding of the rule, then code it. If you hit a wall during the live OA, StealthCoder will replay the problem and show you the exact simulation flow so you can recover.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Generate Arrays 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 for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Uber reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Generate Arrays FAQ

Is this a math problem or a coding problem?+

It's a coding problem dressed up as math. The rule is mathematical, but the solution is simulation. Read the constraint first. If it says 'generate all X where condition Y', you're iterating and building a list, not deriving a formula.

How do I prepare for this in 24 hours?+

Find a similar LeetCode problem like Combination Sum or Generate Parentheses. Practice the pattern of iterating, checking a condition, and appending. Uber's version will have its own constraint, but the scaffolding is the same. Trace by hand, then code.

What's the most common mistake?+

Misreading the generation rule. Candidates often jump to code without fully understanding what 'generate' means in context. Spend 60 seconds writing out the rule in English. Then code it.

Do I need a specific data structure?+

Usually just a result array and maybe a nested loop or recursion for generating combinations or sequences. No hash tables, no trees. Keep it simple unless the problem explicitly asks for efficiency gains.

Is this problem still asked at Uber?+

Yes, array construction and generation questions are staples. The exact phrasing changes, but simulation-based array building stays on the menu. It's lower-difficulty than graph or DP problems, so it's a good early OA slot.

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