Given a 2D grid of integers, determine if it is possible to split the grid into two parts using a single horizontal or vertical cut such that the sum of both parts is equal.
// Time Complexity: O(N) minimum cost gets called with each index from 0 and N. Because of the memorization, each call takes O(1) time ...