File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 99 * "product": 30 // 2 * 3 * 5
1010 * }
1111 *
12- * Time Complexity: O(n)
12+ * Initial Time Complexity: O(n) [multiple passes]
1313 * Space Complexity: O(1)
14- * Optimal Time Complexity: O(n)
14+ * Optimal Time Complexity: O(n) [single pass]
1515 *
1616 * @param {Array<number> } numbers - Numbers to process
1717 * @returns {Object } Object containing running total and product
Original file line number Diff line number Diff line change 11/**
22 * Finds common items between two arrays.
33 *
4- * Time Complexity: O(n + m)
4+ * Initial Time Complexity: O(n × m) [filter with includes]
55 * Space Complexity: O(n + m)
6- * Optimal Time Complexity: O(n + m)
6+ * Optimal Time Complexity: O(n + m) [with Set]
77 *
88 * @param {Array } firstArray - First array to compare
99 * @param {Array } secondArray - Second array to compare
Original file line number Diff line number Diff line change 11/**
22 * Find if there is a pair of numbers that sum to a given target value.
33 *
4- * Time Complexity: O(n)
4+ * Initial Time Complexity: O(n²) [nested loops]
55 * Space Complexity: O(n)
6- * Optimal Time Complexity: O(n)
6+ * Optimal Time Complexity: O(n) [with Set]
77 *
88 * @param {Array<number> } numbers - Array of numbers to search through
99 * @param {number } target - Target sum to find
Original file line number Diff line number Diff line change 11/**
22 * Remove duplicate values from a sequence, preserving the order of the first occurrence of each value.
33 *
4- * Time Complexity: O(n)
4+ * Initial Time Complexity: O(n²) [nested loops]
55 * Space Complexity: O(n)
6- * Optimal Time Complexity: O(n)
6+ * Optimal Time Complexity: O(n) [with Set]
77 *
88 * @param {Array } inputSequence - Sequence to remove duplicates from
99 * @returns {Array } New sequence with duplicates removed
You can’t perform that action at this time.
0 commit comments