NeetCode #756LC-741Hard2-D Dynamic Programming
← Back to All Problems#756 · #741 · Cherry Pickup(摘樱桃)
📌 Problem Statement & Constraints
Given an
n x n grid where 0 is empty, 1 is a cherry, and -1 is a thorn (blocked), start at (0, 0), walk to (n-1, n-1) moving only right or down, then walk back to (0, 0) moving only left or up. A cell's cherry is collected once. Return the maximum cherries collected, or 0 if no path exists. Constraints: 1 <= n <= 50.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!