C ++ program previous greater element An efficient solution to print previous greater element for every element in an array .
#include <bits/stdc++.h> NEW_LINE using namespace std ; void prevGreater ( int arr [ ] , int n ) {