Solution is based on idea from https://discuss.leetcode.com/topic/55898/share-my-easy-way-to-approach-p1-including-p3-explanation.

Main idea is that for final rectangle to not have gaps every corner must have "pair" corner from another rectangle. So each corner coordinate must appear % 2 == 0 times. The only exception is the 4 corner coordinates of convex hull rectangle. For rectangles not to have intersections we need to only check the total area.

```
var getArea = function (r) {
return (r[2] - r[0]) * (r[3] - r[1]);
};
/**
* @param {number[][]} rectangles
* @return {boolean}
*/
var isRectangleCover = function(rectangles) {
if (rectangles == null)
return false;
if (rectangles.length === 0)
return true;
let areaSum = 0;
const hash = {};
const r = [ ...rectangles[0] ];
for (let i = 0; i < rectangles.length; i++) {
const rect = rectangles[i];
r[0] = Math.min(r[0], rect[0]);
r[1] = Math.min(r[1], rect[1]);
r[2] = Math.max(r[2], rect[2]);
r[3] = Math.max(r[3], rect[3]);
areaSum += getArea(rect);
[ `${rect[0]}_${rect[1]}`,
`${rect[0]}_${rect[3]}`,
`${rect[2]}_${rect[1]}`,
`${rect[2]}_${rect[3]}`,
].forEach((k) => {
if (hash[k])
delete hash[k];
else
hash[k] = 1;
});
}
if (areaSum !== getArea(r))
return false;
if (Object.keys(hash).length !== 4)
return false;
if (hash[`${r[0]}_${r[1]}`] !== 1 ||
hash[`${r[0]}_${r[3]}`] !== 1 ||
hash[`${r[2]}_${r[1]}`] !== 1 ||
hash[`${r[2]}_${r[3]}`] !== 1)
return false;
return true;
};
```