Reported July 2024
Purestoragesimulation

Shopping and Billing

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

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

You've got a Purestorage OA in your inbox and the problem is about shopping and billing. This one lands in the fuzzy middle ground between simulation and math, which is exactly where candidates blank. The trick isn't algorithmic elegance; it's nailing the state transitions and handling edge cases in discount logic, tax calculation, or fee structures. StealthCoder catches the moment you freeze on a coupon interaction or a rounding rule you can't quite remember.

Pattern and pitfall

Shopping and billing problems test your ability to model real-world workflows as code. You'll likely need to track a cart, apply discounts (often with rules about minimum spend or exclusions), compute totals with tax, and handle payment flows. The gotchas are usually in the order of operations: does tax apply before or after discount. Do multiple coupons stack. What rounding rule wins. These problems live in the simulation bucket because the challenge is orchestrating state changes correctly, not inventing a data structure. Walk through a few concrete examples on paper first; the pattern often reveals itself once you see what the problem is actually asking you to calculate.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Shopping and Billing 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 would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder
⏵ The honest play

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

Purestorage reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Shopping and Billing FAQ

Is this a math problem or a simulation problem?+

Both. The math is straightforward arithmetic. The simulation part is tracking when each rule applies and in what order. The complexity is orchestration, not calculation. Get the state machine right first, then implement.

What's the most common mistake candidates make here?+

Applying discount and tax in the wrong order, or forgetting that some discounts exclude certain item categories. Always confirm the exact rules from the problem statement. Write them down as pseudocode before you code.

How do I handle floating point precision with prices?+

Use integer arithmetic if possible (work in cents). If you must use floats, round at the very end using the rule stated in the problem. Never accumulate rounding errors across multiple steps.

Should I hard-code the discount rules or make them configurable?+

Read the problem carefully. If it describes one specific scenario, hard-code it cleanly. If it hints at testing multiple discount structures, design a more flexible solution. Purestorage problems usually prefer clean, explicit logic over over-engineering.

How much time should I spend on this in the OA?+

15-20 minutes to parse the problem and map the rules. Another 15-20 to code. Spend the first 5 minutes writing out the exact calculation sequence in plain English. That catches most bugs before they happen.

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

OA at Purestorage?
Invisible during screen share
Get it