All Posts

Leetcode 2952: Minimum Number of Coins to be Added

You are given a list of coin denominations and a target value. Your task is to determine the minimum number of new coin denominations you need to add to the list, so that every integer value from 1 to the target can be formed as a sum of some subset of the coins. A coin denomination can be added if it helps form values that cannot be formed using the existing coins.

Leetcode 2957: Remove Adjacent Almost-Equal Characters

You are given a 0-indexed string word. In each operation, you can change any character of word to a lowercase English letter. Two characters are considered almost-equal if they are the same or adjacent in the alphabet. Your task is to remove all adjacent almost-equal characters with the minimum number of operations.

Leetcode 2958: Length of Longest Subarray With at Most K Frequency

You are given an integer array nums and an integer k. The frequency of an element is the number of times it appears in the array. A subarray is called good if the frequency of each element in it is less than or equal to k. Your task is to return the length of the longest good subarray in nums.

Leetcode 2961: Double Modular Exponentiation

Given a 2D array variables where each element is a list of integers [a, b, c, m], and an integer target, find the indices where the formula (a * b % 10) ^ c % m equals the target. Return a list of these indices.

Leetcode 2962: Count Subarrays Where Max Element Appears at Least K Times

Given an integer array nums and a positive integer k, count how many subarrays contain the maximum element of the array at least k times.

Leetcode 2966: Divide Array Into Arrays With Max Difference

You are given an array nums of size n where n is a multiple of 3, and a positive integer k. Your task is to divide the array into n / 3 subarrays, each containing exactly 3 elements, such that the difference between the largest and smallest element in each subarray is less than or equal to k. If it’s possible to divide the array in this way, return a 2D array containing the subarrays. If it is not possible, return an empty array. If multiple valid divisions exist, return any valid one.