All Posts

Leetcode 2335: Minimum Amount of Time to Fill Cups

You have a water dispenser that dispenses cold, warm, and hot water. Every second, you can either fill up 2 cups with different types of water, or 1 cup of any type of water. You are given an array ‘amount’ where amount[0], amount[1], and amount[2] represent the number of cold, warm, and hot water cups you need to fill, respectively. Your task is to determine the minimum number of seconds required to fill all the cups.

Leetcode 2341: Maximum Number of Pairs in Array

You are given an integer array nums. In one operation, you can choose two integers in the array that are the same and remove both. The operation is repeated as many times as possible. Return an array where the first element is the number of pairs formed, and the second element is the number of leftover integers.

Leetcode 2342: Max Sum of a Pair With Equal Sum of Digits

You are given an array nums of positive integers. You need to find two indices i and j such that i != j, and the sum of digits of the numbers nums[i] and nums[j] is the same. Return the maximum sum of nums[i] + nums[j] that you can obtain over all valid pairs of indices. If no such pair exists, return -1.

Leetcode 2343: Query Kth Smallest Trimmed Number

You are given a list nums where each string contains digits of the same length. Additionally, you are provided a list of queries, where each query is represented by two integers [ki, trimi]. For each query, trim each number in nums to its rightmost trimi digits, then find the index of the kith smallest trimmed number. If two numbers are identical after trimming, the one with the lower index is considered smaller. Reset the numbers in nums for the next query.

Leetcode 2347: Best Poker Hand

You are given an integer array ranks and a character array suits. These represent a set of 5 playing cards, where each card has a rank (from 1 to 13) and a suit (one of ‘a’, ‘b’, ‘c’, or ’d’). Determine the best possible poker hand you can make from the cards.

Leetcode 2348: Number of Zero-Filled Subarrays

You are given an integer array nums. Your task is to determine the total number of subarrays that consist entirely of zeroes.