3 sum and edit min path sum with one dimension array