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 68408c9 commit fde6a4aCopy full SHA for fde6a4a
1 file changed
maximum-subarray/reeseo3o.js
@@ -1,4 +1,5 @@
1
-/**
+/**
2
+ * DFS
3
* Time complexity: O(n)
4
* Space complexity: O(h) - h is the height of the tree, worst case O(n)
5
*/
@@ -11,7 +12,11 @@ const maxDepth = (root) => {
11
12
return 1 + Math.max(leftDepth, rightDepth);
13
};
14
-// BFS - TC: O(n) | SC: O(n)
15
16
+ * BFS
17
+ * Time complexity: O(n)
18
+ * Space complexity: O(n)
19
+ */
20
const maxDepthBFS = (root) => {
21
if (root === null) return 0;
22
0 commit comments