Skip to content

Commit d884bb7

Browse files
committed
Time: 1 ms (57.47%), Space: 51.9 MB (32.18%) - LeetHub
1 parent 06b04a7 commit d884bb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

0896-smallest-subtree-with-all-the-deepest-nodes/0896-smallest-subtree-with-all-the-deepest-nodes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var subtreeWithAllDeepest = function(root) {
5555
};
5656
var maxDepth = (root,depth=0,memo={})=>{
5757
if(!root) return 0;
58-
let key =JSON.stringify(root);
58+
let key =(root.val);
5959
if(key in memo) return memo[key];
6060
let height =1+ Math.max(maxDepth(root.left,depth+1,memo),maxDepth(root.right,depth+1,memo));
6161
memo[key]=height;

0 commit comments

Comments
 (0)