(1 minute read)
My implementation is based on the optimized iterative version which does away with the need to calculate and store the entire matrix, instead just storing the last two calculated rows. My improvement on the original code is to do away with the need to copy the current row into the previous row within a separate loop at the end of each iteration.
I've included what I think is a more comprehensive set of test cases than other modules provide thus ensuring the correctness of the implementation as well as making it easier to make changes in future. And I've already come across further potential optimizations that can be made and have created issues for these.