My issue
please upload the code in written format
My code
Learning course: Stacks and Queues
Problem Link: Palindrome by Splitting Practice Problem in Stacks and Queues - CodeChef
please upload the code in written format
Learning course: Stacks and Queues
Problem Link: Palindrome by Splitting Practice Problem in Stacks and Queues - CodeChef
@arnabsubhra
here plzz refer my c++ code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int ans=0;
for(int i=0,j=n-1;i<j;i++,j--)
{
if(a[i]>a[j])
{
a[i]=a[i]-a[j];
i--;
ans++;
}
else if(a[j]>a[i])
{
a[j]=a[j]-a[i];
j++;
ans++;
}
}
cout<<ans<<endl;
}
}