2911. Minimum Changes to Make K Semi-palindromes
Given a string
sand an integerk, partitionsintoksubstrings 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
lenis considered a semi-palindrome if there exists a positive integerdsuch that1 <= d < lenandlen % d == 0, and if we take indices that have the same modulo byd, 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.
2910. Minimum Number of Groups to Create a Valid Assignment
You are given a 0-indexed integer array
numsof lengthn.We want to group the indices so for each index
iin 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 indicesiassigned to groupghave the same value innums.- For any two groups
g1andg2, the difference between the number of indices assigned tog1andg2should not exceed1.Return an integer denoting the minimum number of groups needed to create a valid group assignment.
2909. Minimum Sum of Mountain Triplets II
You are given a 0-indexed array
numsof integers.A triplet of indices
(i, j, k)is a mountain if:
i < j < knums[i] < nums[j]andnums[k] < nums[j]Return the minimum possible sum of a mountain triplet of
nums. If no such triplet exists, return-1.