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