[Codeforces] Round 776 (Div. 3) G. Counting ShortcutsRead more
[Codeforces] Round 778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) D. Potion Brewing ClassRead more
[Codeforces] 2021-2022 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred) J. Job LookupRead more
[CockroachDB] SQL Layer

SQL Layer

Read more
[LeetCode] Find Beautiful Indices in the Given Array II

3008. Find Beautiful Indices in the Given Array II

You are given a 0-indexed string s, a string a, a string b, and an integer k.

An index i is beautiful if:

  • 0 <= i <= s.length - a.length

  • s[i..(i + a.length - 1)] == a

  • There exists an index

1
j

such that:

  • 0 <= j <= s.length - b.length
  • s[j..(j + b.length - 1)] == b
  • |j - i| <= k

Return the array that contains beautiful indices in sorted order from smallest to largest.

Read more
[LeetCode] Maximum Number That Sum of the Prices Is Less Than or Equal to K

3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K

You are given an integer k and an integer x.

Consider s is the 1-indexed binary representation of an integer num. The price of a number num is the number of i‘s such that i % x == 0 and s[i] is a set bit.

Return the greatest integer num such that the sum of prices of all numbers from 1 to num is less than or equal to k.

Note:

  • In the binary representation of a number set bit is a bit of value 1.
  • The binary representation of a number will be indexed from right to left. For example, if s == 11100, s[4] == 1 and s[2] == 0.
Read more
[LeetCode] Find Beautiful Indices in the Given Array I

3006. Find Beautiful Indices in the Given Array I

You are given a 0-indexed string s, a string a, a string b, and an integer k.

An index i is beautiful if:

  • 0 <= i <= s.length - a.length

  • s[i..(i + a.length - 1)] == a

  • There exists an index

1
j

such that:

  • 0 <= j <= s.length - b.length
  • s[j..(j + b.length - 1)] == b
  • |j - i| <= k

Return the array that contains beautiful indices in sorted order from smallest to largest.

Read more
[LeetCode] Count Elements With Maximum Frequency

3005. Count Elements With Maximum Frequency

You are given an array nums consisting of positive integers.

Return the total frequencies of elements in nums such that those elements all have the maximum frequency.

The frequency of an element is the number of occurrences of that element in the array.

Read more
[Codeforces] Round 783 (Div. 1) B. Optimal PartitionRead more
[Codeforces] Educational Round 127 (Rated for Div. 2) E. PreorderRead more