# 22.06.2025 [2138. Divide a String Into Groups of Size k]
Автор: KittyCat, Keyboard and LeetCode
Загружено: 2025-06-22
Просмотров: 11
Описание:
22.06.2025
[2138. Divide a String Into Groups of Size k](https://leetcode.com/problems/divide-...) easy
[blog post](https://leetcode.com/problems/divide-...)
[substack](https://open.substack.com/pub/dmitrii...)
[youtube]( • # 22.06.2025 [2138. Divide a String Into G... )

#### Join me on Telegram
https://t.me/leetcode_daily_unstoppab...
#### Problem TLDR
k-chunked string, filled tail #easy
#### Intuition
Pad then chunk, or chunk then pad. Prefill everything, or write a precise filling code. Great task to learn the language built-ins.
#### Approach
if you know Kotlin `padEnd` & `chunked` you don't have to think
Rust doesn't allow `fmt` with dynamic fill character
`1 + (size - 1) / k` or `(k + size - 1) / k` will pad to `% k`
Kotln / Java `String` has `CharArray` constructor arguments
Rust has `resize` to pad-fill a `Vec`
#### Complexity
Time complexity:
$$O(n)$$
Space complexity:
$$O(n)$$
#### Code
https://dmitrysamoylenko.com/2023/07/...
Повторяем попытку...
![# 22.06.2025 [2138. Divide a String Into Groups of Size k]](https://ricktube.ru/thumbnail/TUiVCSC3H_I/hq720.jpg)
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: