✅Beats 99.81% || Easy to Understand 2 Pointer Approach
\n\n\n# Code\n\nclass Solution(object):\n    def countPairs(self, nums, target):\n        nums.sort()\n        l=0\n        r=len(nums)-1\n        count=0\n    
\n![LC sol.PNG](https://assets.leetcode.com/users/images/3d9b7a3f-88b1-43ae-b718-da3e5a7c539e_1707472824.7412221.png)\n\n# Code\n```\nclass Solution(object):\n    def countPairs(self, nums, target):\n        nums.sort()\n        l=0\n        r=len(nums)-1\n        count=0\n        while l<r:\n            if (nums[l]+nums[r])<target:\n                count+=(r-(l))\n                l+=1\n            else:\n                r-=1\n        return count\n        """\n        :type nums: List[int]\n        :type target: int\n        :rtype: int\n        """\n        \n```
['Python']