[Hacker Earth] Moving peopleRead more
[Hacker Earth] Maximizing expressionsRead more
[Codeforces] Round 584 - Dasha Code Championship - Elimination Round (rated, open for everyone, Div. 1 + Div. 2) E2. Rotate Columns (hard version)Read more
[Codeforces] Round 584 - Dasha Code Championship - Elimination Round (rated, open for everyone, Div. 1 + Div. 2) E1. Rotate Columns (easy version)Read more
[Codeforces] Round 584 - Dasha Code Championship - Elimination Round (rated, open for everyone, Div. 1 + Div. 2) G1. Into Blocks (easy version)Read more
[Codeforces] Dasha Code Championship - SPb Finals Round (only for onsite-finalists) C. Kamil and Making a StreamRead more
[Codeforces] Round 583 (Div. 1 + Div. 2, based on Olympiad of Metropolises) E. Petya and Construction SetRead more
[LeetCode] Minimum Changes to Make K Semi-palindromes

2911. Minimum Changes to Make K Semi-palindromes

Given a string s and an integer k, partition s into k substrings such that the sum of the number of letter changes required to turn each substring into a semi-palindrome is minimized.

Return an integer denoting the minimum number of letter changes required.

Notes

  • A string is a palindrome if it can be read the same way from left to right and right to left.
  • A string with a length of len is considered a semi-palindrome if there exists a positive integer d such that 1 <= d < len and len % d == 0, and if we take indices that have the same modulo by d, they form a palindrome. For example, "aa", "aba", "adbgad", and, "abab" are semi-palindrome and "a", "ab", and, "abca" are not.
  • A substring is a contiguous sequence of characters within a string.
Read more
[LeetCode] Minimum Number of Groups to Create a Valid Assignment

2910. Minimum Number of Groups to Create a Valid Assignment

You are given a 0-indexed integer array nums of length n.

We want to group the indices so for each index i in the range [0, n - 1], it is assigned to exactly one group.

A group assignment is valid if the following conditions hold:

  • For every group g, all indices i assigned to group g have the same value in nums.
  • For any two groups g1 and g2, the difference between the number of indices assigned to g1 and g2 should not exceed 1.

Return an integer denoting the minimum number of groups needed to create a valid group assignment.

Read more
[LeetCode] Minimum Sum of Mountain Triplets II

2909. Minimum Sum of Mountain Triplets II

You are given a 0-indexed array nums of integers.

A triplet of indices (i, j, k) is a mountain if:

  • i < j < k
  • nums[i] < nums[j] and nums[k] < nums[j]

Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.

Read more