For this Question: You are given a 2D array of axis- aligned rectangles. Each rectangle[i] = [x<sub>i</sub>1, y<sub>i</sub>1, x<sub>i</sub>2, y<sub>i</sub>2] denotes the ith rectangle where (x<sub>i</sub>1, y<sub>i</sub>1) are the coordinates of the bottom- left corner, and (x<sub>i</sub>2, y<sub>i</sub>2) 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.There is an integer n(size of ractangles, 2d array) is given as input.
In next n lines coordinates of each rectangle are given as input.

<b>Constraints</b>
1 <= rectangles.length <= 200
rectanges[i].length == 4
0 <= x<sub>i</sub>1, y<sub>i</sub>1, x<sub>i</sub>2, y<sub>i</sub>2 <= 10<sup>9</sup>Return the total area. Since the answer may be too large, return it modulo 10^9 + 7.Sample Input:
3
0 0 2 2
1 0 2 3
1 0 3 1

Sample Output:
6

Explanation: A total area of 6 is covered by all three rectangles, as illustrated in the picture.
From (1, 1) to (2, 2), the green and red rectangles overlap.
From (1, 0) to (2, 3), all three rectangles overlap.
Example 2:

Input: rectangles =, I have written this Solution Code: import java.util.*;
class Solution {
    public int rectangleArea(int[][] r) {
        int mod=1000000007;
        TreeSet<Integer> x=new TreeSet<>();
        TreeSet<Integer> y=new TreeSet<>();
        for(int i=0;i<r.length;i++){
            x.add(r[i][0]);
            x.add(r[i][2]);
            y.add(r[i][1]);
            y.add(r[i][3]);
        }
        HashMap<Integer,Integer> cord_x=new HashMap<>();
        HashMap<Integer,Integer> cord_y=new HashMap<>();
        ArrayList<Integer> x_val=new ArrayList<>();
        ArrayList<Integer> y_val=new ArrayList<>();
        int index=0;
        for(Integer a:x){
            cord_x.put(a,index);
            x_val.add(a);
            index++;
        }
        index=0;
        for(Integer a:y){
            cord_y.put(a,index);
            y_val.add(a);
            index++;
        }
        int n=x.size();
        int m=y.size();
        boolean[][] vis=new boolean[n][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                vis[i][j]=false;
            }
        }
        long ans=0;
        for(int i=0;i<r.length;i++){
            for(int j=cord_x.get(r[i][0]);j<cord_x.get(r[i][2]);j++){
                for(int k=cord_y.get(r[i][1]);k<cord_y.get(r[i][3]);k++){
                    if(vis[j][k]==false){
                        long w=x_val.get(j+1)-x_val.get(j);
                        long h=y_val.get(k+1)-y_val.get(k);
                        long val=(w*h)%mod;
                        ans=(ans+(val%mod))%mod;
                    }
                    vis[j][k]=true;
                }
            }
        }
        int ans2=(int)ans;
        return ans2;
    }
}

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[][] arr=new int[n][4];
        for(int i=0;i<n;i++){
            for(int j=0;j<4;j++){
                int a=sc.nextInt();
                arr[i][j]=a;
            }
        }
        Solution obj=new Solution();
        int ans=obj.rectangleArea(arr);
        System.out.println(ans);
        return;
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?