leetcode 441. Arranging Coins

解方程:

    int arrangeCoins(int n) {
        long sum = (long)n;
        return sqrt(sum * 2 + 0.25) - 0.5;
    }

 

posted on 2018-03-09 09:57  willaty  阅读(115)  评论(0)    收藏  举报

导航