Cody

Problem 44947. Find the Oldest Person in a Room

Solution 2459564

Submitted on 2 Jun 2020 by Tobias Müller
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   Pass
load patients.mat Age(55) = 12; name = string(LastName); maxAge_correct = "Robinson"; assert(isequal(find_max_age(name,Age),maxAge_correct))

age_sort = 12 25 25 25 25 25 25 27 28 28 28 28 28 29 29 29 30 30 30 30 31 31 31 31 32 32 32 32 33 33 33 34 35 35 36 36 36 36 37 37 37 37 37 38 38 38 38 38 38 39 39 39 39 39 39 39 39 40 40 40 40 41 41 41 42 42 42 42 43 43 44 44 44 44 44 44 44 45 45 45 45 45 45 45 46 47 47 48 48 48 48 48 48 48 48 49 49 49 49 50 ids = 55 13 13 13 13 13 13 18 9 9 9 9 9 61 61 61 30 30 30 30 10 10 10 10 17 17 17 17 7 7 7 81 38 38 15 15 15 15 19 19 19 19 19 1 1 1 1 1 1 14 14 14 14 14 14 14 14 4 4 4 4 23 23 23 12 12 12 12 2 2 24 24 24 24 24 24 24 11 11 11 11 11 11 11 6 34 34 16 16 16 16 16 16 16 16 5 5 5 5 20 name_sort = 100×1 string array "Reed" "Jackson" "Jackson" "Jackson" "Jackson" "Jackson" "Jackson" "Garcia" "Moore" "Moore" "Moore" "Moore" "Moore" "Rivera" "Rivera" "Rivera" "King" "King" "King" "King" "Taylor" "Taylor" "Taylor" "Taylor" "Thompson" "Thompson" "Thompson" "Thompson" "Miller" "Miller" "Miller" "Henderson" "Gonzalez" "Gonzalez" "Harris" "Harris" "Harris" "Harris" "Martinez" "Martinez" "Martinez" "Martinez" "Martinez" "Smith" "Smith" "Smith" "Smith" "Smith" "Smith" "White" "White" "White" "White" "White" "White" "White" "White" "Jones" "Jones" "Jones" "Jones" "Lewis" "Lewis" "Lewis" "Thomas" "Thomas" "Thomas" "Thomas" "Johnson" "Johnson" "Lee" "Lee" "Lee" "Lee" "Lee" "Lee" "Lee" "Anderson" "Anderson" "Anderson" "Anderson" "Anderson" "Anderson" "Anderson" "Davis" "Scott" "Scott" "Martin" "Martin" "Martin" "Martin" "Martin" "Martin" "Martin" "Martin" "Brown" "Brown" "Brown" "Brown" "Robinson" old_name = "Robinson"

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

age_sort = 13 19 23 27 ids = 4 3 1 2 name_sort = 1×4 string array "Ethan" "Katrina" "Renee" "Melanie" old_name = "Melanie"

Suggested Problems

More from this Author13

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!