Question says to do do selecton sort i did passed two test cases where am i going wrong
#include
using namespace std;
#include<bits/stdc++.h>
int main() {
int N,min_idx;
cin>>N;
int A[N];
for(int i=0; i<N; i++)
cin>>A[i];
for(int i=0; i<N-1; i++)
{
for(int j=i+1; j<N; j++)
{
min_idx=i;
if(A[min_idx]> A[j])
{
min_idx=j;
}
}
swap(A[min_idx],A[i]);
}
for(auto s:A)
cout<<s<<" ";
return 0;
}