[Medium] 1376. Time Needed to Inform All Employees
leetCode 2022. 7. 6. 17:56

문제 A company has n employees with a unique ID for each employee from 0 to n - 1. The head of the company is the one with headID. Each employee has one direct manager given in the manager array where manager[i] is the direct manager of the i-th employee, manager, [headID] = -1. Also, it is guaranteed that the subordination relationships have a tree structure. The head of the company wants to info..

429. N-ary Tree Level Order Traversal
leetCode 2022. 7. 5. 08:39

문제 Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). n-ary 트리가 지정된 경우 해당 노드 값의 수준 순서 통과를 반환합니다. Nary-Tree 입력 직렬화는 레벨 순서 순회(traversal)로 표현되며, 각 자식 그룹은 null 값으로 구분됩니다(예제 참조). 예시 Example 1: Input: root = [1,null,3,2,4,null,5,6] ..

[Medium] 1367. Linked List in Binary Tree
leetCode 2022. 6. 15. 08:50

문제 Given a binary tree root and a linked list with head as the first node. Return True if all the elements in the linked list starting from the head correspond to some downward path connected in the binary tree otherwise return False. In this context downward path means a path that starts at some node and goes downwards. 이진 트리 루트와 헤드를 첫 번째 노드로 하는 링크된 목록이 제공됩니다. 머리글에서 시작하는 링크된 목록의 모든 요소가 이진 트리에 연..