[Codeforces] CodeTON Round 7 (Div. 1 + Div. 2, Rated, Prizes!) D. Ones and TwosRead more
[Codeforces] Round 908 (Div. 1) B. Neutral TonalityRead more
[Codeforces] Round 906 (Div. 1) B. Doremy`s Connecting PlanRead more
[Codeforces] Educational Round 156 (Rated for Div. 2) C. Decreasing StringRead more
[Codeforces] Round 904 (Div. 2) C. Medium DesignRead more
[LeetCode] Maximum Number of Potholes That Can Be Fixed

3119. Maximum Number of Potholes That Can Be Fixed

You are given a string road, consisting only of characters "x" and ".", where each "x" denotes a pothole and each "." denotes a smooth road, and an integer budget.

In one repair operation, you can repair n consecutive potholes for a price of n + 1.

Return the maximum number of potholes that can be fixed such that the sum of the prices of all of the fixes doesn’t go over the given budget.

Read more
[LeetCode] Find the Index of Permutation

3109. Find the Index of Permutation

Given an array perm of length n which is a permutation of [1, 2, ..., n], return the index of perm in the lexicographically sorted array of all of the permutations of [1, 2, ..., n].

Since the answer may be very large, return it modulo 109 + 7.

Read more
[LeetCode] Island Perimeter

463. Island Perimeter

You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water.

grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells).

The island doesn’t have “lakes”, meaning the water inside isn’t connected to the water around the island. One cell is a square with side length 1. The grid is rectangular, width and height don’t exceed 100. Determine the perimeter of the island.

Read more
[Codeforces] Round 905 (Div. 3) E. Look BackRead more
[Codeforces] Round 903 (Div. 3) F. Minimum Maximum DistanceRead more