Eat Study Love

먹고 공부하고 사랑하라

C 157

First Completely Painted Row or Column(Array,Hash Table,Matrix)

https://leetcode.com/problems/first-completely-painted-row-or-column/description/?envType=daily-question&envId=2025-01-20You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n].Go through each index i in arr starting from index 0 and paint the cell in mat containing the integer arr[i].Return the smallest inde..

Coding_Practice 2025.01.20

Trapping Rain Water II(Array,Breadth-First Search,Heap (Priority Queue),Matrix)

https://leetcode.com/problems/trapping-rain-water-ii/?envType=daily-question&envId=2025-01-19 Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. Example 1:Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]Output: 4Explanation: After the rain, water is trapped between the blocks..

Coding_Practice 2025.01.19

Number of Music Playlists(Math,Dynamic Programming,Combinatorics)

https://leetcode.com/problems/number-of-music-playlists/description/ Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:Every song is played at least once.A song can only be played again only if k other songs have been played.Given n, goal, and k, return the number of po..

Coding_Practice 2025.01.16

Find the Prefix Common Array of Two Arrays(Array,Hash Table,Bit Manipulation)

https://leetcode.com/problems/find-the-prefix-common-array-of-two-arrays/description/?envType=daily-question&envId=2025-01-14You are given two 0-indexed integer permutations A and B of length n.A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present at or before the index i in both A and B.Return the prefix common array of A and B.A sequenc..

Coding_Practice 2025.01.14

Minimum Length of String After Operations(Hash Table,String,Counting)

https://leetcode.com/problems/minimum-length-of-string-after-operations/description/?envType=daily-question&envId=2025-01-13You are given a string s.You can perform the following process on s any number of times:Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one character to the right that is also equal to s[i]..

Coding_Practice 2025.01.13

Longest Palindrome Substring [Final 기출]

사실 Palindrome 문제는 유형도 많고, DP를 이용해서 풀면 편하지만 너~무 짜친다. 아오 하기 싫어! Longest Palindrome Substring(이하 LPS) 문제를 2개 풀게 됐는데, 하나는 10초컷 / 하나는 30분을 고민해도 어렵다.. 쉬운 문제는 아래와 같다.def is_palindromic(s: str) -> bool: """ > input 's' - A string consisting of only lowercase English letters (1 return a boolean """ # WRITE YOUR CODE HERE n = len(s) left = 0 right = n-1 while left  그냥 input에 대해..

Coding_Practice 2025.01.07