flooding algo. to find the min path cost
sol of q063