Simplify path and word ladder ii