JAVA_Sum of Left Leaves_LeetCode 404


JAVA_Sum of Left Leaves_LeetCode 404

JAVA_Sum of Left Leaves_LeetCode 404 풀이 class Solution { public int sumOfLeftLeaves(TreeNode root) { if (root == null) return 0; int sum = 0; sum += (root.left != null && root.left.left == null && root.left.right == null) ? root.left.val : sumOfLeftLeaves(root.left); sum += sumOfLeftLeaves(root.right); return sum; } } * 출처 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_LeetCode404 #JAVA_SumofLeftLeaves #JAVA_SumofLeftLeaves_LeetCode404 #SumofLeftLeaves_LeetCode404

원문링크 : JAVA_Sum of Left Leaves_LeetCode 404