
문제 https://leetcode.com/problems/max-area-of-island/description/ Max Area of Island - LeetCode Can you solve this real interview question? Max Area of Island - You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are su leetcode.com 풀이 코드 class Solution { static int..

문제 https://leetcode.com/problems/keys-and-rooms/description/ Keys and Rooms - LeetCode Can you solve this real interview question? Keys and Rooms - There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key. Whe leetcode.com 풀이 코드 class Solution { /** * 0번째 room을 방문하..

문제 https://leetcode.com/problems/create-binary-tree-from-descriptions/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNo..

문제 https://leetcode.com/problems/symmetric-tree/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode ri..

문제 https://leetcode.com/problems/two-sum-iv-input-is-a-bst/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * ..

문제 https://leetcode.com/problems/count-good-nodes-in-binary-tree/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 DFS로 Tree를 순회한다. 각 Node의 값이 순회 경로 상에 있는 Node들의 최댓값보다 크면 최댓값을 변경하고 answer를 1 증가한다. Tree를 모두 ..

문제 https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 /** * Definition for a binary tree node. * public class TreeNode { * int val; *..

문제 https://leetcode.com/problems/reverse-odd-levels-of-binary-tree/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode ..

문제 https://leetcode.com/problems/all-paths-from-source-to-target/ LeetCode - The World's Leading Online Programming Learning Platform 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 풀이 코드 class Solution { static List answer; //allPathsSourceTarget 메소드의 return 값을 담을 전역변수 선언. public List allP..