개발자 뺚

[Cody]Problem 44947. Find the Oldest Person in a Room 본문

Solution/MATLAB

[Cody]Problem 44947. Find the Oldest Person in a Room

2023. 8. 23. 03:00

Given two input vectors:

  • name - user last names
  • age - corresponding age of the person

Return the name of the oldest person in the output variable old_name.


function old_name = find_max_age(name,age)

  [value index] = max(age);
  old_name = name(index);
end