MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / duplicateZeros

Function duplicateZeros

JavaScript/Duplicate-Zeroes.js:24–33  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

22*/
23
24var duplicateZeros = function (arr) {
25 let len = arr.length;
26 for (let i = 0; i < len; i++) {
27 if (arr[i] == 0) {
28 arr.splice(i + 1, 0, 0);
29 i++;
30 }
31 }
32 arr.splice(len);
33};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected