Elbit Systems Interview Question

Question 1: Describe a data structure for which getValue(int index), setValue(int index, int value), and setAllValues(int value) are all O(1). Question 2: Given the JavaScript function setTimeout that is faulty how would you mitigate it. The function's problem is that it overrides the previous saved function by the previous setTimeout call. Example: code: setTimeout( ()=> console.log("a"), 500) setTimeout( ()=> console.log("b"), 200) setTimeout( ()=> console.log("c"), 1000) output: c c c