All challenges
Code AnalysisHard 50s

Trace: Lost Update

Two requests run concurrently. What is the final value?
Starter code
# v starts at 0
row = db.get(id)        # A and B both read v=0
row.v += 1
db.save(row)            # both write v=1

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle