All Posts

Leetcode 1827: Minimum Operations to Make the Array Increasing

You are given an integer array nums. In one operation, you can increment any element of the array by 1. The goal is to make the array strictly increasing, meaning that each element should be smaller than the next. Return the minimum number of operations required to achieve this.

Leetcode 1833: Maximum Ice Cream Bars

A boy wants to buy as many ice cream bars as possible, given their prices and the number of coins he has. Determine the maximum number of ice cream bars he can purchase without exceeding his budget.

Leetcode 1838: Frequency of the Most Frequent Element

You are given an integer array nums and an integer k. In one operation, you can increment any element of the array by 1. Your task is to return the maximum possible frequency of any element after performing at most k operations.

Leetcode 1846: Maximum Element After Decreasing and Rearranging

You are given an array of positive integers arr. Perform a series of operations (possibly none) on arr to make it satisfy the following conditions: The value of the first element in arr must be 1, and the absolute difference between any two adjacent elements must be less than or equal to 1. You can decrease the value of any element and rearrange the elements in any order. Return the maximum possible value of an element in arr after performing the operations.

Leetcode 1850: Minimum Adjacent Swaps to Reach the Kth Smallest Number

You are given a string num, representing a large integer, and an integer k. Return the minimum number of adjacent swaps required to transform num into the k-th smallest wonderful integer that is greater than num and is a permutation of its digits.

Leetcode 1877: Minimize Maximum Pair Sum in Array

Given an array nums of even length n, your task is to pair up the elements of the array into n / 2 pairs such that the maximum pair sum is minimized. A pair sum is defined as the sum of two elements in a pair. The goal is to minimize the largest of these pair sums.