728x90 반응형 SMALL programming389 프로그래머스) 배열 뒤집기 def solution(num_list): answer = [] for i in range(len(num_list)): answer = num_list[::-1] return answer 2024. 5. 22. 프로그래머스) 문자열 밀기 def solution(A, B): if A == B: return 0 N = len(A) for i in range(1, N): is_equal = True for j in range(N): if A[j] != B[(i + j) % N]: is_equal = False break if is_equal == True: return i return -1 2024. 5. 21. 프로그래머스) 문자열 나누기 # def solution(s): # count = 0 # # def split_string(s_t): # pass # # split_string(s) # return answer # 기본 골자 구조 def solution(s): x = s[0] count_x = 1 count_nx = 0 result,divide = 0,0 # x와 x가 아닌 문자 정리 for i in range(len(s)): if x not in s[i]: count_nx += 1 else: if x in s[1:i]: count_x += 1 # x, nx 비교 -> 같을 시 정지 및 문자열 분리 if count_x == count_nx: divide = s.split(x) break else: divide = s.split(x) .. 2024. 5. 20. 프로그래머스) 문자열 겹쳐쓰 def solution(my_string, overwrite_string, s): my_string = list(my_string) for i in range(len(overwrite_string)): my_string[s] = overwrite_string[i] s += 1 answer = ''.join(my_string) return answer 2024. 5. 19. 이전 1 ··· 67 68 69 70 71 72 73 ··· 98 다음 728x90 반응형 LIST