True dynamic programming using a numpy array, which is 33% slower, for reasons yet unknown