-
1365. How Many Numbers Are Smaller Than the Current Number릿코드(LEETCODE) 2020. 3. 3. 11:37반응형
https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/
class Solution { public: vector<int> smallerNumbersThanCurrent(vector<int>& nums) { vector<int> ret; for (int i = 0; i < nums.size(); i++) { int cand = nums[i]; int cnt = 0; for (int j = 0; j < nums.size(); j++) { if (cand > nums[j]) { cnt++; } } ret.push_back(cnt); } return ret; } };
반응형'릿코드(LEETCODE)' 카테고리의 다른 글
1252. Cells with Odd Values in a Matrix (0) 2020.03.03 1207. Unique Number of Occurrences (0) 2020.03.03 1366. Rank Teams by Votes (0) 2020.03.03 733. Flood Fill (0) 2020.03.03 463. Island Perimeter (0) 2020.03.03