Eat Study Love

먹고 공부하고 사랑하라

C 159

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

Count Complete Tree Nodes[Binary Search,Bit Manipulation,Tree,Binary Tree]

https://leetcode.com/problems/count-complete-tree-nodes/description/Given the root of a complete binary tree, return the number of the nodes in the tree.According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.Design a..

Coding_Practice 2024.09.26

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

Find the Length of the Longest Common Prefix[M,Array,Hash Table,String,Trie]

https://leetcode.com/problems/find-the-length-of-the-longest-common-prefix/description/?envType=daily-question&envId=2024-09-24You are given two arrays with positive integers arr1 and arr2.A prefix of a positive integer is an integer formed by one or more of its digits, starting from its leftmost digit. For example, 123 is a prefix of the integer 12345, while 234 is not.A common prefix of two in..

Coding_Practice 2024.09.24

Palindrome Linked List[Linked List,Two Pointers,Stack,Recursion]

https://leetcode.com/problems/palindrome-linked-list/description/Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1:Input: head = [1,2,2,1]Output: trueExample 2:Input: head = [1,2]Output: false Constraints:The number of nodes in the list is in the range [1, 105].0  Follow up: Could you do it in O(n) time and O(1) space? 해당 문제를 Recursion / Data..

Coding_Practice 2024.09.23

Extra Characters in a String[Array,Hash Table,String,Dynamic Programming,Trie]

https://leetcode.com/problems/extra-characters-in-a-string/description/?envType=daily-question&envId=2024-09-23You are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that each substring is present in dictionary. There may be some extra characters in s which are not present in any of the substrings.Return the m..

Coding_Practice 2024.09.23

Remove Duplicates from Sorted List II[Linked List,Two Pointers]

https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as well. Example 1:Input: head = [1,2,3,3,4,4,5]Output: [1,2,5]Example 2:Input: head = [1,1,1,2,3]Output: [2,3] Constraints:The number of nodes in t..

Coding_Practice 2024.09.22

Count the Number of Consistent Strings[E,Array,Hash Table,String,Bit Manipulation,Counting]

https://leetcode.com/problems/count-the-number-of-consistent-strings/description/?envType=daily-question&envId=2024-09-12You are given a string allowed consisting of distinct characters and an array of strings words. A string is consistent if all characters in the string appear in the string allowed.Return the number of consistent strings in the array words. Example 1:Input: allowed = "ab", word..

Coding_Practice 2024.09.12