Cody

Problem 248. Twins in a Window

Solution 2890616

Submitted on 29 Aug 2020 by Ramesh Kumar V
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
lowVal = 10; highVal = 50; p = [11 13 17 19 29 31 41 43]; assert(isequal(window_twins(lowVal,highVal),p))

m1 = 50 m2 = 50 a1 = [] a2 = [] a1 = 11 a2 = 13 a1 = 11 17 a2 = 13 19 a1 = 11 17 29 a2 = 13 19 31 a1 = 11 17 29 41 a2 = 13 19 31 43 z2 = 11 13 17 19 29 31 41 43

2   Pass
lowVal = 1000; highVal = 1050; p = [1019 1021 1031 1033]; assert(isequal(window_twins(lowVal,highVal),p))

m1 = 1050 m2 = 1050 a1 = [] a2 = [] a1 = 1019 a2 = 1021 a1 = 1019 1031 a2 = 1021 1033 z2 = 1019 1021 1031 1033

3   Pass
lowVal = 3120; highVal = 3300; p = [ 3167 3169 3251 3253 3257 3259]; assert(isequal(window_twins(lowVal,highVal),p))

m1 = 3300 m2 = 3300 a1 = [] a2 = [] a1 = 3167 a2 = 3169 a1 = 3167 3251 a2 = 3169 3253 a1 = 3167 3251 3257 a2 = 3169 3253 3259 z2 = 3167 3169 3251 3253 3257 3259

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!