solve length of last word, unique paths and unique paths 2