Problem 45773. Mo money, mo math #2! (★★★)
(adapted from Prob 9 Cody team)
You have a matrix for which each row is a person and the columns represent the number of quarters, dimes, nickels and pennies that person has (in that order). What is the row index of the person with the most money?
Note for those unfamiliar with American coins: quarter = $0.25, dime = $0.10, nickel = $0.05, penny = $0.01.
Example:
Input x = [ 0 0 0 3; 1 0 0 0; 0 1 0 0] Output y = 2
since the first person will have $0.03 and the second person will have $0.25, while the third person has $0.10. Thus, the second person has the most amount.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers42
Suggested Problems
-
Output any real number that is neither positive nor negative
407 Solvers
-
07 - Common functions and indexing 2
421 Solvers
-
527 Solvers
-
Finding an element in a vector
201 Solvers
-
Vector raised to a power, element-wise (★)
131 Solvers
More from this Author52
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!