알고리즘/알고리즘 문제 복기

Leetcode - 21. Merge Two sorted List

내일도무사히 2021. 2. 13. 12:19

leetcode.com/problems/merge-two-sorted-lists/

 

Merge Two Sorted Lists - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

Answer

 

새로운 리스트를 만들고 두개의 리스트의 값을 비교해 값을 순차적으로 집어넣는 과정을 거쳤다.

 

 

다음과 같이 재귀함수로도 쓸 수 있다.