|
4 | 4 | importjava.util.Arrays;
|
5 | 5 | importjava.util.List;
|
6 | 6 |
|
7 |
| -/** |
8 |
| - * 1365. How Many Numbers Are Smaller Than the Current Number |
9 |
| - * |
10 |
| - * Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. |
11 |
| - * 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]. |
12 |
| - * Return the answer in an array. |
13 |
| - * |
14 |
| - * Example 1: |
15 |
| - * Input: nums = [8,1,2,2,3] |
16 |
| - * Output: [4,0,1,1,3] |
17 |
| - * Explanation: |
18 |
| - * For nums[0]=8 there exist four smaller numbers than it (1, 2, 2 and 3). |
19 |
| - * For nums[1]=1 does not exist any smaller number than it. |
20 |
| - * For nums[2]=2 there exist one smaller number than it (1). |
21 |
| - * For nums[3]=2 there exist one smaller number than it (1). |
22 |
| - * For nums[4]=3 there exist three smaller numbers than it (1, 2 and 2). |
23 |
| - * |
24 |
| - * Example 2: |
25 |
| - * Input: nums = [6,5,4,8] |
26 |
| - * Output: [2,1,0,3] |
27 |
| - * |
28 |
| - * Example 3: |
29 |
| - * Input: nums = [7,7,7,7] |
30 |
| - * Output: [0,0,0,0] |
31 |
| - * |
32 |
| - * Constraints: |
33 |
| - * 2 <= nums.length <= 500 |
34 |
| - * 0 <= nums[i] <= 100 |
35 |
| - * */ |
36 | 7 | publicclass_1365 {
|
37 | 8 | publicstaticclassSolution1 {
|
38 | 9 | publicint[]smallerNumbersThanCurrent(int[]nums) {
|
|