September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,12 +0,0 @@
|
|||
combos = (arr, k) ->
|
||||
return [ [] ] if k == 0
|
||||
return [] if arr.length == 0
|
||||
|
||||
combos_with_head = ([arr[0]].concat combo for combo in combos arr, k-1)
|
||||
combos_sans_head = combos arr[1...], k
|
||||
combos_with_head.concat combos_sans_head
|
||||
|
||||
arr = ['iced', 'jam', 'plain']
|
||||
console.log "valid pairs from #{arr.join ','}:"
|
||||
console.log combos arr, 2
|
||||
console.log "#{combos([1..10], 3).length} ways to order 3 donuts given 10 types"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
jam,plain:
|
||||
[ [ 'iced', 'iced' ],
|
||||
[ 'iced', 'jam' ],
|
||||
[ 'iced', 'plain' ],
|
||||
[ 'jam', 'jam' ],
|
||||
[ 'jam', 'plain' ],
|
||||
[ 'plain', 'plain' ] ]
|
||||
220 ways to order 3 donuts given 10 types
|
||||
Loading…
Add table
Add a link
Reference in a new issue