Loading problem…
A square grid contains 0 for an empty cell, 1 for a cherry, and -1 for a blocked cell. Travel from the top-left to the bottom-right using only right or down moves, then return using only left or up moves. Blocked cells cannot be visited.
A cherry can be collected only once across the entire round trip. Return the maximum cherries you can collect, or 0 if no complete route exists. Do not modify grid.
Example 1:
Outward route
Return route after collection
Example 2:
Example 3: