Cody

Solution 1896632

Submitted on 10 Aug 2019 by Gunda Manoj
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 = [30 46 16 -46 35 44 18 26 25 -10]; correct = [8 9]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 16 c = 14 c = 76 c = 5 c = 14 c = 12 c = 4 c = 5 c = 40 c = 30 c = 92 c = 11 c = 2 c = 28 c = 20 c = 21 c = 56 c = 62 c = 19 c = 28 c = 2 c = 10 c = 9 c = 26 c = 81 c = 90 c = 64 c = 72 c = 71 c = 36 c = 9 c = 17 c = 9 c = 10 c = 45 c = 26 c = 18 c = 19 c = 54 c = 8 c = 7 c = 28 c = 1 c = 36 c = 35

2   Pass
A = [1555 -3288 2061 -4681 -2230 -4538 -4028 3235 1949 -1829]; correct = [3 9]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 4843 c = 506 c = 6236 c = 3785 c = 6093 c = 5583 c = 1680 c = 394 c = 3384 c = 5349 c = 1393 c = 1058 c = 1250 c = 740 c = 6523 c = 5237 c = 1459 c = 6742 c = 4291 c = 6599 c = 6089 c = 1174 c = 112 c = 3890 c = 2451 c = 143 c = 653 c = 7916 c = 6630 c = 2852 c = 2308 c = 1798 c = 5465 c = 4179 c = 401 c = 510 c = 7773 c = 6487 c = 2709 c = 7263 c = 5977 c = 2199 c = 1286 c = 5064 c = 3778

3   Pass
A = [-1 1 10 -10]; correct = [1 2]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 2 c = 11 c = 9 c = 9 c = 11 c = 20

4   Pass
A = [0 1000 -2000 1001 0]; correct = [1 5]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 1000 c = 2000 c = 1001 c = 0 c = 3000 c = 1 c = 1000 c = 3001 c = 2000 c = 1001

5   Pass
A = [1:1000 0.5]; correct = [1 1001]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 1 c = 2 c = 3 c = 4 c = 5 c = 6 c = 7 c = 8 c = 9 c = 10 c = 11 c = 12 c = 13 c = 14 c = 15 c = 16 c = 17 c = 18 c = 19 c = 20 c = 21 c = 22 c = 23 c = 24 c = 25 c = 26 c = 27 c = 28 c = 29 c = 30 c = 31 c = 32 c = 33 c = 34 c = 35 c = 36 c = 37 c = 38 c = 39 c = 40 c = 41 c = 42 c = 43 c = 44 c = 45 c = 46 c = 47 c = 48 c = 49 c = 50 c = 51 c = 52 c = 53 c = 54 c = 55 c = 56 c = 57 c = 58 c = 59 c = 60 c = 61 c = 62 c = 63 c = 64 c = 65 c = 66 c = 67 c = 68 c = 69 c = 70 c = 71 c = 72 c = 73 c = 74 c = 75 c = 76 c = 77 c = 78 c = 79 c = 80 c = 81 c = 82 c = 83 c = 84 c = 85 c = 86 c = 87 c = 88 c = 89 c = 90 c = 91 c = 92 c = 93 c = 94 c = 95 c = 96 c = 97 c = 98 c = 99 c = 100 c = 101 c = 102 c = 103 c = 104 c = 105 c = 106 c = 107 c = 108 c = 109 c = 110 c = 111 c = 112 c = 113 c = 114 c = 115 c = 116 c = 117 c = 118 c = 119 c = 120 c = 121 c = 122 c = 123 c = 124 c = 125 c = 126 c = 127 c = 128 c = 129 c = 130 c = 131 c = 132 c = 133 c = 134 c = 135 c = 136 c = 137 c = 138 c = 139 c = 140 c = 141 c = 142 c = 143 c = 144 c = 145 c = 146 c = 147 c = 148 c = 149 c = 150 c = 151 c = 152 c = 153 c = 154 c = 155 c = 156 c = 157 c = 158 c = 159 c = 160 c = 161 c = 162 c = 163 c = 164 c = 165 c = 166 c = 167 c = 168 c = 169 c = 170 c = 171 c = 172 c = 173 c = 174 c = 175 c = 176 c = 177 c = 178 c = 179 c = 180 c = 181 c = 182 c = 183 c = 184 c = 185 c = 186 c = 187 c = 188 c = 189 c = 190 c = 191 c = 192 c = 193 c = 194 c = 195 c = 196 c = 197 c = 198 c = 199 c = 200 c = 201 c = 202 c = 203 c = 204 c = 205 c = 206 c = 207 c = 208 c = 209 c = 210 c = 211 c = 212 c = 213 c = 214 c = 215 c = 216 c = 217 c = 218 c = 219 c = 220 c = 221 c = 222 c = 223 c = 224 c = 225 c = 226 c = 227 c = 228 c = 229 c = 230 c = 231 c = 232 c = 233 c = 234 c = 235 c = 236 c = 237 c = 238 c = 239 c = 240 c = 241 c = 242 c = 243 c = 244 c = 245 c = 246 c = 247 c = 248 c = 249 c = 250 c = 251 c = 252 c = 253 c = 254 c = 255 c = 256 c = 257 c = 258 c = 259 c = 260 c = 261 c = 262 c = 263 c = 264 c = 265 c = 266 c = 267 c = 268 c = 269 c = 270 c = 271 c = 272 c = 273 c = 274 c = 275 c = 276 c = 277 c = 278 c = 279 c = 280 c = 281 c = 282 c = 283 c = 284 c = 285 c = 286 c = 287 c = 288 c = 289 c = 290 c = 291 c = 292 c = 293 c = 294 c = 295 c = 296 c = 297 c = 298 c = 299 c = 300 c = 301 c = 302 c = 303 c = 304 c = 305 c = 306 c = 307 c = 308 c = 309 c = 310 c = 311 c = 312 c = 313 c = 314 c = 315 c = 316 c = 317 c = 318 c = 319 c = 320 c = 321 c = 322 c = 323 c = 324 c = 325 c = 326 c = 327 c = 328 c = 329 c = 330 c = 331 c = 332 c = 333 c = 334 c = 335 c = 336 c = 337 c = 338 c = 339 c = 340 c = 341 c = 342 c = 343 c = 344 c = 345 c = 346 c = 347 c = 348 c = 349 c = 350 c = 351 c = 352 c = 353 c = 354 c = 355 c = 356 c = 357 c = 358 c = 359 c = 360 c = 361 c = 362 c = 363 c = 364 c = 365 c = 366 c = 367 c = 368 c = 369 c = 370 c = 371 c = 372 c = 373 c = 374 c = 375 c = 376 c = 377 c = 378 c = 379 c = 380 c = 381 c = 382 c = 383 c = 384 c = 385 c = 386 c = 387 c = 388 c = 389 c = 390 c = 391 c = 392 c = 393 c = 394 c = 395 c = 396 c = 397 c = 398 c = 399 c = 400 c = 401 c = 402 c = 403 c = 404 c = 405 c = 406 c = 407 c = 408 c = 409 c = 410 c = 411 c = 412 c = 413 c = 414 c = 415 c = 416 c = 417 c = 418 c = 419 c = 420 c = 421 c = 422 c = 423 c = 424 c = 425 c = 426 c = 427 c = 428 c = 429 c = 430 c = 431 c = 432 c = 433 c = 434 c = 435 c = 436 c = 437 c = 438 c = 439 c = 440 c = 441 c = 442 c = 443 c = 444 c = 445 c = 446 c = 447 c = 448 c = 449 c = 450 c = 451 c = 452 c = 453 c = 454 c = 455 c = 456 c = 457 c = 458 c = 459 c = 460 c = 461 c = 462 c = 463 c = 464 c = 465 c = 466 c = 467 c = 468 c = 469 c = 470 c = 471 c = 472 c = 473 c = 474 c = 475 c = 476 c = 477 c = 478 c = 479 c = 480 c = 481 c = 482 c = 483 c = 484 c = 485 c = 486 c = 487 c = 488 c = 489 c = 490 c = 491 c = 492 c = 493 c = 494 c = 495 c = 496 c = 497 c = 498 c = 499 c = 500 c = 501 c = 502 c = 503 c = 504 c = 505 c = 506 c = 507 c = 508 c = 509 c = 510 c = 511 c = 512 c = 513 c = 514 c = 515 c = 516 c = 517 c = 518 c = 519 c = 520 c = 521 c = 522 c = 523 c = 524 c = 525 c = 526 c = 527 c = 528 c = 529 c = 530 c = 531 c = 532 c = 533 c = 534 c = 535 c = 536 c = 537 c = 538 c = 539 c = 540 c = 541 c = 542 c = 543 c = 544 c = 545 c = 546 c = 547 c = 548 c = 549 c = 550 c = 551 c = 552 c = 553 c = 554 c = 555 c = 556 c = 557 c = 558 c = 559 c = 560 c = 561 c = 562 c = 563 c = 564 c = 565 c = 566 c = 567 c = 568 c = 569 c = 570 c = 571 c = 572 c = 573 c = 574 c = 575 c = 576 c = 577 c = 578 c = 579 c = 580 c = 581 c = 582 c = 583 c = 584 c = 585 c = 586 c = 587 c = 588 c = 589 c = 590 c = 591 c = 592 c = 593 c = 594 c = 595 c = 596 c = 597 c = 598 c = 599 c = 600 c = 601 c = 602 c = 603 c = 604 c = 605 c = 606 c = 607 c = 608 c = 609 c = 610 c = 611 c = 612 c = 613 c = 614 c = 615 c = 616 c = 617 c = 618 c = 619 c = 620 c = 621 c = 622 c = 623 c = 624 c = 625 c = 626 c = 627 c = 628 c = 629 c = 630 c = 631 c = 632 c = 633 c = 634 c = 635 c = 636 c = 637 c = 638 c = 639 c = 640 c = 641 c = 642 c = 643 c = 644 c = 645 c = 646 c = 647 c = 648 c = 649 c = 650 c = 651 c = 652 c = 653 c = 654 c = 655 c = 656 c = 657 c = 658 c = 659 c = 660 c = 661 c = 662 c = 663 c = 664 c = 665 c = 666 c = 667 c = 668 c = 669 c = 670 c = 671 c = 672 c = 673 c = 674 c = 675 c = 676 c = 677 c = 678 c = 679 c = 680 c = 681 c = 682 c = 683 c = 684 c = 685 c = 686 c = 687 c = 688 c = 689 c = 690 c = 691 c = 692 c = 693 c = 694 c = 695 c = 696 c = 697 c = 698 c = 699 c = 700 c = 701 c = 702 c = 703 c = 704 c = 705 c = 706 c = 707 c = 708 c = 709 c = 710 c = 711 c = 712 c = 713 c = 714 c = ...

6   Pass
% Area codes A = [847 217 508 312 212]; correct = [2 5]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 630 c = 339 c = 535 c = 635 c = 291 c = 95 c = 5 c = 196 c = 296 c = 100

7   Pass
% Zip codes A = [60048 61802 01702 60601 10001]; correct = [1 4]; [i1 i2] = nearestNumbers(A); assert(isequal([i1 i2],correct))

c = 1754 c = 58346 c = 553 c = 50047 c = 60100 c = 1201 c = 51801 c = 58899 c = 8299 c = 50600

Suggested Problems

More from this Author95