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]]
trackSum([5, 3, 6, 10, 5, 2, 2, 1]) == [[34, 27, 9, 7], [4, 1, 2]]
trackSum [ 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

Stats:

CreatedMar 6, 2016
PublishedMar 6, 2016
Warriors Trained1661
Total Skips36
Total Code Submissions1667
Total Times Completed482
Python Completions266
Ruby Completions45
JavaScript Completions168
Haskell Completions19
Rust Completions13
D Completions2
Go Completions2
Total Stars29
% of votes with a positive feedback rating80% of 129
Total "Very Satisfied" Votes92
Total "Somewhat Satisfied" Votes22
Total "Not Satisfied" Votes15
Total Rank Assessments3
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • raulbc777 Avatar
  • smile67 Avatar
  • JohanWiltink Avatar
  • Voile Avatar
  • cliffstamp Avatar
  • akar-0 Avatar
Ad