Cody

# Problem 39. Which values occur exactly three times?

Solution 210691

Submitted on 28 Feb 2013 by Shaun VanWeelden
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 2 5 2 2 7 8 3 3 1 3 8 8 8]; y_correct = [2 3]; assert(isequal(threeTimes(x),y_correct))

num = 8 modeNum = 4 ind = 7 12 13 14 x = 1 2 5 2 2 7 3 3 1 3 num = 2 modeNum = 3 nums = 2 ind = 2 4 5 x = 1 5 7 3 3 1 3 num = 3 modeNum = 3 nums = 2 3 ind = 4 5 7 x = 1 5 7 1 num = 1 modeNum = 2 ind = 1 4 x = 5 7 num = 5 modeNum = 1 ind = 1 x = 7 num = 7 modeNum = 1 ind = 1 x = Empty matrix: 1-by-0 ans = 2 3

2   Pass
%% x = [1 1 1]; y_correct = [1]; assert(isequal(threeTimes(x),y_correct))

num = 1 modeNum = 3 nums = 1 ind = 1 2 3 x = Empty matrix: 1-by-0 ans = 1

3   Pass
%% x = [5 10 -3 10 -3 11 -3 5 5 7]; y_correct = [-3 5]; assert(isequal(threeTimes(x),y_correct))

num = -3 modeNum = 3 nums = -3 ind = 3 5 7 x = 5 10 10 11 5 5 7 num = 5 modeNum = 3 nums = -3 5 ind = 1 5 6 x = 10 10 11 7 num = 10 modeNum = 2 ind = 1 2 x = 11 7 num = 7 modeNum = 1 ind = 2 x = 11 num = 11 modeNum = 1 ind = 1 x = Empty matrix: 1-by-0 ans = -3 5