Reported June 2024
Weworksimulation

Shopping and Billing

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

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

WeWork's June OA included a problem called Shopping and Billing that catches candidates off-guard because it reads like a real-world scenario but has a hidden algorithmic core. You've got an invoice, some items, and rules about how billing works. The trap is thinking you can simulate it naively. The real test is whether you can model state changes cleanly and track what changes across transactions. StealthCoder will spot the pattern if you blank on the implementation.

Pattern and pitfall

Shopping and Billing is fundamentally a state-management and simulation problem. You're tracking items, quantities, prices, and applying billing logic across multiple operations. The common miss is writing spaghetti code that mixes presentation logic with calculation logic. Candidates often hard-code the rules instead of abstracting them. The pattern is to model each transaction clearly, apply rules in order, and track cumulative state. Edge cases hide in rounding, item removal, and rebilling. The problem expects you to handle real-world messiness: partial quantities, price changes mid-flow, or items that appear and vanish. If you panic on the OA, StealthCoder runs invisibly and reads the exact rules on screen, then feeds you the structure to code.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Wework reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Shopping and Billing FAQ

Is this a math problem or a coding problem?+

It's mostly coding. Math is minimal, usually addition and subtraction. The hard part is tracking state and applying billing rules in the right order. The scenario is retail-flavored, but the algorithm is clean data management.

Do I need to handle floating-point precision or currency rounding?+

Likely yes. Shopping problems almost always hide rounding gotchas. Use integer arithmetic (cents instead of dollars) or be very careful with decimal comparison. Test your rounding logic against the examples carefully.

How do I model the items and the billing rules cleanly?+

Use a class or struct to represent an item with quantity, price, and state. Keep billing rules separate from item logic. A transaction log or event list often makes debugging easier than trying to mutate state in-place.

What's the most common mistake on this type of problem?+

Forgetting to update totals after every change, or updating them in the wrong order. Also, not testing edge cases like zero quantity, removed items, or duplicate transactions. Trace through the example by hand first.

Can I solve this in under 45 minutes if I've never seen it?+

Yes, if you stay calm and code the simulation step-by-step. Don't over-engineer. Write a straightforward loop that applies each operation, prints or returns the final state, and verify against the example. Speed comes from clarity, not cleverness.

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

OA at Wework?
Invisible during screen share
Get it