Given an array of integers, replace each element with the next greater element to its right. If there is no greater element on the right, keep the element itself (or replace with itself).
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.