Last active
January 24, 2018 12:02
-
-
Save keehyun2/d0ca246b4609867454f0ae747909a153 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * int 배열에서 2개 원소를 서로 교환합니다. | |
| * @param array 전달받은 배열 | |
| * @param fromIdx | |
| * @param targetIdx | |
| */ | |
| void swap(int[] array, int fromIdx, int targetIdx) { | |
| int temp = array[targetIdx]; // 목적지 원소를 임시 저장 | |
| array[targetIdx] = array[fromIdx]; | |
| array[fromIdx] = temp; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment