Cody

# Problem 2589. Find Elements in Range

Solution 2162128

Submitted on 16 Mar 2020 by Alexander
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))

As = 1 2 4 7 8 10 b = 1×5 logical array 1 0 0 1 0 ind = 1×6 logical array 1 1 0 1 1 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))

As = 2 3 7 10 12 15 18 b = 1×6 logical array 1 0 0 1 0 0 ind = 1×7 logical array 1 1 0 1 1 0 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))

As = 2 4 7 10 12 15 18 b = 1×6 logical array 1 1 1 1 1 1 ind = 1×7 logical array 1 1 1 1 1 1 1 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))

As = 2 4 7 10 12 15 18 b = 1×6 logical array 0 0 0 0 0 0 ind = 1×7 logical array 0 0 0 0 0 0 0 tf = 1×7 logical array 0 0 0 0 0 0 0