Cody

# Problem 801. Construct an index vector from two input vectors in vectorized fashion

Solution 1943236

Submitted on 19 Sep 2019
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   Fail
x1 = 1; x2 = 5; y_correct = [1:5]; assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

steps = 5 M = 1 2 3 4 5

Output argument "ans" (and maybe others) not assigned during call to "interleaved_idx". Error in Test1 (line 3) assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

2   Fail
x1 = [7 10 13]; x2 = [9 12 15]; y_correct = [7:15]; assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

steps = 3 M = 7 8 9 10 11 12 13 14 15

Output argument "ans" (and maybe others) not assigned during call to "interleaved_idx". Error in Test2 (line 3) assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

3   Fail
x1 = [13 7]; x2 = [15 9]; y_correct = [13 14 15 7 8 9]; assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

steps = 3 M = 13 14 15 7 8 9

Output argument "ans" (and maybe others) not assigned during call to "interleaved_idx". Error in Test3 (line 3) assert(isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

4   Fail
x1=[1:5:5000];x2=[4:5:5000];y_correct=setdiff([1:5000],[5:5:5000]); assert( isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )

steps = 4 M = 1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21 22 23 24 26 27 28 29 31 32 33 34 36 37 38 39 41 42 43 44 46 47 48 49 51 52 53 54 56 57 58 59 61 62 63 64 66 67 68 69 71 72 73 74 76 77 78 79 81 82 83 84 86 87 88 89 91 92 93 94 96 97 98 99 101 102 103 104 106 107 108 109 111 112 113 114 116 117 118 119 121 122 123 124 126 127 128 129 131 132 133 134 136 137 138 139 141 142 143 144 146 147 148 149 151 152 153 154 156 157 158 159 161 162 163 164 166 167 168 169 171 172 173 174 176 177 178 179 181 182 183 184 186 187 188 189 191 192 193 194 196 197 198 199 201 202 203 204 206 207 208 209 211 212 213 214 216 217 218 219 221 222 223 224 226 227 228 229 231 232 233 234 236 237 238 239 241 242 243 244 246 247 248 249 251 252 253 254 256 257 258 259 261 262 263 264 266 267 268 269 271 272 273 274 276 277 278 279 281 282 283 284 286 287 288 289 291 292 293 294 296 297 298 299 301 302 303 304 306 307 308 309 311 312 313 314 316 317 318 319 321 322 323 324 326 327 328 329 331 332 333 334 336 337 338 339 341 342 343 344 346 347 348 349 351 352 353 354 356 357 358 359 361 362 363 364 366 367 368 369 371 372 373 374 376 377 378 379 381 382 383 384 386 387 388 389 391 392 393 394 396 397 398 399 401 402 403 404 406 407 408 409 411 412 413 414 416 417 418 419 421 422 423 424 426 427 428 429 431 432 433 434 436 437 438 439 441 442 443 444 446 447 448 449 451 452 453 454 456 457 458 459 461 462 463 464 466 467 468 469 471 472 473 474 476 477 478 479 481 482 483 484 486 487 488 489 491 492 493 494 496 497 498 499 501 502 503 504 506 507 508 509 511 512 513 514 516 517 518 519 521 522 523 524 526 527 528 529 531 532 533 534 536 537 538 539 541 542 543 544 546 547 548 549 551 552 553 554 556 557 558 559 561 562 563 564 566 567 568 569 571 572 573 574 576 577 578 579 581 582 583 584 586 587 588 589 591 592 593 594 596 597 598 599 601 602 603 604 606 607 608 609 611 612 613 614 616 617 618 619 621 622 623 624 626 627 628 629 631 632 633 634 636 637 638 639 641 642 643 644 646 647 648 649 651 652 653 654 656 657 658 659 661 662 663 664 666 667 668 669 671 672 673 674 676 677 678 679 681 682 683 684 686 687 688 689 691 692 693 694 696 697 698 699 701 702 703 704 706 707 708 709 711 712 713 714 716 717 718 719 721 722 723 724 726 727 728 729 731 732 733 734 736 737 738 739 741 742 743 744 746 747 748 749 751 752 753 754 756 757 758 759 761 762 763 764 766 767 768 769 771 772 773 774 776 777 778 779 781 782 783 784 786 787 788 789 791 792 793 794 796 797 798 799 801 802 803 804 806 807 808 809 811 812 813 814 816 817 818 819 821 822 823 824 826 827 828 829 831 832 833 834 836 837 838 839 841 842 843 844 846 847 848 849 851 852 853 854 856 857 858 859 861 862 863 864 866 867 868 869 871 872 873 874 876 877 878 879 881 882 883 884 886 887 888 889 891 892 893 894 896 897 898 899 901 902 903 904 906 907 908 909 911 912 913 914 916 917 918 919 921 922 923 924 926 927 928 929 931 932 933 934 936 937 938 939 941 942 943 944 946 947 948 949 951 952 953 954 956 957 958 959 961 962 963 964 966 967 968 969 971 972 973 974 976 977 978 979 981 982 983 984 986 987 988 989 991 992 993 994 996 997 998 999 1001 1002 1003 1004 1006 1007 1008 1009 1011 1012 1013 1014 1016 1017 ...

Output argument "ans" (and maybe others) not assigned during call to "interleaved_idx". Error in Test4 (line 2) assert( isequal(interleaved_idx(x1,x2),y_correct) && isempty(regexp(evalc('type interleaved_idx'),'(eval|for|while|)')) )