@above I think you should process not only the right part but the left one
too.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
a
simple dp
void solve(int *arr,int sz)
{
int ans[sz];
ans[sz-1]=-1;
for(int i=sz-2;i>=0;i--)
{
if(arr[i] wrote:
> You are given an array (unsorted) and for every element i, find the
> first occurance of an element j (in the remaining array) that is
> greater than or equal t
You are given an array (unsorted) and for every element i, find the
first occurance of an element j (in the remaining array) that is
greater than or equal to i. If no such j occurs then print -1.
Eg: Input---> A={1,3,5,7,6,4,8}
Output---> 3 5 7 8 8 8 -1
Time Complexity:O(n)
Space Complexity:O(n)
-