1365. How Many Numbers Are Smaller Than the Current Number ( LeetCode Problem ).
Solution :-
class Solution:
def smallerNumbersThanCurrent(self, nums:
List[int]) -> List[int]:
count=0
arr1=[]
for i in range(0,len(nums)):
for j in
range(0,len(nums)):
if(i==j):
pass
else:
if(nums[i]>nums[j]):
count+=1
else:
pass
if(j==len(nums)-1):
arr1.append(count)
count=0
return arr1
Runtime: 956 ms, faster than 5.00% of Python3 online submissions for a way Many Numbers Are Smaller Than the present Number.
Memory Usage: 14.2 MB, but 100.00% of Python3 online submissions for a way Many Numbers Are Smaller Than the present Number.
0 Comments