The Next greater Element for an element x is the first greater element on the right side of x in array. Elements for which no greater element exist, consider the index of next greater element as -1
Example : A=[1 0 2 6 0 4] Output: 2 2 3 -1 5 -1
https://stackoverflow.com/questions/65867108/how-to-print-the-index-of-next-greater-element-in-an-array January 24, 2021 at 12:21PM
没有评论:
发表评论