2138. Divide a String Into Groups of Size k

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2138

class Solution:
    def divideString(self, s: str, k: int, fill: str) -> List[str]:
        return [s[i : i + k].ljust(k, fill) for i in range(0, len(s), k)]