Giving a segmentation fault

whats the mistake in this

hello @Parmeet-Kalsi-1631789033630118

a) declare ur array size as
int n;
cin>>n;
int arr[n];

b)
image
here it should be mid-1

now getting the output but code not getting accepted after submission

share ur updated code

print output for each test case in separate line

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.