[AtCoder] C - Just KRead more
[AtCoder] B - Make NRead more
[AtCoder] A - Trailing ZerosRead more
[Codeforces] Round #697 (Div. 3) C. Ball in BerlandRead more
[Codeforces] Round #702 (Div. 3) E. Accidental VictoryRead more
[Codeforces] Educational Round 105 (Rated for Div. 2) B. Berland CrosswordRead more
[Codeforces] April Fools Day Contest 2021 C. Fibonacci WordsRead more
[Codeforces] 2^SortRead more
[LeetCode] Largest 1-Bordered Square

1139. Largest 1-Bordered Square

Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn’t exist in the grid.

Read more
[LeetCode] Minimize Hamming Distance After Swap Operations

1722. Minimize Hamming Distance After Swap Operations

You are given two integer arrays, source and target, both of length n. You are also given an array allowedSwaps where each allowedSwaps[i] = [ai, bi] indicates that you are allowed to swap the elements at index ai and index bi (0-indexed) of array source. Note that you can swap elements at a specific pair of indices multiple times and in any order.

The Hamming distance of two arrays of the same length, source and target, is the number of positions where the elements are different. Formally, it is the number of indices i for 0 <= i <= n-1 where source[i] != target[i] (0-indexed).

Return the minimum Hamming distance of source and target after performing any amount of swap operations on array source.

Read more