Add missing Dart codes and fix some errors (#689)

* Add missing Dart codes and fix some errors

* Update array_binary_tree.dart

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
liuyuxin
2023-08-17 05:04:38 +08:00
committed by GitHub
parent 5d7e0a59b1
commit 0858ab91c0
14 changed files with 504 additions and 204 deletions

View File

@ -20,8 +20,8 @@ void constant(int n) {
// 常量、变量、对象占用 O(1) 空间
final int a = 0;
int b = 0;
List<int> nums = List.filled(10000, 0);
ListNode node = ListNode(0);
// 循环中的变量占用 O(1) 空间
for (var i = 0; i < n; i++) {
int c = 0;
@ -61,7 +61,6 @@ void quadratic(int n) {
List<List<int>> numMatrix = List.generate(n, (_) => List.filled(n, 0));
// 二维列表占用 O(n^2) 空间
List<List<int>> numList = [];
for (var i = 0; i < n; i++) {
List<int> tmp = [];
for (int j = 0; j < n; j++) {