[LeetCode] Count Substrings That Satisfy K-Constraint I

3258. Count Substrings That Satisfy K-Constraint I

You are given a binary string s and an integer k.

A binary string satisfies the k-constraint if either of the following conditions holds:

  • The number of 0‘s in the string is at most k.
  • The number of 1‘s in the string is at most k.

Return an integer denoting the number of substrings of s that satisfy the k-constraint.

Read more
[Codeforces] Codeforces Round 920 (Div. 3) F. Sum of ProgressionRead more
[Codeforces] Codeforces Round 919 (Div. 2) D. Array RepetitionRead more
[LeetCode] Maximum Value Sum by Placing Three Rooks II

3257. Maximum Value Sum by Placing Three Rooks II

You are given a m x n 2D array board representing a chessboard, where board[i][j] represents the value of the cell (i, j).

Rooks in the same row or column attack each other. You need to place three rooks on the chessboard such that the rooks do not attack each other.

Return the maximum sum of the cell values on which the rooks are placed.

Read more
[LeetCode] Maximum Value Sum by Placing Three Rooks I

3256. Maximum Value Sum by Placing Three Rooks I

You are given a m x n 2D array board representing a chessboard, where board[i][j] represents the value of the cell (i, j).

Rooks in the same row or column attack each other. You need to place three rooks on the chessboard such that the rooks do not attack each other.

Return the maximum sum of the cell values on which the rooks are placed.

Read more
[LeetCode] Find the Power of K-Size Subarrays II

3255. Find the Power of K-Size Subarrays II

You are given an array of integers nums of length n and a positive integer k.

The power of an array is defined as:

  • Its maximum element if all of its elements are consecutive and sorted in ascending order.
  • -1 otherwise.

You need to find the power of all subarrays of nums of size k.

Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Read more
[LeetCode] Find the Power of K-Size Subarrays I

3254. Find the Power of K-Size Subarrays I

You are given an array of integers nums of length n and a positive integer k.

The power of an array is defined as:

  • Its maximum element if all of its elements are consecutive and sorted in ascending order.
  • -1 otherwise.

You need to find the power of all subarrays of nums of size k.

Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Read more
[Codeforces] Round 922 (Div. 2) D. Blocking ElementsRead more
[Codeforces] Round 916 (Div. 3) F. Programming CompetitionRead more
[Codeforces] 2023-2024 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred) D. Divisibility TestRead more