6 kyu
Tracking Sums in a Process
266 of 482raulbc777
Description:
Observe the process with the array given below and the tracking of the sums of each corresponding array.
[5, 3, 6, 10, 5, 2, 2, 1] (34) ----> [5, 3, 6, 10, 2, 1] ----> (27) ------> [10, 6, 5, 3, 2, 1] ----> [4, 1, 2, 1, 1] (9) -----> [4, 1, 2] (7)
The tracked sums are : [34, 27, 9, 7]
. We do not register one of the sums. It is not difficult to see why.
We need the function track_sum
( or trackSum
) that receives an array ( or list ) and outputs a tuple ( or array ) with the following results in the order given below:
- array with the tracked sums obtained in the process
- final array
So for our example given above, the result will be:
track_sum([5, 3, 6, 10, 5, 2, 2, 1]) == [[34, 27, 9, 7], [4, 1, 2]]
You will find more cases in the Example Tests.
Have a good time!
Fundamentals
Data Structures
Algorithms
Mathematics
Logic
Sorting
Puzzles
Similar Kata:
Stats:
Created | Mar 6, 2016 |
Published | Mar 6, 2016 |
Warriors Trained | 1661 |
Total Skips | 36 |
Total Code Submissions | 1667 |
Total Times Completed | 482 |
Python Completions | 266 |
Ruby Completions | 45 |
JavaScript Completions | 168 |
Haskell Completions | 19 |
Rust Completions | 13 |
D Completions | 2 |
Go Completions | 2 |
Total Stars | 29 |
% of votes with a positive feedback rating | 80% of 129 |
Total "Very Satisfied" Votes | 92 |
Total "Somewhat Satisfied" Votes | 22 |
Total "Not Satisfied" Votes | 15 |
Total Rank Assessments | 3 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |