Answer to Question #175218 in Ruby | Ruby on Rails for Pooj

Question #175218

1)Define a ruby function named milestones.

2) Input parameter of the milestones method should be an array of 'running events taken by

a person' which is again an array.

Each running event taken by a person is an array which contains the following values

1st array element - date when he participated in the run,

2nd array element - time taken to complete the run,

3rd array element - distance of the run

example Input below

Array element description: [ date_of_run, finish_time_in_minutes, length_of_run_in_kms

]

john_runs = [

[ "29-5-2017", 15, 5],

[ "9-3-2017", 35, 10],

[ "29-3-2017", 13, 5],

]

3) Implement the logic in the method so that the output should be an array of fastest times for

distances 5, 10 and 15 kms in that order

output = [ fastest time for 5 kms, fastest time for 10 km, fastest time for 15 kms]

-> If no run is found in the distance, the output should be 0 for that

ex: for the input above example john_runs, only runs with 5 and 10 kms are performed

and no 15km run is performed, the output should be [13, 35, 0],explanation of the output array: 13 - fastest time for a 5 km run, performed by john , 35 -

fastest time for 10 km run performed by john, 0 - as no 15 km run is performed by john


1
Expert's answer
2021-03-26T13:02:40-0400
Dear Pooj, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS