Posted on July 6, 2021July 6, 2021 Description Submission class Solution { public: int arrangeCoins(int n) { return (int) (sqrt(1 + 8 * (long long)n) - 1) / 2; } }; // (1 + x) * x / 2 = n; // (1 + x) * x = 2 * n // x^2 + x - 2*n = 0; By Bill0412 Easy LeetCode