Nearest Smaller Element Leetcode Python