How Many Numbers Are Smaller Than the Current Number

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
Return the answer in an array.
LeetCode Problem - 1365
class Solution {
// It calculates and returns the number of pairs of integers in 'nums' whose sum is less than 'target'.
public int countPairs(List<Integer> nums, int target) {
// Initialize a variable 'count' to keep track of the number of pairs.
int count = 0;
// Iterate through each element at index 'i' in the 'nums' list.
for(int i=0; i<nums.size(); i++){
// Iterate through each element at index 'j' starting from 'i+1' to the end of the list.
for(int j=i+1; j<nums.size(); j++){
// Check if the sum of the elements at index 'i' and 'j' is less than 'target'.
// If so, increment the 'count' as it represents a valid pair.
if((nums.get(i) + nums.get(j)) < target){
count++;
}
}
}
// Return the total count of pairs whose sum is less than 'target'.
return count;
}
}




