My issue
please find the error in the program
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int arr[i];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<n;i++){
int j = i;
while (j>=1)
if(arr[j]>=arr[j-1]) break;
else{
swap(arr[j],arr[j-1]);
j--;
}
}
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
}
Learning course: Design and analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/abesit-daa/ABESITDA17/problems/SESO12