I am not able to find the compiler error can you help?

#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int cache[n];
memset(cache,0,sizeof(cache[0])*n);
cout<<exchange(n,cache);
return 0;
}
int exchange(int n,int *cache){
if(n==0 || n==1){
return n;
}
if(cache[n]!=0)
return cache[n];

int op1,op2,op3;
op1 = exchange(n/2,cache);
op2 = exchange(n/3,cache);
op3 = exchange(n/4,cache);
return cache[n] = max(n,op1+op2+op3);

}

May I know when will I get a reply

Hey soumadeepbagui, Since the input size can be very large ( n <= 1 000 000 000). It may not be possible to allocate a contiguous memory of this size in the memory. Inorder to overcome this problem, we should substitute the array with a map. Try substituting the array with an unordered map because your logic is perfectly fine.

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.