Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c6ca386

Browse files
tidy: comment
1 parent 7e07061 commit c6ca386

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎cpp/leetcode/135.分发糖果.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ class Solution {
7373
int inc = 1, dec = 0, pre = 1; // 递增递减区间个数,pre是前一个同学的糖果数
7474
for (int i = 1; i < ratings.size(); i++) {
7575
if (ratings[i] >= ratings[i - 1]) {
76-
pre = ratings[i] == ratings[i - 1]
77-
? 1
78-
: 1 + pre; // 相等也是不大于,可以只分1个
76+
// 相等也是不大于,可以只分1个
77+
pre = ratings[i] == ratings[i - 1] ? 1 : 1 + pre;
7978
ret += pre;
8079
dec = 0; // 重置递减区间
8180
inc = pre;

‎cpp/leetcode/56.合并区间.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
*
4747
*/
4848

49+
#include <algorithm>
4950
#include <vector>
51+
using namespace std;
5052

5153
// @lc code=start
5254
class Solution {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /