The interviewer presented a diagram similar to this one, but with polygons inside, such as L or T shapes. The task was to design input and then find the total number of squares. It was unexpected to encounter such a difficult question during a supposedly simple Google interview.
My idea was to input a bunch of rectangles with coordinates for the top left corner, x and y, and length and width. Each rectangle has its own ID, and then a 2D array is generated like:
aabbc
aabbc
zyyqq
qqqqq
Subsequent rectangles will overwrite previous ones, generating polygons in this manner.
Finally, a sliding window approach is used for exhaustive enumeration. One small optimization I could think of is to create a map to store the area of each shape. By knowing the area of the window and the IDs of shapes it contains, one can compare whether the sum of those shapes actually equals the area of the window.