carloscn / carloscn/structstudy

leetcode441:排列硬币(arranging-coins)

Open
#98 2 comments 0 reactions 1 assignee Claimed by @carloscn View on GitHub
Level-easy 一般问题 数学
Dominant language
C
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### 问题描述

你总共有 n 枚硬币,并计划将它们按阶梯状排列。对于一个由 k 行组成的阶梯,其第 i 行必须正好有 i 枚硬币。阶梯的最后一行 可能 是不完整的。

给你一个数字 n ,计算并返回可形成 完整阶梯行 的总行数。

示例 1:
![image](https://user-images.githubusercontent.com/16836611/211460726-b8951e5b-74ec-4bca-b16f-9bc9ef0daabc.png)

输入:n = 5
输出:2
解释:因为第三行不完整,所以返回 2 。

示例 2:
![image](https://user-images.githubusercontent.com/16836611/211460745-f73ed365-0ffe-440f-8e22-540af077b009.png)

输入:n = 8
输出:3
解释:因为第四行不完整,所以返回 3 。

提示:
1 <= n <= 231 - 1

来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/arranging-coins

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.