[LeetCode] Find All Possible Stable Binary Arrays II

3130. Find All Possible Stable Binary Arrays II

You are given 3 positive integers zero, one, and limit.

A binary array arr is called stable if:

  • The number of occurrences of 0 in arr is exactly zero.
  • The number of occurrences of 1 in arr is exactly one.
  • Each subarray of arr with a size greater than limit must contain both 0 and 1.

Return the total number of stable binary arrays.

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

Read more
[LeetCode] Find All Possible Stable Binary Arrays I

3129. Find All Possible Stable Binary Arrays I

You are given 3 positive integers zero, one, and limit.

A binary array arr is called stable if:

  • The number of occurrences of 0 in arr is exactly zero.
  • The number of occurrences of 1 in arr is exactly one.
  • Each subarray of arr with a size greater than limit must contain both 0 and 1.

Return the total number of stable binary arrays.

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

Read more
[LeetCode] Right Triangles

3128. Right Triangles

You are given a 2D boolean matrix grid.

Return an integer that is the number of right triangles that can be made with the 3 elements of grid such that all of them have a value of 1.

Note:

  • A collection of 3 elements of grid is a right triangle if one of its elements is in the same row with another element and in the same column with the third element. The 3 elements do not have to be next to each other.
Read more
[LeetCode] Make a Square with the Same Color

3127. Make a Square with the Same Color

You are given a 2D matrix grid of size 3 x 3 consisting only of characters 'B' and 'W'. Character 'W' represents the white color, and character 'B' represents the black color.

Your task is to change the color of at most one cell so that the matrix has a 2 x 2 square where all cells are of the same color.

Return true if it is possible to create a 2 x 2 square of the same color, otherwise, return false.

Read more
[Codeforces] Educational Round 161 (Rated for Div. 2) E. Increasing SubsequencesRead more
[Codeforces] Round 920 (Div. 3) E. Eat the ChipRead more
[Codeforces] Round 919 (Div. 2) C. Partitioning the ArrayRead more
[Codeforces] Round 917 (Div. 2) C. Watering an ArrayRead more
[Codeforces] Good Bye 2023 D. Mathematical ProblemRead more
[Codeforces] Round 918 (Div. 4) G. BicyclesRead more