It was no longer the recipe problem, but there were still four levels, and the general idea and direction had not changed much.
Level 1: Given a key, field, and value, write the value into the database and implement insert, delete, and update operations. This can be done with one nested map or two maps.
Level 2: There were two search operations. The first search uses the key and field to list all the field-value pairs. The second is similar, but it also takes a prefix, and the field must match that prefix.
Level 3: On top of the key, field, and value, add a timestamp and TTL. The timestamp is when the data is written, and the TTL is how long the data remains valid. Then rewrite the Level 1 and Level 2 methods to use them. One thing to watch is that search now also takes a timestamp, so it must not return an item if that item has already expired.
Level 4: I don't know 🤷. I ran out of time while Level 3 was still not fully debugged.
Surprisingly, I passed. I guess it was because I covered some corner cases? I really cannot think of another reason they would pass me. Or maybe they pass anyone whose code is more or less okay. :)
Discussion
Loading comments…