All Posts

Leetcode 2241: Design an ATM Machine

Design an ATM machine that can handle deposits and withdrawals of five denominations: $20, $50, $100, $200, and $500. When withdrawing, the machine always tries to use the highest denominations available first. Implement methods to deposit money and withdraw specified amounts.

Leetcode 2259: Remove Digit From Number to Maximize Result

You are given a string number representing a positive integer and a character digit. Your task is to remove exactly one occurrence of digit from the string number such that the resulting number, when interpreted as an integer, is maximized. The test cases are guaranteed to have at least one occurrence of digit in the string.

Leetcode 2271: Maximum White Tiles Covered by a Carpet

You are given a 2D integer array tiles, where each element tiles[i] = [li, ri] represents that all integers from li to ri are painted white on a number line. Additionally, you are given an integer carpetLen, which represents the length of a carpet that can be placed anywhere on the number line. Your task is to return the maximum number of white tiles that can be covered by placing the carpet in a way that it maximizes the number of white tiles covered.

Leetcode 2279: Maximum Bags With Full Capacity of Rocks

You have n bags, each capable of holding a certain number of rocks. You are given two arrays: capacity where capacity[i] is the maximum number of rocks that bag i can hold, and rocks where rocks[i] is the current number of rocks in bag i. You also have additionalRocks which represents the number of rocks you can distribute into the bags. Your goal is to determine the maximum number of bags that can be filled to their capacity after placing the additional rocks in any of the bags.

Leetcode 2311: Longest Binary Subsequence Less Than or Equal to K

You are given a binary string s and a positive integer k. Your task is to find the length of the longest subsequence of s that represents a binary number less than or equal to k when converted to decimal.

Leetcode 2333: Minimum Sum of Squared Difference

You are given two integer arrays, nums1 and nums2, each of length n. You are also given two integers k1 and k2. Modify any element of nums1 or nums2 at most k1 or k2 times, respectively, to minimize the sum of squared differences between the two arrays.