Eat Study Love

먹고 공부하고 사랑하라

코딩테스트 65

Insert Greatest Common Divisors in Linked List[M,Linked List,Math,Number Theory]

https://leetcode.com/problems/insert-greatest-common-divisors-in-linked-list/description/?envType=daily-question&envId=2024-09-10Given the head of a linked list head, in which each node contains an integer value.Between every pair of adjacent nodes, insert a new node with a value equal to the greatest common divisor of them.Return the linked list after insertion.The greatest common divisor of tw..

Coding_Practice 2024.09.10

Count Good Nodes in Binary Tree[Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/count-good-nodes-in-binary-tree/Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.Return the number of good nodes in the binary tree. Example 1:Input: root = [3,1,4,3,null,1,5]Output: 4Explanation: Nodes in blue are good.Root Node (3) is always a good node.Node 4 -> (3,4) is the ..

Coding_Practice 2024.09.09

Number of Good Leaf Nodes Pairs[Tree,Depth-First Search,Binary Tree]

https://leetcode.com/problems/number-of-good-leaf-nodes-pairs/description/You are given the root of a binary tree and an integer distance. A pair of two different leaf nodes of a binary tree is said to be good if the length of the shortest path between them is less than or equal to distance.Return the number of good leaf node pairs in the tree. Example 1:Input: root = [1,2,3,null,4], distance = ..

Coding_Practice 2024.09.09

Sum of Digits of String After Convert[E,String,Simulation]

https://leetcode.com/problems/sum-of-digits-of-string-after-convert/description/?envType=daily-question&envId=2024-09-03You are given a string s consisting of lowercase English letters, and an integer k.First, convert s into an integer by replacing each letter with its position in the alphabet (i.e., replace 'a' with 1, 'b' with 2, ..., 'z' with 26). Then, transform the integer by replacing it w..

Coding_Practice 2024.09.03

Add One Row to Tree[M,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/add-one-row-to-tree/?envType=daily-question&envId=2024-08-23Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth.Note that the root node is at depth 1.The adding rule is:Given the integer depth, for each not null tree node cur at the depth depth - 1, create two tree nodes with value val as cur's l..

Coding_Practice 2024.08.23

Maximum Width of Binary Tree[M,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/maximum-width-of-binary-tree/description/Given the root of a binary tree, return the maximum width of the given tree.The maximum width of a tree is the maximum width among all levels.The width of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-nodes that would be present in a ..

Coding_Practice 2024.08.22

Same Tree[E,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/same-tree/description/Given the roots of two binary trees p and q, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1:Input: p = [1,2,3], q = [1,2,3]Output: trueExample 2:Input: p = [1,2], q = [1,null,2]Output: falseExample 3:Input: p = [1,2,1..

Coding_Practice 2024.08.22