Tip 1 : Code More till you like it
Tip 2 : Study Data Structures
Tip 1 : Mention only what you are confident about
Tip 2 : Mention tools & technologies used in the project as well



There can be more than one subsequences with the longest length.
For the given array [5, 0, 3, 2, 9], the longest decreasing subsequence is of length 3, i.e. [5, 3, 2]
Try to solve the problem in O(N log N) time complexity.



Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?