Linear Search Leetcode Question