We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1615933 commit 34836d4Copy full SHA for 34836d4
big-o/double.js
@@ -0,0 +1,11 @@
1
+// Space Complexity: O(n)space!
2
+
3
+function double(arr){
4
+ let newArr = [];
5
6
+ for(let i = 0; i < arr.length; i++){
7
+ newArr.push(2 * arr[i]);
8
+ }
9
10
+ return newArr;
11
+}
big-o/sum.js
+// Space Complexity: O(1)space!
+function sum(arr){
+ let total = 0;
+ for(let i = 0 ; i < arr.length; i++){
+ total += arr[i];
+ return total;
0 commit comments