Cody

# Problem 2589. Find Elements in Range

Solution 522873

Submitted on 6 Nov 2014 by Abdullah Caliskan
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))

b = 1 4 1 7 1 10 1 2 1 8 4 7 4 10 4 2 4 8 7 10 7 2 7 8 10 2 10 8 2 8 ans = 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))

b = 10 15 10 18 10 12 10 3 10 7 10 2 15 18 15 12 15 3 15 7 15 2 18 12 18 3 18 7 18 2 12 3 12 7 12 2 3 7 3 2 7 2 ans = 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))

b = 10 15 10 18 10 12 10 4 10 7 10 2 15 18 15 12 15 4 15 7 15 2 18 12 18 4 18 7 18 2 12 4 12 7 12 2 4 7 4 2 7 2 ans = 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))

b = 10 15 10 18 10 12 10 4 10 7 10 2 15 18 15 12 15 4 15 7 15 2 18 12 18 4 18 7 18 2 12 4 12 7 12 2 4 7 4 2 7 2 ans = 0 0 0 0 0 0 0