Eat Study Love

먹고 공부하고 사랑하라

Dynamic Programming 17

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

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

Guess Number Higher or Lower II[Math,Dynamic Programming,Game Theory]

https://leetcode.com/problems/guess-number-higher-or-lower-ii/description/We are playing the Guessing Game. The game will work as follows:I pick a number between 1 and n.You guess a number.If you guess the right number, you win the game.If you guess the wrong number, then I will tell you whether the number I picked is higher or lower, and you will continue guessing.Every time you guess a wrong n..

Coding_Practice 2024.11.05