image_2021-11-10_13-52-56.png
19.9 KB
#N441. Arranging Coins
problem link
#solution
problem link
#solution
class Solution {
public int arrangeCoins(int n) {
return ((int)(Math.pow((1+8*(long)n), 0.5))-1)/2;
}
}
p.s. Yeah, math really helps to solve this kind of problems😅