Cherry Pickup II Problem
Cherry Pickup II Problem — ExecCode Hard DSA Practice
Solve the Cherry Pickup II problem on ExecCode. Free online hard DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Two robots start at the top-left and top-right of a grid and both move to the bottom. In one step each robot may go down-left, down, or down-right. They collect cherries; a cell visited by both in the same row counts once. Return the maximum cherries.
Examples
Input grid = [[3, 1, 1], [2, 5, 1], [1, 5, 5], [2, 1, 1]]; Output 24. Input grid = [[1, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 3, 0], [2, 0, 9, 0, 0, 0, 0], [0, 3, 0, 5, 4, 0, 0], [1, 0, 2, 3, 0, 0, 6]]; Output 28
Constraints
2 ≤ rows ≤ 70 2 ≤ cols ≤ 70
Practice Cherry Pickup II free on ExecCode. Browse DSA problems, topic map, and placement guides.