We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d3b0fb commit 6a15d28Copy full SHA for 6a15d28
scripts/algorithms/B/Balanced Binary Tree/Balanced Binary Tree.js
@@ -1,17 +1,18 @@
1
+// Runtime: 112 ms (Top 53.69%) | Memory: 46.9 MB (Top 82.53%)
2
/**
3
* Definition for a binary tree node.
4
* function TreeNode(val, left, right) {
- * this.val = (val===undefined ? 0 : val)
5
- * this.left = (left===undefined ? null : left)
6
- * this.right = (right===undefined ? null : right)
+ * this.val = (val===undefined ? 0 : val)
+ * this.left = (left===undefined ? null : left)
7
+ * this.right = (right===undefined ? null : right)
8
* }
9
*/
10
11
* @param {TreeNode} root
12
* @return {boolean}
13
14
var isBalanced = function(root) {
-
15
+
16
let result=true;
17
function Dfs(root){
18
if(!root)return 0;
@@ -23,4 +24,3 @@ var isBalanced = function(root) {
23
24
Dfs(root)
25
return result
26
};
0 commit comments