MCPcopy Create free account
hub / github.com/camilamaia/jornada-big-tech / reverse

Method reverse

leetcode/src/NextPermutation.java:33–41  ·  view source on GitHub ↗
(int[] nums, int start)

Source from the content-addressed store, hash-verified

31 }
32
33 private void reverse(int[] nums, int start) {
34 int rightPointer = nums.length - 1;
35
36 while (start < rightPointer) {
37 swap(nums, start, rightPointer);
38 start++;
39 rightPointer--;
40 }
41 }
42
43 private void swap(int[] nums, int position1, int position2) {
44 int old1 = nums[position1];

Callers 1

nextPermutationMethod · 0.95

Calls 1

swapMethod · 0.95

Tested by

no test coverage detected