Eat Study Love

먹고 공부하고 사랑하라

코딩공부 55

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

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

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

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

Find the Student that Will Replace the Chalk[M,Array,Binary Search,Simulation,Prefix Sum]

https://leetcode.com/problems/find-the-student-that-will-replace-the-chalk/description/?envType=daily-question&envId=2024-09-02There are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the student number 0, then the student number 1, and so on until the teacher reaches the student number n - 1. After that, the teacher will restart the pr..

Coding_Practice 2024.09.02

Rotate List[Linked List,Two Pointers]

https://leetcode.com/problems/rotate-list/description/Given the head of a linked list, rotate the list to the right by k places. Example 1:Input: head = [1,2,3,4,5], k = 2Output: [4,5,1,2,3]Example 2:Input: head = [0,1,2], k = 4Output: [2,0,1] Constraints:The number of nodes in the list is in the range [0, 500].-100 0 1. C또 Naive하게 했다가 얻어 맞은 Time Limit ㅠㅠC는 빠른 언어라 상관 없을 줄 알았는데 얄짤 없네/** * Definit..

Coding_Practice 2024.08.20

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