Next Smaller Element Leetcode Problems Python