7 kyu
Computer problem series #1: Fill the Hard Disk Drive
2,334 of 7,539albertogcmr
Description:
Your task is to determine how many files of the copy queue you will be able to save into your Hard Disk Drive. The files must be saved in the order they appear in the queue.
Zero size files can always be saved even HD full.
Input:
- Array of file sizes
(0 <= s <= 100)
- Capacity of the HD
(0 <= c <= 500)
Output:
- Number of files that can be fully saved in the HD.
Examples:
save([4,4,4,3,3], 12) -> 3
# 4+4+4 <= 12, but 4+4+4+3 > 12
save([4,4,4,3,3], 11) -> 2
# 4+4 <= 11, but 4+4+4 > 11
save([12, 0, 0, 1], 12) -> 3
# 12+0+0 <= 12, but 12+0+0+1 > 12
Do not expect any negative or invalid inputs.
Lists
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Aug 6, 2019 |
Published | Aug 8, 2019 |
Warriors Trained | 10932 |
Total Skips | 421 |
Total Code Submissions | 25087 |
Total Times Completed | 7539 |
Python Completions | 2334 |
Dart Completions | 341 |
CoffeeScript Completions | 13 |
PHP Completions | 273 |
TypeScript Completions | 184 |
C++ Completions | 1399 |
Ruby Completions | 272 |
C Completions | 216 |
JavaScript Completions | 2039 |
Haskell Completions | 87 |
Crystal Completions | 12 |
Julia Completions | 19 |
Elixir Completions | 65 |
Clojure Completions | 39 |
C# Completions | 371 |
Lua Completions | 67 |
COBOL Completions | 8 |
Java Completions | 192 |
Total Stars | 111 |
% of votes with a positive feedback rating | 93% of 949 |
Total "Very Satisfied" Votes | 832 |
Total "Somewhat Satisfied" Votes | 95 |
Total "Not Satisfied" Votes | 22 |
Total Rank Assessments | 31 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |