PS/LeetCode
LeetCode / Tree / 437번 / Path Sum III / JS
Path Sum III - LeetCode Can you solve this real interview question? Path Sum III - Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum. The path does not need to start or end at the roo leetcode.com 주어진 트리내에서 targetSum을 만족하는 subtree가 몇개가 존재하는지 반환하는 문제이다. /** * Definition for a bin..
LeetCode / Tree / 543번 / Diameter of Binary Tree / JS
Diameter of Binary Tree - LeetCode Can you solve this real interview question? Diameter of Binary Tree - Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path leetcode.com diameter를 직역하면 지름이라는 뜻인데... 이 문제에서 지름을 반환하면 된다(?). 문제에서 나타내는 diameter..
LeetCode / Tree / 110번 / Balanced Binary Tree / JS
Balanced Binary Tree - LeetCode Can you solve this real interview question? Balanced Binary Tree - Given a binary tree, determine if it is height-balanced. Example 1: [https://assets.leetcode.com/uploads/2020/10/06/balance_1.jpg] Input: root = [3,9,20,null,null,15,7] Output: true Exam leetcode.com 균형잡힌 이진트리인지 boolean 값으로 반환하는 문제이다. 여기서 균형잡힌 이진트리란, 왼쪽과 오른쪽의 subtree의 depth가..
LeetCode / Tree / 226번 / Invert Binary Tree / JS
Invert Binary Tree - LeetCode Can you solve this real interview question? Invert Binary Tree - Given the root of a binary tree, invert the tree, and return its root. Example 1: [https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg] Input: root = [4,2,7,1,3,6,9] Output: [4 leetcode.com 주어진 트리를 좌우반전시켜 반환하는 문제이다. /** * Definition for a binary tree node. * function..
LeetCode / Greedy / 621번 / Task Scheduler / JS
Task Scheduler - LeetCode Can you solve this real interview question? Task Scheduler - Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. F leetcode.com 해야하는 작업들의 리스트와 n이 주어진다. 여기서 n은 같은 작업을 잇따라 해야할 시에 중간에 반드시 텀을 둬야하는 시간이다.(유휴시간) 예..
LeetCode / Greedy / 2131번 / Longest Palindrome by Concatenating Two Letter Words / JS
Longest Palindrome by Concatenating Two Letter Words - LeetCode Can you solve this real interview question? Longest Palindrome by Concatenating Two Letter Words - You are given an array of strings words. Each element of words consists of two lowercase English letters. Create the longest possible palindrome by selecting leetcode.com words 리스트에서 단어들을 뽑아 조합해서 가장 긴 팰린드롬(좌우대칭)..