Cody

# Problem 3025. Legend of Zelda - Rupee Count

Solution 1949767

Submitted on 26 Sep 2019
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   Fail
r_arr = {'Green','Blue','Yellow','Red','Purple','Orange','Silver','Big green','Big blue','Big red','Big gold'}; c_corr = 1036; assert(isequal(rupee_count(r_arr),c_corr));

reff1 = 1×4 cell array {'Big green'} {'Big blue'} {'Big red'} {'Big gold'} reff2 = 1×7 cell array {'Green'} {'Blue'} {'Yellow'} {'Red'} {'Purple'} {'Orange'} {'Silver'} r_arr = 'GreenBlueYellowRedPurpleOrangeSilver' table1 = 1 1 1 1 table2 = 1 1 1 1 1 1 1

Output argument "c" (and maybe others) not assigned during call to "rupee_count". Error in Test1 (line 3) assert(isequal(rupee_count(r_arr),c_corr));

2   Fail
r_arr = {'Green','Blue','Yellow','Green','Green','Green','Green','Red','Green','Green','Green','Blue','Blue','Yellow','Yellow','Green','Green','Blue','Green','Blue','Yellow','Green','Green','Blue','Green','Blue','Green','Green'}; c_corr = 111; assert(isequal(rupee_count(r_arr),c_corr));

reff1 = 1×4 cell array {'Big green'} {'Big blue'} {'Big red'} {'Big gold'} reff2 = 1×7 cell array {'Green'} {'Blue'} {'Yellow'} {'Red'} {'Purple'} {'Orange'} {'Silver'} r_arr = 'GreenBlueYellowGreenGreenGreenGreenRedGreenGreenGreenBlueBlueYellowYellowGreenGreenBlueGreenBlueYellowGreenGreenBlueGreenBlueGreenGreen' table1 = 0 0 0 0 table2 = 16 7 4 1 0 0 0

Output argument "c" (and maybe others) not assigned during call to "rupee_count". Error in Test2 (line 3) assert(isequal(rupee_count(r_arr),c_corr));

3   Fail
r_arr = {'Green','Blue','Yellow','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Green','Yellow'}; c_corr = 44; assert(isequal(rupee_count(r_arr),c_corr));

reff1 = 1×4 cell array {'Big green'} {'Big blue'} {'Big red'} {'Big gold'} reff2 = 1×7 cell array {'Green'} {'Blue'} {'Yellow'} {'Red'} {'Purple'} {'Orange'} {'Silver'} r_arr = 'GreenBlueYellowGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenGreenYellow' table1 = 0 0 0 0 table2 = 19 1 2 0 0 0 0

Output argument "c" (and maybe others) not assigned during call to "rupee_count". Error in Test3 (line 3) assert(isequal(rupee_count(r_arr),c_corr));

4   Fail
r_arr = {'Green','Big green','Big blue','Red','Silver'}; c_corr = 371; assert(isequal(rupee_count(r_arr),c_corr));

reff1 = 1×4 cell array {'Big green'} {'Big blue'} {'Big red'} {'Big gold'} reff2 = 1×7 cell array {'Green'} {'Blue'} {'Yellow'} {'Red'} {'Purple'} {'Orange'} {'Silver'} r_arr = 'GreenRedSilver' table1 = 1 1 0 0 table2 = 1 0 0 1 0 0 1

Output argument "c" (and maybe others) not assigned during call to "rupee_count". Error in Test4 (line 3) assert(isequal(rupee_count(r_arr),c_corr));

5   Fail
r_ref = {'Green','Blue','Yellow','Red','Purple','Orange','Silver','Big green','Big blue','Big red','Big gold'}; r_v = [1,5,10,20,50,100,200,50,100,200,300]; c_corr = 5; n_r = randi(100); r_arr{1} = 'Blue'; for i = 2:n_r ind_r = randi(11); r_arr{i} = r_ref{ind_r}; c_corr = c_corr + r_v(ind_r); end assert(isequal(rupee_count(r_arr),c_corr));

reff1 = 1×4 cell array {'Big green'} {'Big blue'} {'Big red'} {'Big gold'} reff2 = 1×7 cell array {'Green'} {'Blue'} {'Yellow'} {'Red'} {'Purple'} {'Orange'} {'Silver'} r_arr = 'BlueSilverGreenYellowSilverYellowOrangePurplePurpleBlueOrangeRedOrangeRedGreenRedBlue' table1 = 3 2 5 4 table2 = 2 3 2 3 2 3 2

Output argument "c" (and maybe others) not assigned during call to "rupee_count". Error in Test5 (line 11) assert(isequal(rupee_count(r_arr),c_corr));

### Community Treasure Hunt

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

Start Hunting!