← ALL NOTES
Array

2016. Maximum Difference Between Increasing Elements

Given nums, find the maximum nums[j] − nums[i] where i < j and nums[j] > nums[i] (strictly increasing pair). Return −1 if no such pair exists. Track the running prefix minimum and update the best…

Loading…