How to solve this problem ?Goldman sachs

This came in my online coding round of Goldmann Sachs .
Please help!!!
I was not able to solve it .I thought of dp / kandans
algorithm but couldn’t do it.

image
image

Is it the one after the Aptitude Round of Campus Hiring Program 2021-2022 Internship?

when did you receive the Round 1 result mail?

Its greedy. Sort and add. Only 2 possibilities for each row (r[0] + r[1] or r[1] + r[2]).