First And Last Occurrences In Array Leetcode