DEV Community

Tanuja V
Tanuja V

Posted on • Updated on

Univalued Binary Tree | LeetCode | Java

class Solution {
    public boolean isUnivalTree(TreeNode root) {
        return checkUniValue(root, root.val);

    boolean checkUniValue(TreeNode node, int val){
            return true;

            return false;

        return (checkUniValue(node.left, val) && checkUniValue(node.right, val));
Enter fullscreen mode Exit fullscreen mode

Thanks for reading :)
Feel free to comment and like the post if you found it helpful
Follow for more 🤝 && Happy Coding 🚀

If you enjoy my content, support me by following me on my other socials:

Top comments (0)