Minimize changes for k-periodic palindrome | Citadel
|Home/Coding & Algorithms/Citadel
Minimize changes for k-periodic palindrome
Citadel
Aug 4, 2025, 10:55 AM
Software Engineer
Take-home Project
Coding & Algorithms
0
0
Question
Given a string currentPassword (length N) and an integer k (1 ≤ k < N, N ≤ 2·10^5, lowercase letters, N divisible by k), find the minimum number of character changes needed to transform currentPassword into a newPassword such that
(
newPassword is a palindrome and
(
newPassword[i] = newPassword[i + k] for all valid i (k-periodic). Return that minimum number of changes.