[LeetCode] Add Minimum Number of Rungs

1936. Add Minimum Number of Rungs

You are given a strictly increasing integer array rungs that represents the height of rungs on a ladder. You are currently on the floor at height 0, and you want to reach the last rung.

You are also given an integer dist. You can only climb to the next highest rung if the distance between where you are currently at (the floor or on a rung) and the next rung is at most dist. You are able to insert rungs at any positive integer height if a rung is not already there.

Return the minimum number of rungs that must be added to the ladder in order for you to climb to the last rung.

Read more
[LeetCode] Minimum Total Space Wasted With K Resizing Operations

1959. Minimum Total Space Wasted With K Resizing Operations

You are currently designing a dynamic array. You are given a 0-indexed integer array nums, where nums[i] is the number of elements that will be in the array at time i. In addition, you are given an integer k, the maximum number of times you can resize the array (to any size).

The size of the array at time t, sizet, must be at least nums[t] because there needs to be enough space in the array to hold all the elements. The space wasted at time t is defined as sizet - nums[t], and the total space wasted is the sum of the space wasted across every time t where 0 <= t < nums.length.

Return the minimum total space wasted if you can resize the array at most k times.

Note: The array can have any size at the start and does not count towards the number of resizing operations.

Read more
[LeetCode] Maximum Matrix Sum

1975. Maximum Matrix Sum

You are given an n x n integer matrix. You can do the following operation any number of times:

  • Choose any two adjacent elements of matrix and multiply each of them by -1.
    Two elements are considered adjacent if and only if they share a border.

Your goal is to maximize the summation of the matrix’s elements. Return the maximum sum of the matrix’s elements using the operation mentioned above.

Read more
[AtCoder] D - Axis-Parallel RectangleRead more
[AtCoder] C - BridgeRead more
[AtCoder] C - Dubious Document 2Read more
[AtCoder] C - Snuke FestivalRead more
[AtCoder] B - Problem SetRead more
[Codeforces] Hello 2022 B. Integers ShopRead more
[Codeforces] Round #768 (Div. 1) A. And MatchingRead more