-
2 Comments
Sebastian Valentino
on 12 May 2020
This test fail =
a = [ 0 1 2 1; 0 2 1 1];
c = 1;
assert(isequal(most_change(a),c))
I don't undersdand why.
The first person = 0 * 0.25 + 1 * 0.10 + 2 * 0.05 + 1 * 0.01 = 0.21
The second person = 0 *0.25 + 2 * 0.10 + 1 *0.05 + 1 * 0.01 = 0.26
So the first person has less money than the second, should return 2.
I'm missing something here?
BunnY
on 28 Jun 2020
d = [0.25 0.05 0.1 0.01];
[c idx]= max(sum((a.*d)'));
b = idx;
This works but how to optimize it to reduce the size.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!