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 #116 on September 15, 2026 11:09.
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.
Problem link
https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/
Problem Summary
nums1, nums2 배열의 같은 위치의 원소를 swap 해서 배열을 증가하게 만드는 (strictly increasing) 최소 swap 횟수를 구하는 문제.
Solution
현재 인덱스에서 swap 한다 / 안한다 두 가지를 할 수 있고 이를 dp로 풀 수 있다.
swap 처리가 약간 까다롭긴 한데 swapped 변수에 따라 이전 인덱스 비교를 다르게 해서 풀 수 있다.
Source Code
All reactions