You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
먼저 기본적인 아이디어는 이진 탐색인데, 한 리스트를 잡고 그 리스트에 대해 이진 탐색을 진행하면서 중앙값을 찾는 방식이다.
한 리스트의 지점을 골랐다면 중앙값은 중앙에 있는 값이므로 다른 리스트의 지점도 자동으로 선택되는 걸 이용한다. 따라서 선택하는 리스트는 사이즈가 다른 리스트보다 작아야 한다.
This discussion was converted from issue #8 on September 15, 2026 10:57.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem link
https://leetcode.com/problems/median-of-two-sorted-arrays/
Problem Summary
두 정렬된 배열을 합쳤을 때의 중앙값을 구하는 문제.
Solution
이건 쉬워 보이는데 구현이 생각보다 빡세서 로이형의 도움을 많이 받았다.
먼저 기본적인 아이디어는 이진 탐색인데, 한 리스트를 잡고 그 리스트에 대해 이진 탐색을 진행하면서 중앙값을 찾는 방식이다.
한 리스트의 지점을 골랐다면 중앙값은 중앙에 있는 값이므로 다른 리스트의 지점도 자동으로 선택되는 걸 이용한다. 따라서 선택하는 리스트는 사이즈가 다른 리스트보다 작아야 한다.
자세한 영상은 유튜브 참고 (https://youtu.be/LPFhl65R7ww)
<iframe width="560" height="315" src="https://www.youtube.com/embed/LPFhl65R7ww" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>Source Code
All reactions