SIMPLE || CLEAN || FUSTER || JAVA 2 SOLUTION 🧑‍🏫
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:**O(n log n)**\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:**0(n)**\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        int count = 0;\n        for(int i=0; i<nums.size(); i++){\n            for(int j=i+1; j<nums.size(); j++){\n                if(nums.get(i) + nums.get(j) < target)  \n                ++count;\n            }\n        }\n        return count;\n    }\n}\n\n\n//SECOND SOLUTION\n\n\n        int count=0;\n        Collections.sort(nums);\n        int left=0;\n        int right=nums.size()-1;\n        while(left<right){\n            int sum=nums.get(left) + nums.get(right);\n            if(sum<target){\n                count+=right-left;\n                ++left;\n            }else{\n                --right;\n            }\n        }\n        return count;\n```
['Java']