Minimal steps down to 1: Difference between revisions

m
m (memoize)
Line 187:
 
=={{header|Julia}}==
Non-recursive solution that is memoized for the count-only ortionsportions of the task. When the steps are to be printed, the solution is not memoized in order to list all possible paths of the shortest length (all solutions). Implemented as a generic solution for any functions acting on an integer and taking any range of second arguments, with the goal solution also specifiable. To do so generically, it is also necessary to specify a falure condition, which in the example is falling below 1.
<lang julia>import Base.print
 
4,111

edits