Record Database With Locks

Asked at Meta

Reported by the problem's creator, not verified

An in-memory database stores records. A record is addressed by a key and holds named fields, each with a string value. A record can also be locked exclusively by one user.

Examples

  1. Example 1

    Input: queries = [["SET","a","x","1","u1"],["GET","a","x"],["GET","a","y"],["GET","b","x"],["DELETE","a","x","u1"],["DELETE","a","x","u1"],["GET","a","x"]]

    Output: ["OK","1","","","true","false",""]

    Explanation: SET answers OK and GET a x returns the value 1; missing records or fields give an empty string. The first DELETE removes the last field of a, so the record disappears and the second DELETE finds no field and answers false.

Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.
Import a question

Code

Loading editor…

Ln 1, Col 1

Start an attempt to use Coach.