五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode 2358. Maximum Number of Groups Entering a Competition

2023-02-20 14:06 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a positive integer array?grades?which represents the grades of students in a university. You would like to enter?all?these students into a competition in?ordered?non-empty groups, such that the ordering meets the following conditions:

  • The sum of the grades of students in the?ith?group is?less than?the sum of the grades of students in the?(i + 1)th?group, for all groups (except the last).

  • The total number of students in the?ith?group is?less than?the total number of students in the?(i + 1)th?group, for all groups (except the last).

Return?the?maximum?number of groups that can be formed.

?

Example 1:

Input: grades = [10,6,12,7,3,5]Output: 3Explanation: The following is a possible way to form 3 groups of students: - 1st group has the students with grades = [12]. Sum of grades: 12. Student count: 1 - 2nd group has the students with grades = [6,7]. Sum of grades: 6 + 7 = 13. Student count: 2 - 3rd group has the students with grades = [10,3,5]. Sum of grades: 10 + 3 + 5 = 18. Student count: 3 It can be shown that it is not possible to form more than 3 groups.

Example 2:

Input: grades = [8,8]Output: 1Explanation: We can only form 1 group, since forming 2 groups would lead to an equal number of students in both groups.

?

Constraints:

  • 1 <= grades.length <= 105

  • 1 <= grades[i] <= 105

每次看到100.00%就可以開心一下了。


Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Maximum Number of Groups Entering a Competition.

Memory Usage:?50.6 MB, less than?69.28%?of?Java?online submissions for?Maximum Number of Groups Entering a Competition.


Leetcode 2358. Maximum Number of Groups Entering a Competition的評論 (共 條)

分享到微博請遵守國家法律
南雄市| 融水| 林州市| 平顶山市| 讷河市| 南平市| 鄱阳县| 祁门县| 九寨沟县| 大关县| 荔波县| 崇左市| 黎平县| 绥阳县| 雷州市| 黄浦区| 沿河| 瑞丽市| 五指山市| 上饶市| 怀来县| 察隅县| 唐河县| 珲春市| 玛多县| 鹤峰县| 通辽市| 贵州省| 天峻县| 浮梁县| 托里县| 大冶市| 关岭| 株洲市| 遵化市| 佛冈县| 旅游| 济阳县| 留坝县| 大石桥市| 桂阳县|