441. Arranging Coins

 class Solution {

public:
    int arrangeCoins(int n) {
    int i = 0 ;
    for( ; n-i>=0 ; i++ ) n=n-i;
    return i-1;       
    }
};

Comments

Popular posts from this blog

1431. Kids With the Greatest Number of Candies

125. Valid Palindrome

771. Jewels and Stones