DEV Community

Discussion on: Daily Challenge #256 - How Many Are Smaller Than I?

Collapse
 
xtawfeeq7k profile image
tawfeeq khalilia • Edited

Here is a python solution

def smaller(arr):
    lst = []
    for ch in range(len(arr)):
        lst.append(sum([1 for ch1 in range(ch , len(arr)) if arr[ch1]<arr[ch]]))
    return lst
Enter fullscreen mode Exit fullscreen mode