Microsoft Interview Question

Array Manipulation to fetch result in O(1)