What's wrong with this code? It is giving a runtime error - 'SIGSKILL' .

//This is the exact code from CompetitiveProgrammersHandbook for Coin //Problem.

int fun(int x){
if(x==0) return 0;
if(x<0) return 1e9;

int arr[4]={1,2,5,10}; // available coins

int u=1e9;

for(int i=0; i<4; i++){
u=min(u, fun(x-arr[i]+1));
}
return u; // minimum no. of coins to get sum x

}