EASY ... Two pointer approach.
Intuition\n Describe your first thoughts on how to solve this problem. \nA easy way using two pointers.\n\n# Approach\n Describe your approach to solving the pr
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nA easy way using two pointers.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nmove a pointer from the start and move another ahead of the other pointer and compare their sum with the target.\n\n# Complexity\n- Time complexity:  O(N^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:    O(1) \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\n    public int countPairs(List<Integer> nums, int target) {\n        int sum=0;\n        int n=nums.size();\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                if(nums.get(i)+ nums.get(j) < target){\n                    sum++;\n                }\n            }\n        }\n        return sum;\n    }\n}\n```
['Java']