Eat Study Love

먹고 공부하고 사랑하라

코딩테스트 65

Sort List[Linked List,Two Pointers,Divide and Conquer,Sorting,Merge Sort]

https://leetcode.com/problems/sort-list/description/Given the head of a linked list, return the list after sorting it in ascending order. Example 1:Input: head = [4,2,1,3]Output: [1,2,3,4]Example 2:Input: head = [-1,5,3,4,0]Output: [-1,0,3,4,5]Example 3:Input: head = []Output: [] Constraints:The number of nodes in the list is in the range [0, 5 * 104].-105  Follow up: Can you sort the linked lis..

Coding_Practice 2024.10.10

Minimum Add to Make Parentheses Valid[M,String,Stack,Greedy]

https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/description/?envType=daily-question&envId=2024-10-09A parentheses string is valid if and only if:It is the empty string,It can be written as AB (A concatenated with B), where A and B are valid strings, orIt can be written as (A), where A is a valid string.You are given a parentheses string s. In one move, you can insert a parent..

Coding_Practice 2024.10.09

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

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

Count the Number of Good Subarrays[M,Array,Hash Table,Sliding Window]

https://leetcode.com/problems/count-the-number-of-good-subarrays/description/Given an integer array nums and an integer k, return the number of good subarrays of nums.A subarray arr is good if it there are at least k pairs of indices (i, j) such that i  and arr[i] == arr[j].A subarray is a contiguous non-empty sequence of elements within an array. Example 1:Input: nums = [1,1,1,1,1], k = 10Outpu..

Coding_Practice 2024.09.11