D
D
dKosolap2016-10-17 17:52:23
Algorithms
dKosolap, 2016-10-17 17:52:23

How to find squares in a square?

There are coordinates of points and you need to find all the squaresa2Qyo82wCk4.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tsarevfs, 2016-10-17
@tsarevfs

Alternatively, you can solve the problem: find all squares with the upper left corner at the point (x, y) and side k.
For k = 1, it is trivial to calculate for all points.
For k = n, we answer based on previous results for k = n -1.
UPD: This is from the assumption that the filled squares are interesting.
hasRect[x][y] = hasRect[x][y] && hasRect[x + 1][y] && hasRect[x][y + 1]&& hasRect[x + 1][y + 1]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question