当前位置:网站首页>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;
}
};
边栏推荐
- test
- Summary of MVCC
- 【入门教程】Rollup模块打包器整合
- The IDEA can't find or unable to load The main class or Module "*" must not contain The source root "*" The root already belongs to The Module "*"
- 【搜索专题】看完必会的BFS解决最短路问题攻略
- SC7A20 (Silan Micro-Accelerometer) Example
- gateway gateway cross domain
- Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
- Flink 部署和提交job
- sqlserver cannot connect remotely
猜你喜欢

Detailed explanation of TCP protocol

STK8321 I2C (Shengjia-accelerometer) example

Unity3D study notes 10 - texture array

解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题

Euler system (euleros): upgrade Mysql

Flink 部署和提交job

HIRO: Hierarchical Reinforcement Learning 】 【 Data - Efficient Hierarchical Reinforcement Learning

MYSQL master-slave replication

Data Middle Office Construction (VII): Data Asset Management

项目越写越大,我是这样做拆分的
随机推荐
Game Security 03: A Simple Explanation of Buffer Overflow Attacks
初出茅庐的小李第112篇博客项目笔记之机智云智能浇花器实战(1)-基础Demo实现
数据中台建设(七):数据资产管理
RTL8762DK WDG (six)
Summary of JVM interview questions (continuously updated)
RTL8762DK PWM (seven)
软考高级系统架构设计师系列之:系统开发基础知识
How is the tree structure of the device tree reflected?
Daily practice of LeetCode - Circular linked list question (interview four consecutive questions)
[cellular automata] based on matlab interface aggregation cellular automata simulation [including Matlab source code 2004]
Detailed explanation of TCP protocol
HCIP(14)
IDEA修改注释字体
New York University et al | TM-Vec: Template Modeling Vectors for Rapid Homology Detection and Alignment
初出茅庐的小李第114篇博客项目笔记之机智云智能浇花器实战(3)-基础Demo实现
普通用户无法访问hgfs目录
Nmap manuals - the full version
Introduction to machine learning how to?
STK8321 I2C (Shengjia-accelerometer) example
Parse the bootargs from the device tree (dtb format data)