First Duplicate Leetcode Python