Recently interviewed with facebook, this is one of the questions that I gotten.
Input: A list of vertical and horizontal lines with its start point and end point in a graph.
Output: Find the total number of squares formed up by all these lines.
Anyone with the optimal solution?