Find closest greater value for every element in array - GeeksforGeeks
Given an array of integers, find the closest greater element for every element. If there is no greater element then print -1
Examples:
Input : arr[] = {10, 5, 11, 6, 20, 12}
Output : 11 6 12 10 -1 20Input : arr[] = {10, 5, 11, 10, 20, 12}
Output : 11 10 12 11 -1 20
Read full article from Find closest greater value for every element in array - GeeksforGeeks
No comments:
Post a Comment