Reported October 2024
Expediaprefix sum

Calculate the Sum

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

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

Expedia asked this in October 2024, and it's deceptively straightforward. 'Calculate the Sum' sounds like a warm-up, but candidates who treated it as one often missed the edge case or brute-forced when a cleaner pattern existed. You're probably looking at an array or sequence where you need to aggregate values in a specific way. StealthCoder is your safety net if you blank on the optimal approach during the live OA.

Pattern and pitfall

Without the full problem text, the trick is usually one of three things: either there's a mathematical shortcut that beats iteration, there's a constraint that rules out naive summation, or there's a hidden condition about which elements to sum. The pattern often boils down to either prefix sums for range queries, a formula to avoid loops entirely, or filtering based on a condition before adding. The pitfall is implementing O(n) when O(1) or O(log n) exists. Expedia tends to reward clean, efficient code over brute force. If you hit a wall during the OA, StealthCoder can show you the pattern in real time.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Calculate the Sum 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as range sum query immutable. If you have time before the OA, drill that.

⏵ The honest play

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

Expedia reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Calculate the Sum FAQ

Is this just a loop that adds numbers?+

Probably not the intended solution. If the naive approach works in 10 lines, check for a constraint that suggests prefix sums, math, or filtering. Expedia typically wants you to think beyond iteration.

What if the input is huge?+

That's the tell. If constraints hint at 10^6 elements or more, you need O(1) or O(log n). Either use a formula or precompute with prefix sums. Iteration alone won't pass.

How do I prepare for this in 48 hours?+

Brush up on prefix sum array construction and basic sum formulas (arithmetic sequences, powers, etc.). If you have the full problem text, identify whether you're summing all elements, a range, or elements matching a condition.

Is this a red herring easy problem?+

Possibly. Expedia sometimes gates harder logic behind a simple-sounding title. Don't assume it's trivial. Read constraints and examples carefully to spot the actual difficulty.

What's the most common mistake?+

Overlooking a constraint or edge case (empty input, negative numbers, integer overflow). The second mistake is ignoring that a mathematical formula beats loops. Always ask yourself: can I compute this without iterating.

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

OA at Expedia?
Invisible during screen share
Get it