Maximum Value at a Given Index in a Bounded Array | Leetcode - 1802