I have recently attended the Paypal Round and got the following question:
Design a DataStructure that will support INSERT, DELETE,GETMIN,GETMAX.
eg: INSERT 1
INSERT 2
GETMIN -1
GETMAX -2
DELETE 2
GETMIN -1
GETMAX -1
Problem 1 : Lets assume you are designing a complicated API ( JSON response with nested sturctures) and It should not return any empty objects/collections etc
Examples. :
Response =. {{
student_name = 'Test',
class='XII',
subjects=[],
additonal_info = { }
}
Expected = {
student_name = 'Test',
class='XII'
}