C++ five lines fast solution


  • 0
    D

    int arrangeCoins(int n) {
    long long tmp=n;
    tmp = 8*tmp+1;
    int ans = floor((sqrt(tmp)-1)/2);
    return ans;
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.