Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task. Tasks can be completed in any order, but there's a constraint: there has to be a gap of at least n intervals between two tasks with the same label.
Return the minimum number of CPU intervals required to complete all tasks.
 
Please complete the following python code precisely:
```python
class Solution:
    def leastInterval(self, tasks: List[str], n: int) -> int:
```