Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

How Many Numbers Are Smaller Than the Current Number

Easy

Topics
ArrayHash TableCounting

For each nums[i], count how many nums[j] (j != i) are strictly smaller. Return the counts as an array.

Example 1

Input:  nums = [8,1,2,2,3]
Output: [4,0,1,1,3]

Example 2

Input:  nums = [6,5,4,8]
Output: [2,1,0,3]

Constraints

  • 2 <= nums.length <= 500
  • 0 <= nums[i] <= 100
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access