System Design Leetcode Problems Javascript Array Findindex