GlobalLogic interview question

data structure question in js