Python - Two Pointers Solution [TC: O(n*log(n)) SC: O(n)]
Complexity\n\n- Time complexity: O(n*log(n))\n- Space complexity: O(n)\n\nPython uses Timsort for sorting which has O(n) space complexity in a worst case.\n \n#
# Complexity\n\n- Time complexity: $$O(n*log(n))$$\n- Space complexity: $$O(n)$$\n\nPython uses [Timsort](https://en.wikipedia.org/wiki/Timsort) for sorting which has $$O(n)$$ space complexity in a worst case.\n \n# Code\n\n``` python []\nclass Solution(object):\n    def countPairs(self, nums, target):\n        n = len(nums)\n\n        nums.sort()\n\n        c = 0\n        l = 0\n        r = n-1\n\n        while l < r:\n            if nums[l] + nums[r] < target:\n                c += r - l\n                l += 1\n            else:\n                r -= 1\n\n        return c\n```
['Two Pointers', 'Python', 'Python3']