[Codeforces] Round 130 (Div. 2) C. Police StationRead more
[Codeforces] Round 131 (Div. 1) B. NumbersRead more
[Codeforces] Round 132 (Div. 2) D. Hot DaysRead more
[Hacker Earth] SprinklersRead more
[Hacker Earth] Unusual constructionRead more
[Hacker Earth] Similar numbersRead more
[Hacker Earth] TripletsRead more
[Hacker Earth] Alien AttackRead more
[LeetCode] String Transformation

2851. String Transformation

You are given two strings s and t of equal length n. You can perform the following operation on the string s:

  • Remove a suffix of s of length l where 0 < l < n and append it at the start of s.
    For example, let s = 'abcd' then in one operation you can remove the suffix 'cd' and append it in front of s making s = 'cdab'.

You are also given an integer k. Return the number of ways in which s can be transformed into t in exactly k operations.

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

Read more
[LeetCode] Minimum Moves to Spread Stones Over Grid

2850. Minimum Moves to Spread Stones Over Grid

You are given a 0-indexed 2D integer matrix grid of size 3 * 3, representing the number of stones in each cell. The grid contains exactly 9 stones, and there can be multiple stones in a single cell.

In one move, you can move a single stone from its current cell to any other cell if the two cells share a side.

Return the minimum number of moves required to place one stone in each cell.

Read more