Problem 44947. Find the Oldest Person in a Room

Solution 2812675

Submitted on 9 Aug 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
load patients.mat Age(55) = 12; name = string(LastName); maxAge_correct = "Robinson"; assert(isequal(find_max_age(name,Age),maxAge_correct))

old_name = 100×1 string array "Gonzalez" "Roberts" "Gonzalez" "Carter" "Edwards" "Campbell" "Hill" "Carter" "Young" "Wright" "Phillips" "Perez" "Walker" "Nelson" "Adams" "Evans" "Lopez" "Allen" "Baker" "Collins" "Evans" "Nelson" "Mitchell" "Turner" "Young" "Walker" "Nelson" "Walker" "Adams" "King" "Phillips" "Carter" "Walker" "Parker" "Turner" "Evans" "Turner" "Green" "Hill" "Gonzalez" "Nelson" "Turner" "Turner" "Baker" "Phillips" "Baker" "King" "Nelson" "Perez" "Perez" "Edwards" "Turner" "Roberts" "Parker" "Thomas" "Gonzalez" "Mitchell" "Phillips" "Adams" "Gonzalez" "Hernandez" "Young" "King" "Young" "Hernandez" "Adams" "Phillips" "Lopez" "Wright" "Evans" "Walker" "Carter" "Nelson" "Mitchell" "Hill" "Wright" "Green" "Lopez" "Perez" "Evans" "Scott" "Nelson" "Young" "Hernandez" "Lopez" "Nelson" "Baker" "Edwards" "Wright" "Baker" "Gonzalez" "Phillips" "King" "Evans" "Evans" "Walker" "Turner" "Edwards" "Phillips" "Evans"

Assertion failed.

2   Fail
name = ["Renee" "Melanie" "Katrina" "Ethan"]; age = [23 27 19 13]; maxAge_correct = "Melanie"; assert(isequal(find_max_age(name,age),maxAge_correct))

Index exceeds the number of array elements (4). Error in find_max_age (line 2) old_name = name(age) Error in Test2 (line 4) assert(isequal(find_max_age(name,age),maxAge_correct))

Suggested Problems

More from this Author13