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
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:
SETanswersOKandGET a xreturns the value1; missing records or fields give an empty string. The firstDELETEremoves the last field ofa, so the record disappears and the secondDELETEfinds no field and answersfalse.
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.