GridCure interview question

A math question solvable in any programming language.