refactor and add another solution for finding out number of paths in a maze without using recursion