Skip to content

Instantly share code, notes, and snippets.

@wasabili
Created October 9, 2010 06:38
Show Gist options
  • Save wasabili/617957 to your computer and use it in GitHub Desktop.
Save wasabili/617957 to your computer and use it in GitHub Desktop.
(use file.util)
(use util.combinations)
(use srfi-1)
(define (flatten-number xs)
(string->number (apply string-append (map number->string xs))))
(let* ((input (map string->number (file->string-list "input.txt")))
(k (second input))
(nums (drop input 2)))
(print (length+ (delete-duplicates (map flatten-number (append-map permutations (combinations nums k)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment