All Posts

Leetcode 1432: Max Difference You Can Get From Changing an Integer

You are given an integer num and you must apply a set of operations twice to generate two new integers. The goal is to find the maximum difference between the results of these operations.

Leetcode 1433: Check If a String Can Break Another String

You are given two strings s1 and s2 of the same length. You need to check if some permutation of s1 can ‘break’ some permutation of s2, or vice-versa. A string x can break string y if for every character at position i, x[i] >= y[i] when sorted alphabetically.

Leetcode 1465: Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts

You are given a rectangular cake of size h x w. There are two arrays of integers, horizontalCuts and verticalCuts. Each element in horizontalCuts represents a horizontal cut, and each element in verticalCuts represents a vertical cut. Your task is to find the maximum area of a piece of cake that can be obtained after making all the cuts specified in the arrays. Since the result can be a large number, return it modulo 10^9 + 7.

Leetcode 1481: Least Number of Unique Integers after K Removals

You are given an array of integers arr and an integer k. You need to remove exactly k elements from the array and find the minimum number of unique integers that remain in the array.

Leetcode 1488: Avoid Flood in The City

Your country has an infinite number of lakes. Initially, all the lakes are dry, but on the nth day, the nth lake fills up with water. If it rains over a lake that is already full, there will be a flood. You need to avoid flooding by drying out lakes on some days when there is no rain.

Leetcode 1509: Minimum Difference Between Largest and Smallest Value in Three Moves

You are given an integer array. In one move, you can change any element of the array to any value. Perform at most three moves to minimize the difference between the largest and smallest values of the array.