solution for path sum