[Easy] LeetCode - no.637 Average of Levels in Binary Tree : Java
https://leetcode.com/problems/average-of-levels-in-binary-tree/?envType=study-plan-v2&envId=top-interview-150 문제이진 트리의 root가 주어졌을 때, 각 레벨별 평균을 구하여 반환할 것 Example 1 Input: root = [3,9,20,null,null,15,7]Output: [3.00000,14.50000,11.00000]Explanation: The average value of nodes on level 0 is 3, on level 1 is 14.5, and on level 2 is 11.Hence return [3, 14.5, 11]. 풀이참고 [LeetCode] 637. Average ..
2024. 10. 25.
[Easy] LeetCode - no.112 Path Sum : Java
https://leetcode.com/problems/path-sum/description/?envType=study-plan-v2&envId=top-interview-150 문제이진 트리의 root와 정수 targetSum이 주어졌을 때, 트리의 루트로부터 리프까지의 합이 targetSum과 일치하는지 여부를 판단할 것 Example 1 Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22Output: trueExplanation: The root-to-leaf path with the target sum is shown. 풀이참고 LeetCode 112(Path Sum, java)0. 문제 https://leetc..
2024. 10. 24.
[Easy] LeetCode - no.100 Same Tree : Java
https://leetcode.com/problems/same-tree/description/?envType=study-plan-v2&envId=top-interview-150 문제2개의 이진 트리 p와 q가 주어졌을 때, 두 이진 트리가 서로 동일한지 판단할 것 Example 1Input: p = [1,2,3], q = [1,2,3]Output: true Example 2 Input: p = [1,2], q = [1,null,2]Output: false 풀이참고 [자바] Leetcode 100 - Same Tree어쩌다 면접이 잡혀서 발등에 불떨어진 느낌으로 부랴부랴 문제 푸는중 ㅎ 친구한테 리트코드 추천 받아서 Difficulty Easy단계부터 풀고 있는데, 어렵지는 않다. 하지만 최적..
2024. 10. 23.