JAVA_Minimum Depth of Binary Tree_LeetCode 111 Minimum Depth of Binary Tree 풀이 class Solution { public int minDepth(TreeNode root) { if(root == null) return 0; int left = minDepth(root.left); int right = minDepth(root.right); return (left == 0 || right == 0) ? left + right + 1 : Math.min(left, right) + 1; } } * 출처 Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com...
#JAVA
#JAVA_LeetCode111
#JAVA_MinimumDepthofBinaryTree
#JAVA_MinimumDepthofBinaryTree_LeetCode111
#MinimumDepthofBinaryTree_LeetCode111
원문링크 : JAVA_Minimum Depth of Binary Tree_LeetCode 111