Eat Study Love

먹고 공부하고 사랑하라

코딩 57

Minimum String Length After Removing Substrings[E,StringStackSimulation]

https://leetcode.com/problems/minimum-string-length-after-removing-substrings/description/?envType=daily-question&envId=2024-10-07You are given a string s consisting only of uppercase English letters.You can apply some operations to this string where, in one operation, you can remove any occurrence of one of the substrings "AB" or "CD" from s.Return the minimum possible length of the resulting s..

Coding_Practice 2024.10.07

Sum of Prefix Scores of Strings[Array,String,Trie,Counting]

https://leetcode.com/problems/sum-of-prefix-scores-of-strings/description/?envType=daily-question&envId=2024-09-25You are given an array words of size n consisting of non-empty strings.We define the score of a string word as the number of strings words[i] such that word is a prefix of words[i].For example, if words = ["a", "ab", "abc", "cab"], then the score of "ab" is 2, since "ab" is a prefix ..

Coding_Practice 2024.09.25

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

Delete Nodes From Linked List Present in Array[Array,Hash Table,Linked List]

https://leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/description/You are given an array of integers nums and the head of a linked list. Return the head of the modified linked list after removing all nodes from the linked list that have a value that exists in nums. Example 1:Input: nums = [1,2,3], head = [1,2,3,4,5]Output: [4,5]Explanation:Remove the nodes with values 1, 2..

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

Best Time to Buy and Sell Stock II[M,Array,Dynamic Programming,Greedy]

https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/You are given an integer array prices where prices[i] is the price of a given stock on the ith day.On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.Find and return the maximum profit yo..

Coding_Practice 2024.08.20