Cody

# Problem 2589. Find Elements in Range

Solution 1462279

Submitted on 13 Mar 2018 by Isaias Araya
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
A = [1 4 7 10 2 8]; range = 1; inrange = [1 0 1 0 1 1]; assert(isequal(isinrange(A, range),inrange))

diff = 0 diff = 3 diff = 6 diff = 9 diff = 1 tf = 1 diff = 7 diff = 3 diff = 0 diff = 3 diff = 6 diff = 2 diff = 4 diff = 6 diff = 3 diff = 0 diff = 3 diff = 5 diff = 1 tf = 1 0 1 diff = 9 diff = 6 diff = 3 diff = 0 diff = 8 diff = 2 diff = 1 tf = 1 0 1 0 1 diff = 2 diff = 5 diff = 8 diff = 0 diff = 6 diff = 7 diff = 4 diff = 1 tf = 1 0 1 0 1 1 diff = 2 diff = 6 diff = 0

2   Pass
A = [10 15 18 12 3 7 2]; range = 2; inrange = [1 0 0 1 1 0 1]; assert(isequal(isinrange(A, range),inrange))

diff = 0 diff = 5 diff = 8 diff = 2 tf = 1 diff = 7 diff = 3 diff = 8 diff = 5 diff = 0 diff = 3 diff = 3 diff = 12 diff = 8 diff = 13 diff = 8 diff = 3 diff = 0 diff = 6 diff = 15 diff = 11 diff = 16 diff = 2 tf = 1 0 0 1 diff = 3 diff = 6 diff = 0 diff = 9 diff = 5 diff = 10 diff = 7 diff = 12 diff = 15 diff = 9 diff = 0 diff = 4 diff = 1 tf = 1 0 0 1 1 diff = 3 diff = 8 diff = 11 diff = 5 diff = 4 diff = 0 diff = 5 diff = 8 diff = 13 diff = 16 diff = 10 diff = 1 tf = 1 0 0 1 1 0 1 diff = 5 diff = 0

3   Pass
A = [10 15 18 12 4 7 2]; range = 3; inrange = [1 1 1 1 1 1 1]; assert(isequal(isinrange(A, range),inrange))

diff = 0 diff = 5 diff = 8 diff = 2 tf = 1 diff = 6 diff = 3 tf = 1 diff = 8 diff = 5 diff = 0 diff = 3 tf = 1 1 diff = 3 tf = 1 1 diff = 11 diff = 8 diff = 13 diff = 8 diff = 3 tf = 1 1 1 diff = 0 diff = 6 diff = 14 diff = 11 diff = 16 diff = 2 tf = 1 1 1 1 diff = 3 tf = 1 1 1 1 diff = 6 diff = 0 diff = 8 diff = 5 diff = 10 diff = 6 diff = 11 diff = 14 diff = 8 diff = 0 diff = 3 tf = 1 1 1 1 1 diff = 2 tf = 1 1 1 1 1 diff = 3 tf = 1 1 1 1 1 1 diff = 8 diff = 11 diff = 5 diff = 3 tf = 1 1 1 1 1 1 diff = 0 diff = 5 diff = 8 diff = 13 diff = 16 diff = 10 diff = 2 tf = 1 1 1 1 1 1 1 diff = 5 diff = 0

4   Pass
A = [10 15 18 12 4 7 2]; range = 1; inrange = [0 0 0 0 0 0 0]; assert(isequal(isinrange(A, range),inrange))

diff = 0 diff = 5 diff = 8 diff = 2 diff = 6 diff = 3 diff = 8 diff = 5 diff = 0 diff = 3 diff = 3 diff = 11 diff = 8 diff = 13 diff = 8 diff = 3 diff = 0 diff = 6 diff = 14 diff = 11 diff = 16 diff = 2 diff = 3 diff = 6 diff = 0 diff = 8 diff = 5 diff = 10 diff = 6 diff = 11 diff = 14 diff = 8 diff = 0 diff = 3 diff = 2 diff = 3 diff = 8 diff = 11 diff = 5 diff = 3 diff = 0 diff = 5 diff = 8 diff = 13 diff = 16 diff = 10 diff = 2 diff = 5 diff = 0