Average or Zero
Reported by candidates from Waymo's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Waymo OA reported in July 2026 has a question called Average or Zero, and it's about as gentle as these get. Brute force isn't even a concept here, because one pass over the array is the whole job. The input size never forces a clever trick. The trap is the empty array, where dividing by zero blows up your answer. If you've got an invite and you're bracing for something nasty, breathe. Know the edge case, write it cleanly, and move on. StealthCoder sits as a quiet safety net during the live OA if your mind goes blank on even an easy one.
The problem
Given a numeric array table, return its arithmetic mean. The arithmetic mean is the sum of all values divided by the number of values. If table is empty, return 0. Function average(table: double[]) → double Examples Example 1 table = [2,4,6,8] return = 5.0 The values sum to 20. Dividing by the 4 values gives 5. Example 2 table = [] return = 0.0 The input is empty, so the required result is 0. Example 3 table = [-1.5,2.5,5] return = 2.0 The values sum to 6. Dividing by the 3 values gives 2.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The pattern is plain array traversal. Add up every value, divide by the count, and return the result as a double. There's no sorting, no hashing, no nested loop. Time is O(n) and space is O(1). The one pitfall is the empty table. Check the length first and return 0.0 before you divide, otherwise you get NaN or a runtime error depending on the language. Second pitfall is integer division. Make sure the sum is a double, or cast before dividing, so the result keeps its decimals. Example 3 has negatives and fractions, so don't assume positive whole numbers. Floating point is fine here, no rounding is asked for. If the OA is timed and you freeze, StealthCoder can hand you the solution live, but for this one you probably won't need it.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Average or Zero 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Waymo's OA.
Waymo reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Average or Zero FAQ
How hard is Average or Zero really?+
It's an easy warm-up. You sum the values and divide by the count. The only real risk is skipping the empty-array check. If you handle that and keep the math in doubles, you're done in a few lines.
What's the trick in this Waymo problem?+
The trick is the guard clause. If the table is empty, return 0.0 right away. Otherwise, sum everything as a double and divide by the length. Nothing else is hidden in the problem.
Do I need to worry about input size or performance?+
No. A single pass is optimal at O(n) time and O(1) space, and you can't beat reading every element. There's no brute-force version to avoid here, so don't overthink the approach.
What mistakes cost people points on this one?+
Dividing by zero on an empty array, and using integer division so 2.5 becomes 2. Also don't assume positive numbers. Example 3 has negatives and decimals, so test that case mentally before you submit.
How do I prepare in 48 hours for this OA?+
Don't cram this problem, it's trivial. Spend your time on array and hash-map basics, and practice reading a statement for edge cases like empty input. The rest of the OA likely needs more of your attention.