MCPcopy Create free account
hub / github.com/Faheem-Khan97/javascript-coding-problems-with-theory / reverseInPlace

Function reverseInPlace

utils/index.js:15–23  ·  view source on GitHub ↗
(arr, startIndex, endIndex)

Source from the content-addressed store, hash-verified

13}
14exports.createAsyncTask = createAsyncTask;
15function reverseInPlace(arr, startIndex, endIndex) {
16 if (startIndex === void 0) { startIndex = 0; }
17 if (endIndex === void 0) { endIndex = arr.length - 1; }
18 for (var i = startIndex; i <= startIndex + Math.floor((endIndex - startIndex) / 2); i++) {
19 var temp = arr[i];
20 arr[i] = arr[endIndex - i + startIndex];
21 arr[endIndex - i + startIndex] = temp;
22 }
23}
24exports.reverseInPlace = reverseInPlace;
25function chopInputArray(arr, size) {
26 var res = [];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected