
-Code
class Solution {
public int[] smallerNumbersThanCurrent(int[] nums) {
int numLen = nums.length;
int[] answer = new int[numLen];
for (int i = 0; i < numLen; i++) {
for (int j = 0; j < numLen; j++) {
if (nums[i] > nums[j]) answer[i]++;
}
}
return answer;
}
}
'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 31432번 소수가 아닌 수 3 (0) | 2025.11.24 |
|---|---|
| [LeetCode/Java] Find All Numbers Disappeared in an Array (0) | 2025.11.24 |
| [LeetCode/Java] Set Mismatch (0) | 2025.11.24 |
| [LeetCode/Java] Max Consecutive Ones (0) | 2025.11.24 |
| [LeetCode/Java] Shuffle the Array (0) | 2025.11.24 |