MCPcopy
hub / github.com/mgechev/google-interview-preparation-problems / swap

Function swap

src/next-permutation.js:3–7  ·  view source on GitHub ↗
(a, i, j)

Source from the content-addressed store, hash-verified

1// https://leetcode.com/problems/next-permutation/description/
2
3const swap = (a, i, j) => {
4 const t = a[i];
5 a[i] = a[j];
6 a[j] = t;
7};
8
9const sort = (a, i) => {
10 for (; i < a.length; i += 1) {

Callers 2

sortFunction · 0.70
nextPermutationFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected