Idea: The time complexity of brute force cracking is O(n 2 ), and the length of the array here is not greater than 500, which is on the order of tens of thousands, and it will definitely not time out;
class Solution {
public:
vector<int> smallerNumbersThanCurrent(vector<int> &nums)
{
int len = nums.size();
vector<int> res(len, 0);
for (int i = 0; i < len; i++)
{
int temp = nums[i];
int count = 0;
for (int j = 0; j < len; j++)
{
if (nums[j] < temp)
{
count++;
}
}
res[i] = count;
}
return res;
}
};