**Maximum White Tiles Covered by a Carpet solution leetcode** – You are given a 2D integer array `tiles`

where `tiles[i] = [l`

represents that every tile _{i}, r_{i}]`j`

in the range `l`

is colored white._{i} <= j <= r_{i}

## [Solution] Maximum White Tiles Covered by a Carpet solution leetcode

You are also given an integer `carpetLen`

, the length of a single carpet that can be placed **anywhere**.

Return *the maximum number of white tiles that can be covered by the carpet*.

**Example 1:**

## [Solution] Maximum White Tiles Covered by a Carpet solution leetcode

Input:tiles = [[1,5],[10,11],[12,18],[20,25],[30,32]], carpetLen = 10Output:9Explanation:Place the carpet starting on tile 10. It covers 9 white tiles, so we return 9. Note that there may be other places where the carpet covers 9 white tiles. It can be shown that the carpet cannot cover more than 9 white tiles.

**Example 2:**

Input:tiles = [[10,11],[1,1]], carpetLen = 2Output:2Explanation:Place the carpet starting on tile 10. It covers 2 white tiles, so we return 2.

## [Solution] Maximum White Tiles Covered by a Carpet solution leetcode

`1 <= tiles.length <= 5 * 10`

^{4}`tiles[i].length == 2`

`1 <= l`

_{i}<= r_{i}<= 10^{9}`1 <= carpetLen <= 10`

^{9}- The
`tiles`

are**non-overlapping**.