Beta
Cable Matching Problem
13 of 56Sarkanyolo
Description:
We are selling cables with various, non-standard sizes. The length of our cables and the orders from customers can only be positive integers. Find the cable pieces which will fulfill an order. The input is the order as integer and the list of lengths of our cables. The result should be the lengths of the needed cables, in descending order, in string, separated by comma. If there is no result, return "No result".
Example
cableMatching(200, {10,10,23,4,5,67,889,150,50}) should return "150,50"
cableMatching(83, {10,10,23,4,5,67,889,150,50}) should return "50,23,10"
cableMatching(12, {10,10,23,4,5,67,889,150,50}) should return "No result"
Random Test
100 small tests with 10 <= cables.size <= 50, cables[i] <= 100, need <= 5000
10 large test with 10 <= cables.size <= 50, cables[i] <= 1000, need <= 10000
Algorithms
Similar Kata:
Stats:
Created | May 6, 2015 |
Published | May 6, 2015 |
Warriors Trained | 257 |
Total Skips | 74 |
Total Code Submissions | 596 |
Total Times Completed | 56 |
C# Completions | 13 |
Ruby Completions | 8 |
Python Completions | 30 |
Clojure Completions | 4 |
C++ Completions | 7 |
Total Stars | 11 |
% of votes with a positive feedback rating | 84% of 28 |
Total "Very Satisfied" Votes | 22 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 28 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 7 kyu |