why can't I use bwlabel from the imaging toolbox?
this one took a while to solve lol
Very proud of my solution.
@Daniel, this cheat does not work because user directories are effectively random (hint: you may simply use relative paths instead). In any way, this form of cheats/hacks are not welcome in this particular Cody problem. There are, nevertheless, plenty of hacking problems in Cody (e.g. https://www.mathworks.com/matlabcentral/cody/problems?term=tag%3Ahack) that welcome and even encourage this sort of explorations, so please use those venues instead if you are interested.
Somehow, this test suite has changed and now I cannot pass Test 62, even though I did not use a lookup table solution. Please advise.
The solution is timing out (it is just taking too long). I would recommend to change your code to use a single call to dijkstra_lanes instead of one separate call for each StartLane-to-EndLane combination. You may do so, for example, by adding two nodes to your graph, one "start" node that is connected (with distance 0) to every non-blocked lane in the first row, and one "end" node that is connected (with distance 0) to every non-blocked lane in the last row. Then you will only need to call dijkstra_lane once to compute the optimal path distance of this extended graph, instead of calling your function N1*N2 times (for each of the N1/N2 first/last -row non-blocked positions)
Thank you for the recommendation.
added a few more test cases to discourage look-up table solutions (by I liked your bin2dec idea to encode the board, I copied that in my testsuite now :)
added a few test cases to discourage this sort of solutions
sorry, Cody web interface has some issues with very long solution files (solutions cannot be viewed, html parsing is misinterpreted so other solutions listed below this one cannot be displayed, etc.), could you please resubmit a shorter file? I will then simply rescore this solution to force it to be cropped (which will also fix the formatting issues)
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office