Company: Wex_30_dec
Difficulty: medium
850. Rectangle Area II Problem Description You are given a 2D array of axis-aligned rectangles . Each rectangle[i] = [x i1 , y i1 , x i2 , y i2 ] denotes the i th rectangle where (x i1 , y i1 ) are the coordinates of the bottom-left corner , and (x i2 , y i2 ) are the coordinates of the top-right corner . Calculate the total area covered by all rectangles in the plane. Any area covered by two or more rectangles should only be counted once . Return the total area . Since the answer may be too large, return it modulo 10 9 + 7 . Examples Example 1: Input: rectangles = [[0,0,2,2],[1,0,2,3],[1,0,3,1]] Output: 6 Explanation: A total area of 6 is defined by these three rectangles. The total area is covered by: - A square with bottom-left (0,0) and top-right (2,2) - A rectangle with bottom-left (1,0) and top-right (2,3) - A rectangle with bottom-left (1,0) and top-right (3,1)