News for hackers. Stuff that matters.
Re:enclose.horse by sunrunner on Tuesday January 06, 2026 @05:13AM (#46510622)
> algorithmically find the optimal solution for this kind of problem for much bigger grids.

Great, now I've been double nerd-sniped - once for the thing itself and another for 'What would an optimiser for this look like? Graph cuts? SAT/SMT? [AC]SP?'

Re:enclose.horse by qsort on Tuesday January 06, 2026 @05:35AM (#46510760)
I'd bet it's NP-hard. The standard reduction to a flow problem only tells you if a cut exists (by min-cut max-flow duality), but here we want the cut of size at most N that maximizes enclosed area.

The Leetcode version of this is "find articulation points", which is just a DFS, but it's less general than what is presented here.