Several bug fixes and improvements (#945)

* Update Dockerfile for code debugging.

* Format Python code using Black.

* Improve dark theme by defining html classes for the figures, animations and cover images.

* Fix several glossary translation.

* Update a code comment.

* Fix climbing_stairs_backtrack: the pruning should not require the sorted choices list.

* Update the code of array and list traversal.

* Fix a rendering issue of README.md

* Update code of list traversal.

* Fix array_definition.png

* Update README.md

* Fix max_capacity_moving_short_board.png

* Fix array.dart

* Fix array.dart

* Fix array.dart

* Fix array.dart
This commit is contained in:
Yudong Jin
2023-11-14 21:27:35 +08:00
committed by GitHub
parent 9baf4a1753
commit fcbaf101a4
64 changed files with 212 additions and 218 deletions

View File

@ -54,11 +54,11 @@ public class array {
int count = 0;
// 通过索引遍历数组
for (int i = 0; i < nums.length; i++) {
count++;
count += nums[i];
}
// 直接遍历数组
// 直接遍历数组元素
for (int num : nums) {
count++;
count += num;
}
}

View File

@ -17,8 +17,8 @@ public class list {
System.out.println("列表 nums = " + nums);
/* 访问元素 */
int x = nums.get(1);
System.out.println("访问索引 1 处的元素,得到 x = " + x);
int num = nums.get(1);
System.out.println("访问索引 1 处的元素,得到 num = " + num);
/* 更新元素 */
nums.set(1, 0);
@ -47,13 +47,11 @@ public class list {
/* 通过索引遍历列表 */
int count = 0;
for (int i = 0; i < nums.size(); i++) {
count++;
count += nums.get(i);
}
/* 直接遍历列表元素 */
count = 0;
for (int num : nums) {
count++;
for (int x : nums) {
count += x;
}
/* 拼接两个列表 */