We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e60a28 commit 5978e54Copy full SHA for 5978e54
scripts/algorithms/U/Univalued Binary Tree/Univalued Binary Tree.js
@@ -1,11 +1,12 @@
1
+// Runtime: 80 ms (Top 65.60%) | Memory: 42.1 MB (Top 90.67%)
2
var isUnivalTree = function(root) {
3
if (!root) {
4
return false;
5
}
-
6
+
7
const prev = root.val;
8
const nodes = [root];
9
10
for (const node of nodes) {
11
if (node.val !== prev) {
12
@@ -22,4 +23,4 @@ var isUnivalTree = function(root) {
22
23
24
return true;
25
};
- ```
26
+ ```
0 commit comments