Cody

# Problem 42805. GJam 2016 Rd1A: Rank and File (small)

Solution 876203

Submitted on 18 Apr 2016 by Richard Zapor
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
tic m=[1 2 3 2 1 2 3 5 3 2 3 5 6 4 3 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[3 4 6 ]; assert(isequal(vexp,v))

2   Pass
m=[22 2 2 222 22 22 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[22 222 ]; assert(isequal(vexp,v))

3   Pass
m=[11 3 6 9 10 6 3 14 6 7 11 11 7 6 16 9 11 15 19 10 8 22 11 14 19 22 11 10 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[8 10 15 16 ]; assert(isequal(vexp,v))

4   Pass
m=[4 1 23 6 3 1 6 2 5 5 2 22 4 9 2 25 11 8 2 11 7 10 10 7 24 9 13 3 26 15 12 3 15 8 14 14 8 27 13 16 4 29 18 13 4 18 9 17 17 9 28 16 17 5 30 20 14 5 20 10 19 19 10 31 17 18 6 32 21 15 6 21 11 20 20 11 33 18 28 23 34 33 27 22 32 24 31 30 25 34 29 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[3 8 12 13 14 15 26 ]; assert(isequal(vexp,v))

5   Pass
m=[7 5 3 8 6 9 46 1 2 7 8 2 3 4 1 9 47 6 5 15 13 11 16 14 17 49 2 10 15 16 10 11 12 2 17 48 14 13 22 20 18 23 21 24 50 3 11 22 23 11 18 19 3 24 51 21 20 28 26 19 29 27 30 52 4 12 28 29 12 19 25 4 30 53 27 26 33 31 20 34 32 35 54 5 13 33 34 13 20 26 5 35 55 32 31 37 32 21 38 36 39 57 6 14 37 38 14 21 27 6 39 56 36 32 40 33 22 41 37 42 59 7 15 40 41 15 22 28 7 42 58 37 33 41 34 23 43 38 44 60 8 16 41 43 16 23 29 8 44 61 38 34 42 35 24 44 39 45 62 9 17 42 44 17 24 30 9 45 63 39 35 58 55 50 61 57 62 64 47 48 59 60 49 51 52 46 63 64 56 54 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[4 12 19 25 26 27 28 29 30 53 ]; assert(isequal(vexp,v))

6   Pass
m=[22 2 22 222 22 222 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[2 22 ]; assert(isequal(vexp,v))

7   Pass
m=[2 2 6 6 4 8 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[4 8 ]; assert(isequal(vexp,v))

8   Pass
m=[2 3 10 9 4 8 9 6 2 6 8 4 13 11 11 4 6 14 11 6 10 13 10 3 7 12 8 15 12 15 6 7 17 12 8 11 15 11 4 9 14 9 16 14 18 8 10 18 14 10 12 17 12 6 11 15 11 17 15 20 9 11 20 16 12 15 19 14 8 14 16 12 19 18 21 11 12 22 19 13 17 20 15 9 15 18 14 21 20 24 13 15 24 20 14 18 21 17 10 17 19 16 24 22 26 14 17 25 21 15 20 23 20 11 18 22 19 26 24 28 ]; m=reshape(m,[],8); v=rank_file(m); vexp=[14 17 19 20 22 23 25 28 ]; assert(isequal(vexp,v))

9   Pass
m=[2 6 4 6 8 8 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[2 4 ]; assert(isequal(vexp,v))

10   Pass
m=[2 6 1 1 4 3 2 4 8 2 2 6 5 4 5 9 3 4 8 8 6 6 12 5 6 10 9 8 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[5 6 10 12 ]; assert(isequal(vexp,v))

11   Pass
m=[8 4 10 9 1 8 3 2 2 4 1 6 6 9 3 5 10 7 7 9 5 11 10 2 9 4 3 3 5 2 7 7 10 4 6 11 8 8 10 6 12 11 3 10 5 4 4 6 3 8 8 11 5 7 12 9 9 11 7 13 12 4 11 6 5 5 7 4 9 9 12 6 8 13 10 10 12 8 14 13 5 12 7 6 6 8 5 10 10 13 7 9 14 11 11 13 9 15 14 6 13 8 7 7 9 6 11 11 14 8 10 15 12 12 14 10 16 15 7 14 9 8 8 10 7 12 12 15 9 11 16 13 13 15 11 17 16 8 15 10 9 9 11 8 13 13 16 10 12 17 14 14 16 12 18 17 9 16 11 10 10 12 9 14 14 17 11 13 18 15 15 17 13 19 18 10 17 12 11 11 13 10 15 15 18 12 14 19 16 16 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[5 6 7 8 9 10 11 12 13 14 ]; assert(isequal(vexp,v))

12   Pass
m=[2 5 7 2 9 7 8 4 4 4 7 9 4 11 8 9 6 6 5 8 10 5 12 9 11 7 7 7 10 12 7 13 12 14 9 8 8 12 14 9 16 13 16 11 9 ]; m=reshape(m,[],5); v=rank_file(m); vexp=[5 7 8 9 11 ]; assert(isequal(vexp,v))

13   Pass
m=[7 29 22 3 15 36 43 4 2 6 1 8 1 14 30 23 10 16 37 44 11 9 13 8 9 2 21 31 24 17 17 38 45 18 16 20 15 10 3 28 32 25 24 18 39 46 25 23 27 22 11 4 35 33 26 31 19 40 47 32 30 34 29 12 5 42 34 27 38 20 41 48 39 37 41 36 13 6 49 35 28 45 21 42 49 46 44 48 43 14 7 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[5 12 19 26 33 40 47 ]; assert(isequal(vexp,v))

14   Pass
m=[3 1 1 3 2 2 4 4 2 2 4 3 3 5 5 3 3 5 4 4 6 6 4 4 6 5 5 7 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[4 5 6 7 ]; assert(isequal(vexp,v))

15   Pass
m=[6 6 7 2 1 4 5 3 2 7 3 1 5 7 7 8 3 2 5 6 4 3 8 4 2 6 8 8 9 4 3 6 7 5 4 9 5 3 7 9 9 10 5 4 7 8 6 5 10 6 4 8 10 10 11 6 5 8 9 7 6 11 7 5 9 11 11 12 7 6 9 10 8 7 12 8 6 10 12 12 13 8 7 10 11 9 8 13 9 7 11 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[4 5 6 7 8 9 10 ]; assert(isequal(vexp,v))

16   Pass
m=[3 5 71 8 81 9 1 91 11 7 1 21 41 10 6 51 31 61 4 13 15 72 18 82 19 2 92 12 17 11 22 42 20 16 52 32 62 14 23 25 73 28 83 29 3 93 13 27 21 23 43 30 26 53 33 63 24 33 35 74 38 84 39 4 94 14 37 31 24 44 40 36 54 34 64 34 43 45 75 48 85 49 5 95 15 47 41 25 45 50 46 55 35 65 44 53 55 76 58 86 59 6 96 16 57 51 26 46 60 56 56 36 66 54 63 65 77 68 87 69 7 97 17 67 61 27 47 70 66 57 37 67 64 73 75 78 78 88 79 8 98 18 77 71 28 48 80 76 58 38 68 74 83 85 79 88 89 89 9 99 19 87 81 29 49 90 86 59 39 69 84 93 95 80 98 90 99 10 100 20 97 91 30 50 100 96 60 40 70 94 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[2 12 22 32 42 52 62 72 82 92 ]; assert(isequal(vexp,v))

17   Pass
m=[2 7 3 8 1 1 2 4 10 5 9 2 2 4 5 12 6 11 3 3 5 9 13 12 13 8 7 10 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[3 5 6 11 ]; assert(isequal(vexp,v))

18   Pass
m=[1 2 3 3 1 2 3 4 4 2 3 4 5 5 3 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[2 3 4 ]; assert(isequal(vexp,v))

19   Pass
m=[7 7 6 3 1 1 3 10 9 7 6 3 3 6 13 12 9 7 6 6 8 14 14 12 10 7 7 9 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[6 8 9 13 ]; assert(isequal(vexp,v))

20   Pass
m=[13 3 1 1 9 2 4 14 7 5 2 10 6 8 15 11 9 3 11 10 12 16 15 13 4 12 14 16 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[5 6 7 8 ]; assert(isequal(vexp,v))

21   Pass
m=[9 15 14 4 8 13 12 10 2 3 6 4 2 5 10 11 6 9 8 12 19 18 6 10 18 16 14 4 5 7 5 3 7 14 16 9 12 11 13 21 19 9 12 20 18 16 6 7 9 6 4 10 16 17 11 13 12 17 24 21 12 13 22 20 19 8 10 10 7 5 13 18 20 14 14 16 18 25 22 13 14 23 21 20 9 12 11 9 6 14 19 22 15 15 17 22 26 26 16 16 25 25 23 10 14 12 11 8 18 20 23 19 17 20 25 27 29 17 17 26 28 26 11 16 13 12 9 20 22 25 22 18 23 26 28 32 20 19 27 30 27 13 18 16 14 10 22 23 26 23 20 25 27 32 33 21 20 30 32 28 15 19 18 16 12 24 25 28 25 21 26 31 33 36 22 21 32 34 32 16 21 19 18 14 26 26 29 28 22 29 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[16 21 22 26 28 29 31 32 34 36 ]; assert(isequal(vexp,v))

22   Pass
m=[2 2 6 3 4 4 3 7 5 5 6 5 8 7 6 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[5 6 8 ]; assert(isequal(vexp,v))

23   Pass
m=[5 3 11 7 2 9 9 5 12 3 7 8 6 8 4 4 1 8 5 15 9 5 13 14 9 16 6 12 13 10 11 6 7 2 9 6 17 10 6 15 18 11 18 8 14 16 12 13 8 10 3 11 7 18 12 8 16 19 13 20 9 16 17 15 14 10 11 4 13 9 19 14 9 17 20 14 21 10 18 19 17 16 11 12 5 15 10 21 17 11 19 22 16 22 13 19 20 18 18 12 14 6 16 12 23 18 13 21 24 17 25 15 21 23 19 19 14 16 7 17 13 25 19 15 23 26 19 26 17 23 25 21 20 16 18 8 19 14 26 20 16 24 28 21 28 18 25 26 22 22 18 20 9 ]; m=reshape(m,[],9); v=rank_file(m); vexp=[1 3 4 5 7 8 9 11 12 ]; assert(isequal(vexp,v))

24   Pass
m=[9 11 5 14 1 13 8 2 3 11 1 7 10 8 13 5 6 11 15 7 17 3 17 13 5 5 13 2 8 14 10 15 9 11 12 19 8 19 5 20 15 7 7 14 3 10 17 11 16 11 13 16 21 11 21 7 23 16 8 9 17 5 13 19 14 18 13 15 17 23 13 22 8 25 18 10 11 18 6 15 21 16 19 14 16 19 24 15 25 9 26 19 11 13 21 8 16 23 18 23 16 17 23 25 17 28 11 28 21 13 14 24 10 19 24 21 26 17 18 24 27 19 30 13 29 23 15 15 25 11 21 26 23 27 18 19 26 30 20 32 14 32 25 17 17 28 13 23 28 25 29 21 22 ]; m=reshape(m,[],9); v=rank_file(m); vexp=[3 7 8 10 11 12 14 16 19 ]; assert(isequal(vexp,v))

25   Pass
m=[111 125 48 41 86 24 61 24 35 119 70 63 49 131 136 102 60 93 49 86 35 51 133 128 115 51 156 162 111 94 119 61 94 41 86 157 139 118 60 166 191 129 119 125 86 105 46 93 176 153 131 82 189 212 189 156 129 111 111 48 131 204 203 192 102 192 237 204 157 131 119 118 63 133 209 224 209 115 203 244 212 162 153 125 139 70 136 224 244 237 128 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[46 82 105 125 166 176 191 ]; assert(isequal(vexp,v))

26   Pass
m=[4 2 6 8 4 8 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[2 6 ]; assert(isequal(vexp,v))

27   Pass
m=[9 5 12 8 5 11 8 17 11 9 17 12 20 14 13 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[13 14 20 ]; assert(isequal(vexp,v))

28   Pass
m=[1 3 1 2 2 2 4 2 3 3 3 5 3 4 4 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[3 4 5 ]; assert(isequal(vexp,v))

29   Pass
m=[3 10 13 7 6 12 11 6 12 18 10 10 16 14 10 18 19 12 14 19 18 12 19 22 16 18 22 19 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[3 7 11 13 ]; assert(isequal(vexp,v))

30   Pass
m=[16 18 23 12 1 19 4 13 11 8 11 15 17 10 1 3 19 22 23 26 15 3 26 5 18 12 11 15 19 21 13 4 5 23 23 24 28 17 7 29 9 20 15 13 19 20 22 14 8 11 25 25 29 30 21 10 31 13 23 19 14 20 21 25 19 11 12 28 30 35 35 23 11 36 15 27 20 19 23 26 31 21 12 15 34 33 36 40 26 15 38 19 29 21 20 27 29 32 23 13 18 37 37 38 41 30 16 42 22 33 25 23 31 32 37 25 17 21 39 38 41 44 34 19 46 23 37 28 25 35 36 39 29 18 23 41 42 44 49 35 23 49 26 40 30 28 36 38 41 31 19 26 46 ]; m=reshape(m,[],9); v=rank_file(m); vexp=[7 9 13 15 17 20 22 24 29 ]; assert(isequal(vexp,v))

31   Pass
m=[4 2 2 8 4 6 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[6 8 ]; assert(isequal(vexp,v))

32   Pass
m=[8 22 22 11 20 3 9 8 18 16 10 14 13 13 29 33 17 28 8 15 13 28 23 20 21 24 17 34 34 22 32 9 22 15 31 29 24 27 26 21 39 42 24 35 10 27 20 38 31 29 29 34 23 45 45 26 44 13 29 24 43 39 31 34 39 28 52 53 31 48 18 32 28 48 43 35 38 44 29 56 56 34 53 22 34 33 52 45 39 42 45 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[3 8 11 14 16 20 22 ]; assert(isequal(vexp,v))

33   Pass
m=[65 76 101 87 2 90 117 2 65 35 36 10 44 103 81 45 40 86 22 84 98 144 134 10 120 168 22 98 43 40 24 61 137 102 79 52 127 24 99 108 147 144 35 136 179 36 121 54 54 40 74 161 132 96 74 137 43 119 141 157 186 44 142 188 40 144 74 74 52 92 208 169 113 92 184 61 151 159 191 216 45 168 213 53 168 88 96 73 97 230 174 137 113 199 79 190 201 222 217 65 211 236 65 190 121 99 98 144 236 205 168 119 206 84 205 208 260 229 76 235 267 81 201 132 108 102 169 246 208 174 141 224 98 206 224 268 265 90 259 274 86 211 137 136 127 184 267 235 199 142 259 120 217 229 272 272 101 265 281 87 222 144 147 134 186 294 260 216 157 268 144 236 246 294 281 117 267 302 103 236 161 179 137 208 302 267 230 188 274 168 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[53 73 88 97 137 151 159 168 191 213 ]; assert(isequal(vexp,v))

34   Pass
m=[18 9 15 18 3 13 21 7 6 9 5 11 12 15 10 19 12 18 20 5 15 22 8 7 11 7 14 14 17 12 27 17 21 24 7 22 27 14 8 14 11 19 18 24 17 30 20 23 25 9 24 29 17 12 17 12 21 21 27 20 33 21 25 26 12 27 31 19 14 18 14 22 22 28 21 34 24 29 31 15 29 32 22 18 21 15 25 27 32 23 35 27 32 34 18 31 36 24 20 24 17 26 28 34 25 38 30 34 35 21 32 38 27 22 27 19 31 33 36 29 ]; m=reshape(m,[],8); v=rank_file(m); vexp=[3 6 9 10 11 13 15 18 ]; assert(isequal(vexp,v))

35   Pass
m=[2 2 4 4 4 5 ]; m=reshape(m,[],2); v=rank_file(m); vexp=[4 5 ]; assert(isequal(vexp,v))

36   Pass
m=[7 14 4 13 10 8 5 10 7 14 15 5 14 20 18 11 12 11 15 22 7 18 24 20 12 15 14 18 25 8 24 28 24 14 20 18 22 30 10 28 30 25 15 24 20 ]; m=reshape(m,[],5); v=rank_file(m); vexp=[4 7 10 13 14 ]; assert(isequal(vexp,v))

37   Pass
m=[7 3 10 7 9 14 3 9 7 15 14 11 19 6 14 9 19 17 17 20 7 15 14 24 20 19 24 10 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[6 9 11 19 ]; assert(isequal(vexp,v))

38   Pass
m=[14 7 33 34 30 19 29 23 15 30 9 3 18 3 16 7 25 25 21 18 9 39 35 37 22 32 24 19 33 11 7 21 7 17 9 27 30 23 23 11 45 43 40 27 36 27 24 38 16 12 25 9 20 15 35 35 32 24 18 48 44 43 28 38 31 27 39 20 16 28 14 24 17 37 36 36 28 19 54 46 50 34 46 34 29 41 25 18 29 15 27 21 38 41 37 31 22 57 50 51 37 50 37 34 45 27 23 34 19 28 24 43 46 41 36 23 60 57 56 46 54 41 41 56 35 25 37 21 36 30 53 49 49 38 27 64 66 58 50 55 43 46 61 36 29 38 25 37 32 55 53 54 43 33 67 71 66 51 61 45 50 66 40 30 41 30 39 37 58 56 56 48 35 73 73 71 57 66 50 54 67 45 33 46 34 44 39 64 57 60 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[12 15 16 23 24 27 32 35 38 43 ]; assert(isequal(vexp,v))

39   Pass
m=[11 8 12 6 3 3 11 13 7 8 4 14 12 17 8 4 4 14 16 9 10 5 16 15 19 11 6 7 17 18 11 14 9 21 18 22 15 8 8 19 22 14 18 12 22 19 24 16 11 11 22 23 17 21 14 23 22 26 19 13 12 24 26 18 22 17 ]; m=reshape(m,[],6); v=rank_file(m); vexp=[4 5 8 10 14 16 ]; assert(isequal(vexp,v))

40   Pass
m=[1 5 3 1 4 3 6 4 3 5 5 8 6 4 8 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[3 4 5 ]; assert(isequal(vexp,v))

41   Pass
m=[40 3 25 39 38 3 5 63 16 49 73 52 5 22 72 38 53 80 53 25 52 81 40 72 81 80 39 63 ]; m=reshape(m,[],4); v=rank_file(m); vexp=[16 22 49 73 ]; assert(isequal(vexp,v))

42   Pass
m=[3 2 2 1 3 4 3 3 2 4 5 4 4 3 5 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[1 2 3 ]; assert(isequal(vexp,v))

43   Pass
m=[9 10 2 8 8 1 9 1 6 4 11 2 4 11 13 3 9 10 2 11 2 8 5 13 3 5 14 14 5 12 11 4 13 4 10 6 16 5 6 15 16 8 13 13 6 15 6 12 10 17 8 10 17 18 9 14 14 8 17 8 13 11 19 10 12 18 20 11 17 17 9 18 9 15 13 21 11 14 20 22 13 18 19 10 21 11 16 14 22 13 16 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[6 8 10 12 13 15 17 ]; assert(isequal(vexp,v))

44   Pass
m=[11 5 9 2 7 13 2 8 6 7 6 4 9 14 8 16 4 10 16 4 14 8 12 10 6 12 16 10 18 5 11 17 6 15 10 13 11 8 13 17 11 19 6 13 19 7 17 11 15 13 10 14 19 13 21 7 15 20 9 19 13 17 14 12 17 20 16 23 8 17 22 11 20 15 19 17 14 19 23 17 24 9 19 24 13 22 18 20 19 16 21 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[4 6 8 10 12 14 16 ]; assert(isequal(vexp,v))

45   Pass
m=[11 6 11 10 14 16 13 8 12 9 3 3 7 13 16 17 7 6 5 20 12 18 15 25 26 21 18 20 13 6 5 15 23 27 29 11 9 9 22 14 21 20 28 29 24 21 23 17 7 6 16 24 29 32 14 12 11 26 17 26 23 31 37 32 24 29 19 9 7 19 27 34 37 16 15 13 27 20 29 26 33 40 35 26 30 24 10 8 23 29 37 40 21 18 15 31 21 31 27 35 41 36 29 33 26 11 11 26 33 38 43 22 20 18 33 23 33 29 37 44 38 30 34 27 12 13 29 34 40 46 24 23 20 36 24 35 33 40 47 40 35 37 31 13 14 32 38 42 47 28 25 21 40 25 38 37 44 49 42 38 40 34 15 16 35 41 46 48 29 27 23 41 29 43 40 47 52 47 40 46 37 16 17 37 44 49 52 32 29 26 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[15 23 25 35 38 40 41 44 46 48 ]; assert(isequal(vexp,v))

46   Pass
m=[14 11 6 9 7 14 2 13 9 17 12 2 3 19 14 10 13 10 17 5 17 11 19 14 3 7 22 19 11 16 11 18 7 21 13 21 16 6 10 23 21 13 18 16 22 9 22 18 25 21 9 11 28 23 16 21 19 26 12 26 21 28 23 11 14 31 26 18 22 21 29 14 29 22 30 26 13 17 32 28 21 25 22 31 17 30 23 32 28 14 19 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[5 7 10 13 14 17 19 ]; assert(isequal(vexp,v))

47   Pass
m=[15 15 21 3 7 11 25 22 5 18 9 11 3 16 19 29 12 25 18 18 20 26 7 10 12 28 23 10 20 11 15 5 21 22 34 19 28 22 21 24 30 11 11 14 33 28 12 23 14 16 9 26 24 39 22 30 27 23 28 33 15 15 16 34 34 18 25 21 23 11 29 29 40 24 35 30 24 31 34 18 19 22 37 39 20 26 23 25 12 34 33 41 26 43 38 28 37 39 19 20 24 43 45 22 31 24 29 15 41 37 47 33 49 43 29 39 43 21 21 26 45 50 26 34 30 33 16 43 41 49 34 51 47 30 43 47 25 22 27 50 52 28 38 33 34 18 45 43 58 37 55 50 34 44 50 26 23 28 52 55 31 39 35 37 22 47 45 59 39 58 54 35 47 51 29 28 30 55 59 34 43 39 40 25 49 49 63 41 63 58 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[26 31 35 37 39 44 47 54 55 58 ]; assert(isequal(vexp,v))

48   Pass
m=[1 9 5 2 11 15 6 3 15 1 8 17 3 2 18 11 8 12 7 2 13 8 5 14 17 10 6 16 2 12 19 8 5 20 12 11 15 10 3 18 13 6 20 25 13 11 23 3 15 24 11 8 26 20 18 21 15 5 21 16 8 23 29 16 13 28 6 17 29 13 10 30 25 22 26 19 7 23 17 10 24 30 19 15 30 8 22 32 15 12 31 26 24 28 22 8 26 21 11 27 35 22 18 33 9 24 34 18 13 37 29 26 31 23 11 29 23 12 31 38 25 20 37 11 26 40 20 14 39 31 27 34 24 13 32 26 15 33 39 26 21 38 12 28 42 23 15 42 34 31 37 28 15 35 28 17 38 40 29 23 40 15 30 43 25 16 45 37 33 39 30 18 37 29 20 39 43 30 24 45 17 31 48 26 19 48 40 34 42 32 ]; m=reshape(m,[],10); v=rank_file(m); vexp=[13 15 23 26 28 32 33 37 38 42 ]; assert(isequal(vexp,v))

49   Pass
m=[5 9 9 5 3 7 13 12 7 5 13 17 17 12 9 ]; m=reshape(m,[],3); v=rank_file(m); vexp=[3 5 9 ]; assert(isequal(vexp,v))

50   Pass
m=[13 6 8 11 8 4 2 1 10 3 10 5 7 18 7 11 15 11 5 4 2 14 4 12 8 9 21 11 15 19 12 10 5 5 17 8 18 10 13 25 15 19 22 15 12 7 8 20 11 20 11 17 28 20 25 25 17 17 9 10 23 14 27 13 23 30 22 28 28 19 19 11 11 25 15 29 15 25 32 25 30 29 20 21 12 13 27 18 32 18 28 ]; m=reshape(m,[],7); v=rank_file(m); vexp=[1 3 4 6 7 8 10 ]; assert(isequal(vexp,v)) toc

Elapsed time is 1.698333 seconds.

### Community Treasure Hunt

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

Start Hunting!