当前位置:网站首页>leetcode6133. 分组的最大数量(中等)
leetcode6133. 分组的最大数量(中等)
2022-08-01 02:45:00 【重you小垃】



思路:技巧题
找满足m * (1 + m) / 2 <= n 的最大m即可。
class Solution {
public:
int maximumGroups(vector<int>& grades) {
int n = grades.size();
int i = 0;
for (; i * (i + 1) <= 2 * n; ++i) {
}
return i - 1;
}
};
边栏推荐
- Compiled on unbutu with wiringPi library and run on Raspberry Pi
- This map drawing tool is amazing, I recommend it~~
- IDEA无法识别module(module右下角没有蓝色小方块)
- Replacing the Raspberry Pi Kernel
- Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
- IDEA debugging
- MySQL modifies SQL statements to optimize performance
- 【搜索专题】看完必会的BFS解决最短路问题攻略
- 北京突然宣布,元宇宙重大消息
- MySQL修改SQL语句优化性能
猜你喜欢
随机推荐
Open source project site must-have & communication area function
被 CSDN,伤透了心
Basic implementation of vector
ROS2 series of knowledge (4): understand the concept of [service]
每周小结(*67):为什么不敢发表观点
RTL8762DK uses DebugAnalyzer (four)
MYSQL Keyword Explain Analysis
情人节浪漫3D照片墙【附源码】
纽约大学等 | TM-Vec:用于快速同源检测和比对的模版建模向量
元宇宙改变人类工作模式的四种方式
Chinese version of Pylint inspection rules
Basic use of vim - command mode
MYSQL query interception optimization analysis
MYSQL-Batch insert data
Nmap manuals - the full version
Beijing suddenly announced that yuan universe big news
/usr/sbin/vmware-authdlauncher: error while loading shared libraries: libssl.so.1.0.2*Solution
787. Merge Sort
How to get started with YOLO?How to implement your own training set?
WebApi 打个Attribute 统一处理异常









