Cloud Storage System
Asked at Airbnb
Reported by the problem's creator, not verified
You are building an in-memory cloud storage system as the class CloudStorage. A file has a unique name and a size.
Examples
Example 1
Input: init =
[], operations =[["add_file",["a.txt",10]],["add_file",["b.txt",5]],["add_file",["a.txt",99]],["get_file_size",["a.txt"]],["get_file_size",["zzz"]],["delete_file",["a.txt"]],["delete_file",["a.txt"]],["get_file_size",["a.txt"]],["add_file",["a.txt",7]],["get_file_size",["a.txt"]]]Output:
[true,true,false,10,null,10,null,null,true,7]Explanation: The second add of
a.txtfails because the name exists. Reading a missing file givesnull. Deletinga.txtreturns its size 10; deleting it again givesnull, and the name can be added again with a new size.