# 1365. How Many Numbers Are Smaller Than the Current Number ## [題目:](https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/) 給定一個陣列,輸出該數字在陣列中有幾個比他小的值 ex:`[8,1,2,2,3]` 輸出 `[4,0,1,1,3]` ## 思路 雙迴圈暴力解決, 比對陣列中每個數字,符合條件則count+1,在陣列中輪過一輪 ```go= func smallerNumbersThanCurrent(nums []int) []int { var counts []int for i := 0; i < len(nums); i++ { var count = 0 for j := 0; j < len(nums); j++ { if nums[i] > nums[j] { count++ } } counts = append(counts, count) } return counts } ```