You are viewing a single comment's thread. Return to all comments →
Typescript
let map: Map<number, number> = new Map(); for(let i = 1; i <= n; i++) { if (i - k > 0 && !map.has(i - k)) { map.set(i - k, i); } else if (i + k <= n) { map.set(i + k, i); } else{ return [-1]; } } return [...map.keys()];
Seems like cookies are disabled on this browser, please enable them to open this website
Absolute Permutation
You are viewing a single comment's thread. Return to all comments →
Typescript