function lessOrEqual(a, b) { for (let i = 0; i < a.length; i++) { if (i >= b.length) return false; if (a[i] != b[i]) return a[i] < b[i]; } return a.length <= b.length; } function expandLimit(n) { return [0, n+1]; } function expand(a, n) { let out = [...a]; let cutNode = out.pop(); let rootIndex = out.findLastIndex(v => v < cutNode); let increment = cutNode - out[rootIndex] - 1; let badPart = out.slice(rootIndex); for (let i = 1; i < n; i++) { out.push(...badPart.map(v => v + increment * i)); } return out; } function isSuccessor(array) { return array.length == 0 || array.at(-1) == 0; } function notationToString(array) { return JSON.stringify(array).slice(1, -1); } function notationFromString(s) { return JSON.parse("["+s+"]"); }
Indentation:
Align recursive expansion
Align fundamental sequence
None