You are given a rectangular grid, each cell containing an integer (not necessarily positive) number, denoting its cost. Find the cheapest connected set of cells (possibly empty), and return its cost. The cost of the set of cells is defined as the sum of the costs of its cells. A set is connected if you can get from any cell of the set to any other cell of the set by moving between adjacent cells of the set. Two cells are adjacent if they share a side (so each non-border cell has four adjacent cells).
The grid is given as a String cells, where each element contains a list of single-space separated integers. Each element of cells represents a row of the grid from left to right, and the rows are ordered from top to bottom.