```
public int arrangeCoins(int n) {
if(n < 1)
return 0;
for(int i = 1; ;i++){
n -=i;
if(n < 0)
return i-1;
}
}
}
```

As coins increase by 1 in every row beginning from 1. keep on subtracting same number of coins from the 'n' until it goes negative. When it goes negative, current iteration 'i' is half filled. So, definitely previous row will be fully filled.