Output is correct getting run time error on testcases and getting segmentation fault when size of array is large
@Vipul.kapoor
The value of n can be upto 200000. but size of your array a[] and temp[] is 100000 so your code won’t work for n>100000.
Simply increase the size of these array by change line 10 to int temp[200000]; and line 58 to int a[200000]; will result in correct output.
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.