7 kyu

How many are smaller than me?

5,615 of 10,552joh_pot

Description:

Write a function that given, an array arr, returns an array containing at each index i the amount of numbers that are smaller than arr[i] to the right.

For example:

* Input [5, 4, 3, 2, 1] => Output [4, 3, 2, 1, 0]
* Input [1, 2, 0] => Output [1, 1, 0]

If you've completed this one and you feel like testing your performance tuning of this same kata, head over to the much tougher version How many are smaller than me II?

Arrays
Algorithms

Stats:

CreatedJan 22, 2016
PublishedJan 22, 2016
Warriors Trained17468
Total Skips296
Total Code Submissions21148
Total Times Completed10552
JavaScript Completions5615
Python Completions4124
CoffeeScript Completions28
Haskell Completions154
Ruby Completions247
COBOL Completions12
Go Completions231
C Completions139
TypeScript Completions168
PHP Completions145
Prolog Completions6
Lua Completions16
Total Stars159
% of votes with a positive feedback rating92% of 1052
Total "Very Satisfied" Votes901
Total "Somewhat Satisfied" Votes132
Total "Not Satisfied" Votes19
Ad
Contributors
  • joh_pot Avatar
  • SagePtr Avatar
  • bkaes Avatar
  • raulbc777 Avatar
  • NaMe613 Avatar
  • Chrono79 Avatar
  • Voile Avatar
  • rowcased Avatar
  • stellartux Avatar
  • user8436785 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • tkonrad Avatar
  • PetitLu117 Avatar
Ad