Eat Study Love

먹고 공부하고 사랑하라

Coding_Practice 168

Removing Minimum Number of Magic Beans[M,Array,Greedy,Sorting,Enumeration,Prefix Sum]

https://leetcode.com/problems/removing-minimum-number-of-magic-beans/description/You are given an array of positive integers beans, where each integer represents the number of magic beans found in a particular magic bag.Remove any number of beans (possibly none) from each bag such that the number of beans in each remaining non-empty bag (still containing at least one bean) is equal. Once a bean ..

Coding_Practice 2024.07.26

Longest Non-decreasing Subarray From Two Arrays[M,Array,Dynamic Programming]

https://leetcode.com/problems/longest-non-decreasing-subarray-from-two-arrays/You are given two 0-indexed integer arrays nums1 and nums2 of length n.Let's define another 0-indexed integer array, nums3, of length n. For each index i in the range [0, n - 1], you can assign either nums1[i] or nums2[i] to nums3[i].Your task is to maximize the length of the longest non-decreasing subarray in nums3 by..

Coding_Practice 2024.07.24

Sell Diminishing-Valued Colored Balls[M,Array,Math,Binary Search,Greedy,Sorting,Heap (Priority Queue)]

https://leetcode.com/problems/sell-diminishing-valued-colored-balls/You have an inventory of different colored balls, and there is a customer that wants orders balls of any color.The customer weirdly values the colored balls. Each colored ball's value is the number of balls of that color you currently have in your inventory. For example, if you own 6 yellow balls, the customer would pay 6 for th..

Coding_Practice 2024.07.23