when i submitted this code, i got “wrong answer” icon…please explain what wrong answer this code is giving??
THIS IS THE PROBLEM OF “SCHOOL” PRACTICING LEVEL, PROBLEM CODE: CHRL3
#include<stdio.h>
main()
{
long int a,move=0;
scanf("%d",&a);
long int arr[a],i,j,k;
for(i=0;i<a;i++)
scanf("%d",&arr[i]);
read1:
for(i=0;i<a;i++)
{
long int t=0,p=i;
read:
if(arr[p+1]==arr[p]+1)
{
p++,t++;
if(p==(a-1))
goto skipread;
goto read;
}
skipread:
if(t!=0)
{
t++;
move++;
for(j=i,k=p+1;j<a && k<a;j++,k++)
{
arr[j]=arr[k];
}
a=a-t;
goto read1;
}
}
move = move + a;
printf("\n%d",move);
return 0;
}