Onsite :
You are designing a JSON webpage viewer with the ability for users to save and ldad previously viewed JSON documents.
The website sends/receives the complete state of the world from the webpage to the backend server on each update/save.
The state of the world is stored in SimpleJSON. The client has the original document D1 and the modified document D2, where D2 is D1 + (delta)
You begin profiling the application and notice that for very large JSON documents being saved it's very slow -- even if no change has been produced!
Optimise the space-efficiency of saving the changes for a given SimpleJSON document where you are given 'old_doc' and 'new_doc'.Initially he mentioned that json will be simple key value of string
I proposed using map to store key value and then find the diff.
Follow up :
Json can be nested json.
I proposed using recursion.
Interviewer seems to be not satisfied.
Comments (4)


