Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const set: number[] = [
...Array(1 + (parseInt(process.argv[2], 10) || 10)).keys()
]
const graph = set
.reduce<number[][]>(
(acc, i) => (acc[i] = set.filter(j => j)) && acc.sort(),
[]
)
.map(g => g.sort((a, b) => a - b))
console.log(
graph.reduce((str, r, i) => {
!+i
? ((str += '🐤\t'), r.forEach(j => (str += `[${j}]\t`)))
: ((str += `[${i}]\t`), r.forEach(j => (str += `${j * i}\t`)))
return (str += '\n')
}, '')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.