iteratively find unique paths bottom up