You are given an grid representing a field of cherries. Each cell in the grid can have one of three possible values:
Your task is to find the maximum number of cherries that can be collected while following these rules:
Start at the top-left corner
After reaching the bottom-right corner, return to the starting point
When passing through a valid cell containing a cherry, pick it up, and the cell becomes empty (its value changes from
If there is no valid path between
You are given an grid representing a field of cherries. Each cell in the grid can have one of three possible values:
Your task is to find the maximum number of cherries that can be collected while following these rules:
Start at the top-left corner
After reaching the bottom-right corner, return to the starting point
When passing through a valid cell containing a cherry, pick it up, and the cell becomes empty (its value changes from
If there is no valid path between