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 72c0407

Browse files
author
zhangxing
committed
docs: 添加注释
1 parent b515ad4 commit 72c0407

7 files changed

+3
-13
lines changed

‎查找插入位置.js‎ renamed to ‎双指针-查找插入位置.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ var searchInsert = function (nums, target) {
3838
let start = 0,
3939
end = nums.length - 1;
4040
while (start <= end) {
41-
// 右半部分的下标要加上start
41+
// mid是以start为起点,所以叫加上start
4242
let mid = start + Math.floor((end - start) / 2);
4343
if (target === nums[mid]) {
44-
return mid;
44+
return mid;// while中使用return可以中断循环
4545
}
4646
console.log(mid);
4747
if (target < nums[mid]) {

‎回文数.md‎

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.

‎第一个只出现一次的字符.js‎ renamed to ‎栈-第一个只出现一次的字符.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var firstUniqChar = function (s) {
2323
notOnes.push(s[i]);
2424
onlyOnes.splice(index, 1);
2525
} else {
26+
// 不是重复的元素才入栈
2627
if (notOnes.indexOf(s[i]) === -1) {
2728
onlyOnes.push(s[i]);
2829
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
(0)

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