Hacker News new | past | comments | ask | show | jobs | submit login

From a more abstract point of view we just build a loop through all permutations of numbers 1,2,..,n. Probably the most efficient algorithm for this task is this one https://en.m.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2...



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: