Cody

Problem 46576. Award medals to winners

Solution 2972848

Submitted on 20 Sep 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

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))

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!