A Trick for Rotating a 2D Grid
Solving a Problem with Manhattan Distance Queries.
By Thiago Felipe Bastos da Silva
Today I’ll talk about a trick that I learned in the Maratona de Programação Brasil group that I call the $(x + y, x - y)$ trick. This trick rotates a 2D grid by 45° and enables you to answer queries involving Manhattan distances, because after applying this transformation to...
[Read More]