public static void reverse(int[] v, int N) {
int i = 0;
int j = N - 1;
while (i < j) {
swap(v, i, j); // this is a self-defined function
i++;
j--;
}
}
func reverse(v []int, N int) {
var i int = 0
var j = N - 1
for i < j {
swap(v, i, j) // this is a self-defined function
i++
j--
}
}
[Go] Array and String - Array Partition I (0) | 2022.04.10 |
---|---|
[Go] Array and string - Reverse String (0) | 2022.04.09 |
[Go] Array and string - Longest Common Prefix (0) | 2022.04.08 |
[Go]Array and String - Implement strStr() (0) | 2022.04.04 |
[Go] Array and string - Add binary (0) | 2022.04.03 |
댓글 영역