Two pointers Java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int countPairs(List<Integer> nums, int target) {\n        Collections.sort(nums);\n        int left = 0;\n        int right = nums.size()-1;\n        int count = 0;\n        while(left<right)\n        {\n            if(nums.get(left)+nums.get(right)<target)\n            {\n                count+=right-left;\n                left++;\n            }\n            else\n            {\n                right--;\n            }\n        }\n        return count;\n    }\n}\n```
['Two Pointers', 'Java']