/Time complexity - O(n) Secret
Last active
March 21, 2022 23:22
Revisions
-
yschen25 renamed this gist
Mar 21, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
yschen25 revised this gist
Mar 21, 2022 . No changes.There are no files selected for viewing
-
yschen25 created this gist
Mar 21, 2022 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ function listSum(n) { let result = 0; // Assign 數值給變數,執行 1 次 for (let i = 0; i < n.length; i++) { // Loop array 執行 n 次 result += n[i]; } return result; // Return 結果,執行 1 次 }