Simple Solution | Beginner Friendly | Easy Approach with Explanation✅
Intuition\n Describe your first thoughts on how to solve this problem. \nTo count the number of pairs whose sum is less than the target, we can use a nested loo
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTo count the number of pairs whose sum is less than the target, we can use a nested loop to compare every pair of numbers in the array. This ensures that we don\'t miss any possible combinations.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Initialize a variable `count` to store the number of valid pairs.\n2. Use a nested loop:\n   - Outer loop iterates through the array with index `i`.\n   - Inner loop iterates through the elements after index `i` with index `j`.\n   - For each pair `(nums[i], nums[j])`, check if their sum is less than the target.\n   - If true, increment the `count` variable.\n3. Return the value of `count`.\n\n# Code\n```javascript []\n/**\n * @param {number[]} nums\n * @param {number} target\n * @return {number}\n */\nvar countPairs = function(nums, target) {\n    let count = 0;\n    for(let i=0; i<nums.length; i++){\n        for(let j=i+1;j<nums.length;j++){\n            if(nums[i]+nums[j]<target){\n                count++\n            }\n        }\n    }\n    return count;\n};\n```\n\n```typescript []\nfunction countPairs(nums: number[], target: number): number {\n    let count: number = 0;\n    for (let i = 0; i < nums.length; i++) {\n        for (let j = i + 1; j < nums.length; j++) {\n            if (nums[i] + nums[j] < target) {\n                count++;\n            }\n        }\n    }\n    return count;\n}\n
['TypeScript', 'JavaScript']