Cody

Problem 248. Twins in a Window

Solution 452836

Submitted on 10 Jun 2014 by rifat
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))

data = Columns 1 through 16 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Columns 17 through 32 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 Columns 33 through 41 42 43 44 45 46 47 48 49 50 ans = 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))

data = Columns 1 through 8 1000 1001 1002 1003 1004 1005 1006 1007 Columns 9 through 16 1008 1009 1010 1011 1012 1013 1014 1015 Columns 17 through 24 1016 1017 1018 1019 1020 1021 1022 1023 Columns 25 through 32 1024 1025 1026 1027 1028 1029 1030 1031 Columns 33 through 40 1032 1033 1034 1035 1036 1037 1038 1039 Columns 41 through 48 1040 1041 1042 1043 1044 1045 1046 1047 Columns 49 through 51 1048 1049 1050 ans = 1019 1021 1031 1033

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

data = Columns 1 through 8 3120 3121 3122 3123 3124 3125 3126 3127 Columns 9 through 16 3128 3129 3130 3131 3132 3133 3134 3135 Columns 17 through 24 3136 3137 3138 3139 3140 3141 3142 3143 Columns 25 through 32 3144 3145 3146 3147 3148 3149 3150 3151 Columns 33 through 40 3152 3153 3154 3155 3156 3157 3158 3159 Columns 41 through 48 3160 3161 3162 3163 3164 3165 3166 3167 Columns 49 through 56 3168 3169 3170 3171 3172 3173 3174 3175 Columns 57 through 64 3176 3177 3178 3179 3180 3181 3182 3183 Columns 65 through 72 3184 3185 3186 3187 3188 3189 3190 3191 Columns 73 through 80 3192 3193 3194 3195 3196 3197 3198 3199 Columns 81 through 88 3200 3201 3202 3203 3204 3205 3206 3207 Columns 89 through 96 3208 3209 3210 3211 3212 3213 3214 3215 Columns 97 through 104 3216 3217 3218 3219 3220 3221 3222 3223 Columns 105 through 112 3224 3225 3226 3227 3228 3229 3230 3231 Columns 113 through 120 3232 3233 3234 3235 3236 3237 3238 3239 Columns 121 through 128 3240 3241 3242 3243 3244 3245 3246 3247 Columns 129 through 136 3248 3249 3250 3251 3252 3253 3254 3255 Columns 137 through 144 3256 3257 3258 3259 3260 3261 3262 3263 Columns 145 through 152 3264 3265 3266 3267 3268 3269 3270 3271 Columns 153 through 160 3272 3273 3274 3275 3276 3277 3278 3279 Columns 161 through 168 3280 3281 3282 3283 3284 3285 3286 3287 Columns 169 through 176 3288 3289 3290 3291 3292 3293 3294 3295 Columns 177 through 181 3296 3297 3298 3299 3300 ans = 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!