Easy TypeScript Solution with Two pointers
Code


# Code
```typescript []
function countPairs(nums: number[], target: number): number {
    const arr = nums.sort((a, b) => a - b)
    let result = 0
    let left = 0
    let right = nums.length - 1

    while(left < right) {
        if(arr[left] + arr[right] < target) {
            result += right - left
            left+=1
        }
        else right-=1
    }

    return result
};
```
['Two Pointers', 'TypeScript']