Help me with this DSA gfg problem "Count frequency of an element' but giving error - Abort signal from
https://sololearn.com/compiler-playground/c35X7MbSGAY3/?ref=app #include <iostream> using namespace std; int main() { int arr[5]={1,2,3,4,5}, N=sizeof(arr)/sizeof(int), P=5; cout<<"N: "<<N<<endl; int i; for(i=0;i<N;i++){ if(arr[i]>N) { cout<<"I am in else if"; arr[i]=0; } else if(N==1){ cout<<"I am in else if"; arr[i]=i+1; } } //Step 1 -Substract value by 1 for(i=0;i<N;i++) arr[i]--; //Step 2 -use modulo and add n for(i=0;i<N;i++){ arr[arr[i]%N]+=N; cout<<" Step2- arr"<<arr[i]%N<<" - "<<arr[arr[i]%N]<<endl; } //Step 3 - To find no of occurance for(i=0;i<N;i++){ arr[i]=arr[i]/N; cout<<" Step3- arr"<<i<<" - "<<arr[i]<<endl; } }