Greater in the left

my code is failing one test case can you plz make me correct

hello @coderajay03

in this problem , the given array is circular.
but ur solution will only work for linear array that why it is giving wa

I am thinking it could be done using doubling the array
like [3 4 6 5 ] answer would be [4 6 -1 6] ok!!
so lets double array and find it using my above code only!
[3 4 6 5 3 4 6 5] answer would be [4 6 -1 6…] and just make changes in vector till the size of original array and done !!
Is this correct or there is another efficient approach ???

yeah, ur approach is correct.

but it has O(n) space complexity so what if they ask to optimize space ??

we cant optimise the space complexity furthur

why my copy function not working

@coderajay03

check now->

yeah worked now thankyou bhaiya !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

i am having a slight doubt bhaiya