코딩테스트/프로그래머스[모든문제Lv.0]

잘라서 배열로 저장하기

두퍼 2023. 3. 31. 13:26

1. Clarifying Questions

2. Optimized Solution

3. Code

def solution(my_str, n):
    answer = []
    cnt = len(my_str)
    
    for i in range(0, cnt, n):
        answer.append(my_str[i:i+n])
    
    return answer