Retired

Combinations of Logs (retired)

Description:

Tim the timber man just finished cutting all his logs. He has n logs (each of which are marked 1, 2, 3... n) and he was wondering how he could order his logs for shipping. He ships in packages of k logs.

Create a program that given a number of logs (n) and a package size (k) will return the ways Tim can order his logs. Your program should return an array of arrays.

Example: With 5 logs and a package size of 3 your program should return [[1,2,3],[1,2,4],[1,2,5],[1,3,4],[1,3,5],[1,4,5],[2,3,4],[2,3,5],[2,4,5],[3,4,5]]

Algorithms
Logic

Stats:

CreatedMay 12, 2017
Warriors Trained18
Total Skips0
Total Code Submissions41
Total Times Completed10
JavaScript Completions10
Total Stars0
% of votes with a positive feedback rating31% of 8
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes4
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • nonnegative Avatar
Ad