当前位置:网站首页>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;
}
};
边栏推荐
- IDEA debugging
- [uniCloud] Application and Improvement of Cloud Objects
- 解决安装MySQL后,Excel打开很慢的问题
- The bigger and bigger the project is, I split it like this
- Basic use of vim - command mode
- Flink 部署和提交job
- 更换树莓派内核
- Flink deploys and submits jobs
- MySQL修改SQL语句优化性能
- Open source project site must-have & communication area function
猜你喜欢
How to download the Keil package
《少年派2》:新男友竟脚踩两只船,林妙妙与钱三一感情回温
Browser download shortcut to desktop (PWA)
Summary of JVM interview questions (continuously updated)
The fledgling Xiao Li's 114th blog project notes: Wisdom cloud intelligent flower watering device combat (3) - basic Demo implementation
初出茅庐的小李第113篇博客项目笔记之机智云智能浇花器实战(2)-基础Demo实现
【 】 today in history: on July 31, "brains in vats" the birth of the participant;The father of wi-fi was born;USB 3.1 standard
LeetCode每日一练 —— 环形链表问题(面试四连问)
【历史上的今天】7 月 31 日:“缸中之脑”的提出者诞生;Wi-Fi 之父出生;USB 3.1 标准发布
leetcode: 1648. Color ball with decreasing sales value [Boundary find by two points]
随机推荐
leetcode:1562. 查找大小为 M 的最新分组【模拟 + 端点记录 + 范围合并】
C string array reverse
MySQL修改SQL语句优化性能
OSD read SAP CRM One Order application log way of optimization
Game Security 03: A Simple Explanation of Buffer Overflow Attacks
device node结构体转换成platform_device结构体
Introduction to machine learning how to?
彻底关闭Chrome浏览器更新及右上角的更新提示
IDEA无法识别module(module右下角没有蓝色小方块)
After specifying set 'execution.savepoint.path', restart flinksql and report this error
普通用户无法访问hgfs目录
RTL8762DK WDG (six)
IDEA修改注释字体
[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]
【数据分析】基于matlab GUI学生成绩管理系统【含Matlab源码 1981期】
【历史上的今天】7 月 31 日:“缸中之脑”的提出者诞生;Wi-Fi 之父出生;USB 3.1 标准发布
Device tree - conversion from dtb format to struct device node structure
Euler system (euleros): upgrade Mysql
The fledgling Xiao Li's 112th blog project notes: Wisdom cloud intelligent flower watering device actual combat (1) - basic Demo implementation
Four ways the Metaverse is changing the way humans work