Count Pairs with Sum Less Than Target
IntuitionThe problem requires counting all pairs (i, j) in an array where i < j and the sum of the elements at these indices is less than a given target. The br
# Intuition
The problem requires counting all pairs (i, j) in an array where i < j and the sum of the elements at these indices is less than a given target. The brute-force approach checks every possible pair to see if they meet the condition.

# Approach
The solution uses a brute-force method with two nested loops. The outer loop iterates over each element, and the inner loop checks every subsequent element to form pairs. For each pair, the sum is compared against the target, and a counter is incremented if the sum is less than the target.

# Complexity
- Time complexity:
O(n²) - There are n(n-1)/2 pairs, leading to a quadratic time complexity.

- Space complexity:
O(1) - Only a constant amount of extra space is used for variables.

# Code
```cpp []
class Solution {
public:
    int countPairs(vector<int>& nums, int target) {
        int counter = 0;
        for(int i =- 0; i < nums.size() -1; i++)
        {
            for(int j = i + 1; j < nums.size(); j++)
            {
                if(nums[i] + nums[j] < target)
                    counter++;

            }
        }
        return counter;
    }
};
```
['Array', 'C++']