Cody

Solution 1587963

Submitted on 20 Jul 2018 by Jiahang Li
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
x = [1 0 0 2 0]; y_correct = [1 1 1 2 2]; assert(isequal(bleed_to_the_right(x),y_correct)) filetext = fileread('bleed_to_the_right.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp* command is forbidden') assert(isempty(strfind(filetext, 'eval')),'eval* command is forbidden') assert(isempty(strfind(filetext, 'inline')),'inline command is forbidden')

ans = 1 1 1 2 2

2   Pass
x = [0 0 -12 13 0 i 0 -i 76.54321 0 0]; y_correct = [0 0 -12 13 13 i i -i 76.54321 76.54321 76.54321]; assert(isequal(bleed_to_the_right(x),y_correct))

ans = Columns 1 through 9 0.0000 + 0.0000i 0.0000 + 0.0000i -12.0000 + 0.0000i 13.0000 + 0.0000i 13.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 + 1.0000i 0.0000 - 1.0000i 76.5432 + 0.0000i Columns 10 through 11 76.5432 + 0.0000i 76.5432 + 0.0000i

3   Pass
x = [1:100 0]; y_correct = [1:100 100]; assert(isequal(bleed_to_the_right(x),y_correct))

ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 101 88 89 90 91 92 93 94 95 96 97 98 99 100 100

4   Pass
x = rand(1,1000); x(randi(500,1,50)*2) = 0; y_correct = x; y_correct(~y_correct) = y_correct(find(~y_correct)-1); assert(isequal(bleed_to_the_right(x),y_correct))

