Counting sort (sorting algorithm)

Why this code is not getting submitted? It’s compiling properly . Also it’s not showing any kind of test cases failure.

#include<bits/stdc++.h>
using namespace std;

void count_sort(int a[],int n)
{
int largest=a[0];
for(int i=1;i<n;i++)
{
largest=max(largest,a[i]);
}
int freq[largest+1]={0};
for(int i=0;i<n;i++)
{
freq[a[i]]+=1;
}

for(int i=0;i<=largest;i++)
{
    while(freq[i]!=0)
    {
        cout<<i<<" ";
        freq[i]--;
    }
}
return;

}

int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
count_sort(a,n);
return 0;
}

hello @brinda_dabhi

the code is correct, there is some issue with online judge.
it will be resolved soon.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.