-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fcb99c
commit f622bf1
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
def solution(arrA, arrB): | ||
arrA_idx = 0 | ||
arrB_idx = 0 | ||
arrA_len = len(arrA) | ||
arrB_len = len(arrB) | ||
answer = [] | ||
while arrA_idx < len(arrA) and arrB_idx < len(arrB): | ||
if arrA[arrA_idx] < arrB[arrB_idx]: | ||
answer.append(arrA[arrA_idx]) | ||
arrA_idx += 1 | ||
else: | ||
answer.append(arrB[arrB_idx]) | ||
arrB_idx += 1 | ||
while arrA_idx < len(arrA) and arrB_idx == len(arrB): | ||
answer.append(arrA[arrA_idx]) | ||
arrA_idx += 1 | ||
while arrB_idx < len(arrB) and arrA_idx == len(arrA): | ||
answer.append(arrB[arrB_idx]) | ||
arrB_idx += 1 | ||
return answer | ||
|
||
|
||
arrA = [-2, 3, 5, 9] | ||
arrB = [0, 1, 5] | ||
ret = solution(arrA, arrB); | ||
|
||
print("solution 함수의 반환 값은", ret, "입니다.") |