Cloud File System
Asked at Meta
Reported by the problem's creator, not verified
Build an in-memory cloud file system, CloudStorage. Every file has a unique name and a positive integer size.
Examples
Example 1
Input: init =
[], operations =[["add_file",["a/x",30]],["add_file",["a/x",5]],["get_file_size",["a/x"]],["get_file_size",["none"]],["delete_file",["a/x"]],["delete_file",["a/x"]],["get_file_size",["a/x"]],["add_file",["a/x",7]],["get_file_size",["a/x"]]]Output:
[true,false,30,null,30,null,null,true,7]Explanation: The second
add_filefora/xreturnsfalseand the size stays 30.delete_filereturns 30 once andnullthe second time. After that the name is free, so adding it with size 7 works.
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.