Code RoomBitwise AND skips second call
HardPrep Room Coding #4524

Bitwise AND skips second call

Code reviewCode quality & reviewSenior–Staff~20 min

Review this Java order pipeline. `tryReserve` performs a network call and returns whether an inventory hold succeeded; `tryCharge` actually moves money.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1boolean process(Order o) {
2 // Reserve stock first, then charge the customer.
3 boolean ok = inventory.tryReserve(o) & payments.tryCharge(o);
4 if (ok) {
5 fulfillment.enqueue(o);
6 log.info("order {} placed", o.id());
7 } else {
8 log.warn("order {} failed", o.id());
9 }
10 return ok;
11}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.