MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / reversePortionOfArray

Function reversePortionOfArray

javascript/0189-rotate-array.js:19–25  ·  view source on GitHub ↗
(nums, start, end)

Source from the content-addressed store, hash-verified

17};
18
19var reversePortionOfArray = function (nums, start, end) {
20 while (start < end) {
21 [nums[start], nums[end]] = [nums[end], nums[start]];
22 start++;
23 end--;
24 }
25};
26
27/**
28 * Two Pointers

Callers 1

rotateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected