JAVA_Univalued Binary Tree_LeetCode 965 풀이 class Solution { // 비교 set Set set = new HashSet(); public boolean isUnivalTree(TreeNode root) { if (root == null) return set.size() == 1; // 재귀시 값 설정 set.add(root.val); return isUnivalTree(root.left) && isUnivalTree(root.right); } } * 출처 https://leetcode.com/problems/univalued-binary-tree/ Univalued Binary Tree - LeetCode Can you solve this real interview question? Univalued Binary Tree - A binary tree is uni-valued if every node in the tree...
#
JAVA
#
JAVA_LeetCode965
#
JAVA_UnivaluedBinaryTree
#
JAVA_UnivaluedBinaryTree_LeetCode965
#
UnivaluedBinaryTree_LeetCode965