2
* @param {number[][]} tiles3
* @param {number} carpetLen6
var maximumWhiteTiles = function (tiles, carpetLen) {7
const sorted = tiles.sort((a, b) => a[0] - b[0]);13
for (let tile of sorted) {14
const start = tile[0];15
const end = start + carpetLen - 1;16
while (right < sorted.length && tiles[right][1] < end) {17
total += tiles[right][1] - tiles[right][0] + 1;20
if (right === sorted.length || sorted[right][0] > end) {21
res = Math.max(res, total);23
res = Math.max(res, total + (end - tiles[right][0] + 1));25
total -= tile[1] - tile[0] + 1;