-
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.
Merge branch 'main' of https://github.com/KNU-HAEDAL/2024-SS-small-gr…
- Loading branch information
Showing
3 changed files
with
33 additions
and
7 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
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,26 @@ | ||
def solution(arr1, arr2): | ||
answer = [] | ||
pointer1 = 0 | ||
pointer2 = 0 | ||
|
||
# 두 배열을 순회하면서 오름차순 정렬 실행 | ||
while pointer1 < len(arr1) and pointer2 < len(arr2): | ||
if arr1[pointer1] < arr2[pointer2]: | ||
answer.append(arr1[pointer1]) | ||
pointer1 += 1 | ||
else: | ||
answer.append(arr2[pointer2]) | ||
pointer2 += 1 | ||
|
||
# 아직 남은 값들을 추가 | ||
while pointer1 < len(arr1): | ||
answer.append(arr1[pointer1]) | ||
pointer1 += 1 | ||
|
||
while pointer2 < len(arr2): | ||
answer.append(arr2[pointer2]) | ||
pointer2 += 1 | ||
|
||
return answer | ||
|
||
print(solution([1,2,3], [4,5,6])) |
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 |
---|---|---|
@@ -1 +1 @@ | ||
142 | ||
143 |