def nextGreaterElement(self, findNums, nums): return [next((y for y in nums[nums.index(x):] if y > x), -1) for x in findNums]
@StefanPochmann surprised to see an one-liner, cool!
last edited by
@StefanPochmann Thanks so much for the quick reply. You are so helpful
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.