Skip to content

Commit c26400f

Browse files
committed
Solution as on 04-08-2022 11:00 pm
1 parent 62cd981 commit c26400f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// 2358.✅ Maximum Number of Groups Entering a Competition
2+
3+
class Solution
4+
{
5+
public:
6+
int maximumGroups(vector<int> &grades)
7+
{
8+
9+
int n = grades.size();
10+
int count = 0;
11+
12+
int i = 1;
13+
while (n > 0)
14+
{
15+
n -= i++;
16+
++count;
17+
}
18+
19+
return n == 0 ? count : count - 1;
20+
}
21+
};

0 commit comments

Comments
 (0)