文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
1. Description
2. Solution
class Solution {
public:int arrangeCoins(int n) {int k = 0;while(n > 0) {++k;n -=k;}if(n == 0) {return k;} return k - 1;}
};
Reference
- https://leetcode.com/problems/arranging-coins/description/