Cody

Problem 45459. Minimal Path - 04

Solution 2934019

Submitted on 10 Sep 2020 by Alfonso Nieto-Castanon
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 12 4 6 8 10 100 ; 1 5 7 87 98 2 200;20 56 74 1 34 56 21] y_correct = 120; assert(isequal(minimal_path_5(x),y_correct))

x = 1 12 4 6 8 10 100 1 5 7 87 98 2 200 20 56 74 1 34 56 21

2   Pass
x =[1 122 4 6 8 10 100 ; 1 5 7 87 98 2 200;20 56 74 1 34 56 21] y_correct = 120; assert(isequal(minimal_path_5(x),y_correct))

x = 1 122 4 6 8 10 100 1 5 7 87 98 2 200 20 56 74 1 34 56 21

3   Pass
x = [2 2 2 2 2 0 0 10 1 2 20 0 20 1 2 30 0 0 3 2]; x=flipud(x); y_correct = 5; assert(isequal(minimal_path_5(x),y_correct))

4   Pass
x=[131 673 234 103 18 201 96 342 965 150 630 803 746 422 111 537 699 497 121 956 805 732 524 37 331]; y_correct = 994; assert(isequal(minimal_path_5(x),y_correct))

5   Pass
x=magic(10); y_correct = 429; assert(isequal(minimal_path_5(x),y_correct))

6   Pass
x=[4074 3279 2194 3757 1759 811 534 4266 3902 2736 3222 1556 428 189 153 299 867 4759 164 1260 2115 3895 1274 880 3239 2912 2023 1739 4109 2573 4529 179 1908 1276 4155 3972 4810 3111 1949 1482 1894 4617 1313 4426 3721 3410 1955 4602 2806 1453 472 2118 1121 3609 3396 2704 2242 750 2150 4422 635 4246 3828 2530 2927 1557 24 1755 1209 3724 4058 2152 4006 4567 2501 213 4157 264 4410 3086 2993 455 3340 2368 3179 4350 1830 2931 4439 2941 4567 4670 3976 3496 2749 2643 3875 2567 2020 945 2665 925 147 3981 2400 358 4017 3690 3346 1327 2355 1333 4222 764 4726 1324 3818 1311 1956 774 3162 3394 935 4455 4586 829 4087 2010 483 3434 1754 4525 4645 494 4524 2609 303 1346 953 4122 3480 769 1723 1706 1045 1591 3140 223 3846 1000 488 3789 2449 4797 1430 3010 4344 380 660 918 4696 4899 3652 1310 3050 484 1997 2115 1845 4914 3500 1406 3903 3037 3547 597 3860 3775 1984 2035 1393 3716 2228 2737 3787 1315 423 1200 4711 1843 4380 2195 2444 1677 3089 4091 2635 2740 2304 3652 3193 2201 3377 959 1182 4700 4665 1214 4043 3744 2735 1962 3232 694 3769 3271 1999 617 4781 3129 2751 556 2893 3399 4298 4088 2084 4714 4909 1720 169 2636 34 3693 597 3228 4864 2213 3776 4128 4788 3278 3547 747 1903 3447 1300 920 2877 3902 3113 1291 1187 683 4028 3613 3285 2089 783 2921 345 2288 3011 1215 3037 2398 961 3439 1887 3950 4825 856 3774 1288 2840 3741 4001 1200 299 406 2936 2044 2295 3607 2884 750 3140 4916 4278 539 1598 4377 1934 4588 2251 3197 695 1797 1081 1593 789 3531 1381 4204 380 2253 2158 2087 1174 4647 1039 2975 4816 534 915 3299 1460 1508 3224 4532 2655 2591 4580 1346 2294 2724 3482 3682 3953 2671 4853 160 3399 1272 270 420 4554 249 1766 3879 1507 1312 2735 3269 1200 2593 2159 3506 1882 4399 3273 4719 6 3828 3310 3237 470 1974 4747 450 4786 1385 3276 4072 2654 1145 910 4514 4106 2434 2355 3015 2606 2471 4433 4865 78 3332 955 4089 2039 3189 2313 944 3852 2720 2628 3418 1638 559 2427 231 814 1218 3896 4567 1320 4724 78 2180 1153 3557 1158 3896 144 3245 4921 2696 2142 1304 4100 4789 2122 1438 1752 3606 2652 3521 3357 682 4002 486 595 4647 4671 762 728 2455 216 2234 4222 1109 2445 3576 2450 4002 836 3491 2411 2972 3592 1204 2305 456 3311 2613 4306 2212 2194 3394 710 4118 2492 1750 650 4130 681 2447 845 1532 974 588 3121 4519 840 2269 532 3333 604 113 4844 3381 3851 2882 2081 4969 2425 98 4168 2476 2109 3475 4799 983 2845 2692 4347 1689 3246 2543 1130 1484 3396 4455 4894 2162 1863 891 2948 2127 2657 1446 1613 3417 4210 1094 1968 1655 3845 949 4579 1586 1702 1256 2347 4981 2899 4501 3659 2554 854 1594 1978 1671 3564 4127 991 641 1131 1564 1626 3360 3924 2733 4165 529 3358 2122 837 2476 3962 4752 2927 3081 60 391 2750 1847 3239 4089 1139 2121 1838 3494 2503 418 2449 4996 1924 808 529 3476 2357 2129 1283 549 3707 1352 4310 739 4798 173 1120 2367 1686 2214 725 557 2255 3975 2179 2540 4940 990 2356 666 1698 856 2915 894 3055 340 179 3223 3068 318 2601 986 4950 275]; y_correct = 56185; assert(isequal(minimal_path_5(x),y_correct))

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!