# I Overcomplicated This Grid Problem… Until Prefix Sum Saved Me

java dev.to

Sometimes the problem isn’t hard — we just make it harder. While solving Equal Sum Grid Partition (LeetCode 3546), I caught myself doing exactly that. 🧩 Problem Overview You’re given an m x n grid of positive integers. You need to make one cut (horizontal or vertical) such that: Both parts are non-empty Both parts have equal sum 🤯 My First Approach (Wrong Direction) My initial thought was: “Let’s try all possible cuts.” Try every horizontal cut Try every

Read Full Tutorial open_in_new
arrow_back Back to Tutorials