Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 730 Bytes

find_the_difference_in_age_between_oldest_and_youngest_family_members.md

File metadata and controls

16 lines (13 loc) · 730 Bytes

Description

At the annual family gathering, the family likes to find the oldest living family member’s age and the youngest family member’s age and calculate the difference between them.

You will be given an array of all the family members' ages, in any order. The ages will be given in whole numbers, so a baby of 5 months, will have an ascribed ‘age’ of 0. Return a new array (a tuple in Python) with [youngest age, oldest age, difference between the youngest and oldest age].

My Solution

def difference_in_ages(ages)
  [ages.min, ages.max, ages.max - ages.min]
end