Count Pairs Whose Sum is Less than Target Using Brute-Force Approach O(n^2) Time Complexity
IntuitionThe problem requires us to count pairs (i, j) where the sum of two elements in the list is strictly less than a given target. A brute-force approach wo
## Intuition
The problem requires us to count pairs (i, j) where the sum of two elements in the list is strictly less than a given target. A brute-force approach would be to iterate through all possible pairs and check the condition.

## Approach
1. Initialize a counter `out` to store the count of valid pairs.
2. Use a nested loop to iterate through all unique pairs `(i, j)` where `i < j`.
3. For each pair, check if `nums[i] + nums[j] < target`. If true, increment the counter.
4. Return the final count.

## Complexity
### Brute Force Approach:
- **Time Complexity**: $$O(n^2)$$ since we iterate through all pairs in a nested loop.
- **Space Complexity**: $$O(1)$$ as no extra space is used.


# Code
```python3 []
class Solution:
    def countPairs(self, nums: List[int], target: int) -> int:
        out = 0
        n = len(nums)
        for i in range(n):
            for j in range(i + 1, n):  # Ensure unique pairs
                if nums[i] + nums[j] < target:
                    out += 1
        return out
```
['Array', 'Python3']