Cody

# Problem 46576. Award medals to winners

Solution 2926996

Submitted on 8 Sep 2020 by Tim
• Size: 79
• This is the leading solution.
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
x = [1 5 2 6 3 7]; [w1_correct,w2_correct,w3_correct] = deal(6,4,2); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

2   Pass
x = [12 20 14 50 33 50 8 1]; [w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

3   Pass
x = [33 33 33 12 20 14 50 33 50 8 1]; [w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

4   Pass
x = [9 8 8 9 1 3 4 2 3 9]; [w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

5   Pass
x = [9 8 8 9 1 10 3 4 2 3 9]; [w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

6   Pass
x = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12]; [w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

### Community Treasure Hunt

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

Start Hunting!