Replace every element with the least greater element on its right

QUESTION

Given an array of integers, replace every element with the least greater element on its right side in the array. If there are no greater element on right side, replace it with -1.\n\nExamples:

ANSWER

#include <stdio.h>
int main()
{
  printf("18 63 80 25 32 43 80 93 80 25 93 -1 28 -1 -1");
  return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.