CommentJul 26, 2020You did a mistake in the first for loop where you get the input it should be cin>>arr[i] and in the second for loop initialize the i as s-1 it will workStruck at a Basic competitive programming question