ans = Columns 1 through 17 0.5313 0.9849 0.3856 0.8058 0.6169 0.9395 0.7858 0.1801 0.2975 0.5896 0.8987 0.6266 0.2667 0.9506 0.2247 0.5391 0.8037 Columns 18 through 34 0.9904 0.4933 0.4048 0.7281 0.4679 0.5951 0.9620 0.7193 0.7193 0.2013 0.2327 0.2047 0.3417 0.1536 0.3095 0.1087 0.9905 Columns 35 through 51 0.1937 0.3855 0.7996 0.4744 0.2964 0.7608 0.1147 0.9441 0.6279 0.7075 0.1802 0.8996 0.5722 0.7592 0.1364 0.1364 0.8893 Columns 52 through 68 0.7718 0.3886 0.1785 0.8118 0.3523 0.4163 0.7948 0.8848 0.6354 0.9655 0.2256 0.8618 0.8618 0.2141 0.3183 0.9739 0.9936 Columns 69 through 85 0.2569 0.1858 0.1960 0.9976 0.4812 0.9014 0.7488 0.8998 0.3259 0.4730 0.7319 0.1214 0.2907 0.1480 0.0028 0.0028 0.2891 Columns 86 through 102 0.8317 0.5776 0.5776 0.4690 0.9918 0.3713 0.5239 0.6127 0.5666 0.7135 0.8486 0.9972 0.9613 0.6966 0.3742 0.2578 0.8960 Columns 103 through 119 0.8962 0.8212 0.0709 0.9459 0.7995 0.8721 0.2782 0.2782 0.6651 0.4938 0.5957 0.3269 0.8143 0.6700 0.0788 0.1436 0.0630 Columns 120 through 136 0.5932 0.7082 0.7082 0.8776 0.1510 0.3081 0.9450 0.9158 0.4359 0.2330 0.9016 0.8956 0.8984 0.1287 0.2792 0.1066 0.1066 Columns 137 through 153 0.5353 0.4546 0.7146 0.1758 0.7229 0.2784 0.1710 0.0394 0.3885 0.9632 0.0033 0.6033 0.8186 0.8186 0.6234 0.2072 0.4826 Columns 154 through 170 0.4603 0.5628 0.4076 0.4996 0.0857 0.6154 0.1629 0.8129 0.8129 0.4586 0.2591 0.9583 0.9583 0.7020 0.3667 0.4641 0.8743 Columns 171 through 187 0.4123 0.7869 0.8676 0.1758 0.0207 0.1443 0.8620 0.9008 0.9852 0.2715 0.9627 0.2807 0.0438 0.8294 0.9378 0.4707 0.6603 Columns 188 through 204 0.7571 0.4548 0.8932 0.6320 0.5995 0.2791 0.7629 0.6336 0.8830 0.0859 0.6533 0.5074 0.8325 0.2623 0.1708 0.6709 0.6709 Columns 205 through 221 0.2270 0.0662 0.9925 0.2168 0.3344 0.4463 0.0922 0.5176 0.0845 0.2503 0.6137 0.7555 0.0221 0.0479 0.0322 0.3659 0.2391 Columns 222 through 238 0.0145 0.9387 0.8850 0.4229 0.9348 0.9985 0.7940 0.4865 0.9883 0.6574 0.5216 0.1203 0.7904 0.5808 0.2083 0.2593 0.4842 Columns 239 through 255 0.4082 0.4760 0.3062 0.3062 0.1112 0.5030 0.4912 0.2616 0.4794 0.1898 0.7900 0.5208 0.8320 0.5163 0.8782 0.2959 0.9780 Columns 256 through 272 0.0505 0.2308 0.3451 0.7593 0.0049 0.8844 0.6247 0.0484 0.5435 0.2554 0.6295 0.7599 0.8510 0.0509 0.3466 0.6775 0.0526 Columns 273 through 289 0.0007 0.3170 0.4924 0.8059 0.1225 0.9724 0.7897 0.1698 0.2482 0.5382 0.8699 0.2308 0.3666 0.5990 0.0041 0.9039 0.5796 Columns 290 through 306 0.7653 0.7000 0.9597 0.8040 0.5309 0.4298 0.8339 0.7567 0.9666 0.5117 0.5117 0.9138 0.1823 0.4254 0.5114 0.7069 0.0635 Columns 307 through 323 0.1714 0.9018 0.2006 0.0838 0.0974 0.8197 0.6679 0.6945 0.3737 0.0351 0.2429 0.1632 0.3152 0.4382 0.2401 0.2314 0.5978 Columns 324 through 340 0.8685 0.4128 0.6404 0.2393 0.7651 0.4065 0.9020 0.0893 0.0893 0.1802 0.8347 0.0051 0.0051 0.7286 0.0063 0.5289 0.9027 Columns 341 through 357 0.1205 0.7722 0.8918 0.2854 0.5261 0.5700 0.5264 0.4641 0.9339 0.1268 0.9745 0.0954 0.7988 0.4540 0.9262 0.7228 0.5850 Columns 358 through 374 0.8279 0.3512 0.4278 0.7245 0.8271 0.4381 0.3346 0.7256 0.9152 0.7231 0.9305 0.4757 0.1965 0.8293 0.3750 0.4400 0.9787 Columns 375 through 391 0.8729 0.1835 0.7499 0.9324 0.4972 0.1013 0.5053 0.1775 0.7254 0.5987 0.1529 0.4664 0.0570 0.9162 0.7221 0.8528 0.8476 Columns 392 through 408 0.8109 0.3862 0.4391 0.4381 0.5322 0.0091 0.5537 0.2316 0.5166 0.6287 0.4568 0.3916 0.3916 0.0255 0.0789 0.6364 0.4025 Columns 409 through 425 0.7218 0.2752 0.5695 0.5710 0.1191 0.4353 0.8495 0.8924 0.3723 0.8690 0.5011 0.0250 0.4967 0.5289 0.4995 0.3531 0.2767 Columns 426 through 442 0.3117 0.1029 0.8185 0.6606 0.3986 0.7481 0.4631 0.4477 0.4901 0.3494 0.3405 0.9799 0.4162 0.0726 0.0726 0.2204 0.7865 Columns 443 through 459 0.1901 0.7270 0.9608 0.1746 0.7784 0.8904 0.2658 0.9599 0.1426 0.0038 0.8887 0.0571 0.4359 0.8229 0.5074 0.5734 0.3533 Columns 460 through 476 0.8885 0.2385 0.6251 0.1875 0.1875 0.3454 0.7030 0.9296 0.7646 0.6061 0.8494 0.5293 0.8089 0.5458 0.5998 0.7843 0.5611 Columns 477 through 493 0.8126 0.1663 0.7058 0.1254 0.0288 0.6992 0.0549 0.0588 0.0559 0.0253 0.4740 0.5589 0.7593 0.2943 0.2024 0.6278 0.7259 Columns 494 through 510 0.4788 0.7513 0.7513 0.8735 0.4617 0.5075 0.1213 0.5958 0.4797 0.0515 0.7699 0.9590 0.0718 0.3274 0.6008 0.4868 0.4322 Columns 511 through 527 0.5661 0.4250 0.3530 0.5865 0.3038 0.3290 0.0582 0.9023 0.8713 0.0183 0.3020 0.0235 0.0372 0.6021 0.2809 0.1085 0.7897 Columns 528 through 544 0.1947 0.7036 0.1763 0.5443 0.3803 0.0303 0.5646 0.9661 0.3345 0.6016 0.9726 0.1852 0.1852 0.5562 0.2684 0.5717 0.7717 Columns 545 through 561 0.4692 0.7907 0.9782 0.4293 0.6906 0.7765 0.6492 0.1974 0.7942 0.5730 0.6442 0.1972 0.8159 0.5376 0.0934 0.0934 0.1071 Columns 562 through 578 0.4355 0.4599 0.3685 0.6895 0.6895 0.0253 0.6787 0.2818 0.8925 0.3269 0.8929 0.7686 0.6276 0.7249 0.9053 0.8924 0.4158 Columns 579 through 595 0.9358 0.0849 0.4743 0.3803 0.9847 0.0400 0.3729 0.1176 0.1636 0.8689 0.9484 0.9484 0.6752 0.0546 0.8520 0.9115 0.9729 Columns 596 through 612 0.9173 0.5616 0.4976 0.7583 0.7380 0.0594 0.7568 0.2503 0.2503 0.2429 0.0670 0.3258 0.9414 0.5796 0.3964 0.3444 0.6906 Columns 613 through 629 0.2158 0.3782 0.2603 0.4532 0.8527 0.8520 0.5603 0.2691 0.9118 0.4561 0.2844 0.3308 0.4977 0.6132 0.2788 0.8521 0.3395 Columns 630 through 646 0.3395 0.1430 0.1430 0.2070 0.8130 0.7388 0.4230 0.8991 0.6361 0.5078 0.6199 0.2596 0.9772 0.2226 0.3055 0.9874 0.9874 Columns 647 through 663 0.5456 0.3273 0.7402 0.9784 0.7155 0.6692 0.1715 0.2842 0.6034 0.7086 0.0771 0.7038 0.7862 0.2911 0.1513 0.7954 0.6718 Columns 664 through 680 0.5375 0.3461 0.4587 0.6036 0.9523 0.1187 0.5560 0.1010 0.5929 0.4912 0.9037 0.1216 0.7627 0.9344 0.1625 0.2203 0.1303 Columns 681 through 697 0.4925 0.0249 0.7281 0.0106 0.7563 0.7335 0.1453 0.5270 0.7943 0.5549 0.5104 0.6957 0.1509 0.0329 0.6777 0.3510 0.3962 Columns 698 through 714 0.1517 0.8808 0.5778 0.1826 0.3966 0.1272 0.1530 0.2108 0.2108 0.8509 0.8314 0.5135 0.5587 0.3655 0.0706 0.4504 0.3499 Columns 715 through 731 0.9654 0.9650 0.4639 0.6554 0.7233 0.4021 0.1356 0.0812 0.4847 0.5196 0.4860 0.7911 0.5444 0.5444 0.1359 0.5622 0.5489 Columns 732 through 748 0.7446 0.5111 0.4988 0.7124 0.1241 0.6768 0.9473 0.3820 0.9407 0.7621 0.0868 0.0864 0.8491 0.8069 0.7170 0.0041 0.3789 Columns 749 through 765 0.8436 0.8436 0.9024 0.6055 0.9203 0.9060 0.3859 0.7792 0.6720 0.3701 0.3659 0.4921 0.3697 0.3697 0.0743 0.7526 0.9350 Columns 766 through 782 0.9350 0.2218 0.0827 0.7130 0.1739 0.0651 0.3995 0.6273 0.5367 0.5226 0.0376 0.1062 0.8736 0.6479 0.6790 0.3071 0.6931 Columns 783 through 799 0.5546 0.5546 0.9066 0.5033 0.8895 0.6839 0.5048 0.1998 0.7949 0.7949 0.2767 0.7107 0.7959 0.0228 0.5734 0.5780 0.6447 Columns 800 through 816 0.5681 0.6021 0.3309 0.6561 0.5162 0.7983 0.0587 0.7732 0.7732 0.2363 0.2363 0.1525 0.7979 0.5382 0.2044 0.7712 0.1611 Columns 817 through 833 0.4200 0.3338 0.2296 0.1826 0.7487 0.5333 0.0444 0.1847 0.6000 0.5927 0.4124 0.0032 0.1734 0.7165 0.0221 0.9709 0.6045 Columns 834 through 850 0.1422 0.1893 0.8321 0.6985 0.4937 0.7968 0.0624 0.4554 0.4670 0.7150 0.2052 0.2622 0.8910 0.5376 0.6914 0.4601 0.2250 Columns 851 through 867 0.5606 0.5606 0.28...

5   Pass
x = sqrt(1:100); y_correct = floor(x); x(x~=floor(x)) = 0; assert(isequal(bleed_to_the_right(x),y_correct))

ans = Columns 1 through 29 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 Columns 30 through 58 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 Columns 59 through 87 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 Columns 88 through 100 9 9 9 9 9 9 9 9 9 9 9 9 10