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

Function swap

javascript/0041-first-missing-positive.js:45–46  ·  view source on GitHub ↗
(nums, index, indexKey)

Source from the content-addressed store, hash-verified

43 isPositive(num) && isInBound(num, nums) && !isEqual(num, indexNum);
44
45const swap = (nums, index, indexKey) =>
46 ([nums[index], nums[indexKey]] = [nums[indexKey], nums[index]]);
47
48const isPositive = (num) => 0 < num;
49

Callers 1

cyclicSortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected