mAX ABSOLUTE DIFFERENCE

https://practice.geeksforgeeks.org/problems/max-absolute-difference/0

this code is showing seg fault…plz correct the code so that it doesnt show seg fault on submission at least…
.plz reply at the earliest…
right now i want to just remove seg fault and try submitting even if logic is incorrect .
.plz look for seg fault…

hello @S19LPPP0202
segementation fault occurs mainly due to two reasons.
either u r allocating too much memory or due to invalid access of index .
so check for these two cases by doing a dry of ur code.

i have tried that but unable to get it plz correct it…

image
here u are accessing index upto n-1. but u have declared array only of size n-end-1.

declare it of size n and then try.

ok now it is giving wa so plz correct the code…

i dont know , what u r doing in ur code…

refer this.

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.