On Wed, Dec 12, 2018 at 1:25 PM 'Mike Day' via Programming
<[email protected]> wrote:
> It occurred to me yesterday, though I haven’t coded it, that you can work 
> through twice, first for the minimum suitable spanning box, and second for 
> that box extended one row up and down and one column left and right. The 
> inner regions are those whose size doesn’t change. Probably pretty 
> inefficient, but easier to understand?

What I did was ensure my grid had at least one row of empty grid cells
on the border.

I am not sure that that's sufficient. Intuitively, I would think the
grid should be twice times the size necessary to contain the named
coordinates for the worst cases (with the named coordinates in the
central part), but it worked for every example I've encountered, so
far.  (On the other hand, if that single extra grid coordinate is
sufficient, for the worst case, it might be that I don't even need
that single extra row.)

"Fortunately", ... Advent of Code doesn't require you solve for the
general case.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to