Next Smallest Element On Left Leetcode Solutions Python