JAVA_Path Sum_LeetCode 112


JAVA_Path Sum_LeetCode 112

JAVA_Path Sum_LeetCode 112 풀이 class Solution { public boolean hasPathSum(TreeNode root, int sum) { if(root==null)return false; sum = sum - root.val; if(root.left==null && root.right==null){ boolean bool = sum == 0 ? true : false; return bool; } return hasPathSum(root.left,sum) || hasPathSum(root.right,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_LeetCode112 #JAVA_PathSum #JAVA_PathSum_LeetCode112 #PathSum_LeetCode112

원문링크 : JAVA_Path Sum_LeetCode 112