First And Last Occurrence Leetcode