Shawngbk / Leecode

Questions of Leecode
0 stars 0 forks source link

441. Arranging Coins #144

Open Shawngbk opened 7 years ago

Shawngbk commented 7 years ago

public class Solution { public int arrangeCoins(int n) { if(n == 0) return 0; int count = 0; for(int i = 1; i <= n; i++) { if(n >= i) count++; n -= i; } return count; } }

Shawngbk commented 7 years ago

GoDaddy