[LeetCode] Number of Equal Count Substrings

2067. Number of Equal Count Substrings

You are given a 0-indexed string s consisting of only lowercase English letters, and an integer count. A substring of s is said to be an equal count substring if, for each unique letter in the substring, it appears exactly count times in the substring.

Return the number of equal count substrings in s.

A substring is a contiguous non-empty sequence of characters within a string.

Read more
[LeetCode] Remove Stones to Minimize the Total

1962. Remove Stones to Minimize the Total

You are given a 0-indexed integer array piles, where piles[i] represents the number of stones in the ith pile, and an integer k. You should apply the following operation exactly k times:

  • Choose any piles[i] and remove floor(piles[i] / 2) stones from it.

Notice that you can apply the operation on the same pile more than once.

Return the minimum possible total number of stones remaining after applying the k operations.

floor(x) is the greatest integer that is smaller than or equal to x (i.e., rounds x down).

Read more
[LeetCode] Valid Permutations for DI Sequence

903. Valid Permutations for DI Sequence

You are given a string s of length n where s[i] is either:

  • ‘D’ means decreasing, or
  • ‘I’ means increasing.

A permutation perm of n + 1 integers of all the integers in the range [0, n] is called a valid permutation if for all valid i:

  • If s[i] == ‘D’, then perm[i] > perm[i + 1], and
  • If s[i] == ‘I’, then perm[i] < perm[i + 1].

Return the number of valid permutations perm. Since the answer may be large, return it modulo 109 + 7.

Read more
[AtCoder] D - 2017-like NumberRead more
[AtCoder] C - Special TrainsRead more
[AtCoder] D - Katana ThrowerRead more
[AtCoder] C - OtoshidamaRead more
[AtCoder] D - People on a LineRead more
[Codeforces] School Team Contest #3 (Winter Computer School 2010/11) I. TCMCF+++Read more
[Codeforces] Beta Round #56 B. Serial Time!Read more