Practice Maximum White Tiles Covered by a Carpet
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum White Tiles Covered by a Carpet
Problem Statement
You are given a 2D integer array tiles where tiles[i] = [li, ri] represents that every tile j in the range li <= j <= ri is colored white. 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.
Source: Maximum White Tiles Covered by a Carpet on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
tiles = [[1,5],[10,11],[12,18],[20,25],[30,32]], carpetLen = 10
9
# Example 2
tiles = [[10,11],[1,1]], carpetLen = 2
2
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum White Tiles Covered by a Carpet.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.