#3271
Hash Divided String
pupil · 420 · lc medium +25 · 83.3% accepted · 109 likes · top 95%
Description
You are given string s of length n (multiple of k) and integer k. Split s into n / k chunks of length k. For each chunk, sum the alphabetical indices (a=0, ..., z=25), take mod 26, and map to the corresponding letter. Return the concatenated result.
Code
1
2
3