Cody

# Problem 2589. Find Elements in Range

Solution 1940585

Submitted on 17 Sep 2019 by Augusto Mazzei
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))

dd = 0 3 6 9 1 7 3 0 3 6 2 4 6 3 0 3 5 1 9 6 3 0 8 2 1 2 5 8 0 6 7 4 1 2 6 0 tf = 1×6 logical array 1 0 1 0 1 1

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

dd = 0 5 8 2 7 3 8 5 0 3 3 12 8 13 8 3 0 6 15 11 16 2 3 6 0 9 5 10 7 12 15 9 0 4 1 3 8 11 5 4 0 5 8 13 16 10 1 5 0 tf = 1×7 logical array 1 0 0 1 1 0 1

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

dd = 0 5 8 2 6 3 8 5 0 3 3 11 8 13 8 3 0 6 14 11 16 2 3 6 0 8 5 10 6 11 14 8 0 3 2 3 8 11 5 3 0 5 8 13 16 10 2 5 0 tf = 1×7 logical array 1 1 1 1 1 1 1

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

dd = 0 5 8 2 6 3 8 5 0 3 3 11 8 13 8 3 0 6 14 11 16 2 3 6 0 8 5 10 6 11 14 8 0 3 2 3 8 11 5 3 0 5 8 13 16 10 2 5 0 tf = 1×7 logical array 0 0 0 0 0 0 0