js
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 리스트에서 단어들을 뽑아 조합해서 가장 긴 팰린드롬(좌우대칭)..
LeetCode / Linked List / 148번 / Sort List / JS
Sort List - LeetCode Can you solve this real interview question? Sort List - Given the head of a linked list, return the list after sorting it in ascending order. Example 1: [https://assets.leetcode.com/uploads/2020/09/14/sort_list_1.jpg] Input: head = [4,2,1,3] Output: [1, leetcode.com 리스트에 있는 노드들을 오름차순으로 정렬하는 문제이다. /** * Definition for singly-linked list. * function Lis..
LeetCode / Linked List / 328번 / Odd Even Linked List / JS
Odd Even Linked List - LeetCode Can you solve this real interview question? Odd Even Linked List - Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered od leetcode.com 홀수번째 노드들을 앞으로 오게 하고, 짝수번째 노드들은 뒤로 보낸다. /** * Definition for singly-linke..
LeetCode / Simulation / 1706번 / Where Will the Ball Fall / JS
Where Will the Ball Fall - LeetCode Can you solve this real interview question? Where Will the Ball Fall - You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corners o leetcode.com 문제에 있는 그림대로 공이 이동했을 경우 각 열마다의 공이 몇번째 열로 마지막에 나오는지 반환하는 문제이다. 만약 중간에 ..