Eat Study Love

먹고 공부하고 사랑하라

Coding_Practice 177

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

Unique Binary Search Trees(Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree)

https://leetcode.com/problems/unique-binary-search-trees/description/Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. Example 1:Input: n = 3Output: 5Example 2:Input: n = 1Output: 1 Constraints:1 그래도 가볍게나마 BST문제도 풀어봐야지..! Linked List , Tree 이런 걸 자꾸만 건들자 근데 이건,, Tree 문제라기보단 수학 문제 같다.. 흐음..  1. Python 일단..

Coding_Practice 2025.01.06

Minimum Number of Operations to Move All Balls to Each Box(Array,String,Prefix Sum)

https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/description/?envType=daily-question&envId=2025-01-06You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empty, and '1' if it contains one ball.In one operation, you can move one ball from a box to an adjacent box. Box i is adjacent to box j if abs(i - j)..

Coding_Practice 2025.01.06