8000 * Done with "2138. Divide a String Into Groups of Size k". · garciparedes/leetcode@f1e5083 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1e5083

Browse files
committed
* Done with "2138. Divide a String Into Groups of Size k".
1 parent e01c62d commit f1e5083

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def divideString(self, s: str, k: int, fill: str) -> List[str]:
3+
ans = list()
4+
for i in range(0, len(s), k):
5+
tmp = s[i:i+k]
6+
while len(tmp) < k:
7+
tmp += fill
8+
ans.append(tmp)
9+
return ans

0 commit comments

Comments
 (0)
0