LeetCode - How Many Numbers Are Smaller Than the Current Number - Python

  Рет қаралды 2,986

Knowledge Mavens

Knowledge Mavens

Күн бұрын

Пікірлер: 11
@kirtikishore642
@kirtikishore642 8 ай бұрын
Thankyou so much for such a great explanation
@adithyapaib
@adithyapaib 2 жыл бұрын
class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: s = sorted(nums) d= {} for i in range(len(s)): if s[i] not in d: d[s[i]] = i return [d[i] for i in nums]
@Rednuz-88
@Rednuz-88 2 жыл бұрын
What is the space complexity of this problem?
@Elfein
@Elfein 2 жыл бұрын
O(n)
@kirtibhushan
@kirtibhushan 2 жыл бұрын
Thanks man!
@olabanji
@olabanji 3 жыл бұрын
Thanks for the videos you make. They've all been helpful so far. Keep up the good work!
@KnowledgeMavens
@KnowledgeMavens 2 жыл бұрын
You're welcome, thank you for watching!
@rajeshseptember09
@rajeshseptember09 2 жыл бұрын
Clear explanation ! Thanks. Is it possible to solve this is O(N) time ? Using extra space ? I mean without using any sorting to achieving this !
@KnowledgeMavens
@KnowledgeMavens 2 жыл бұрын
Hey Rajesh, that's for watching and commenting. Great suggestion! Honestly, I didn't go further into this problem to consider a better space complexity given its small data set. However, it would be very beneficial to do so when implementing this algorithm on a larger set of data. Thanks again for the suggestion and I'll consider sharing more on this topic in the future.
@rishigupta2342
@rishigupta2342 3 жыл бұрын
Thanks.Nice explanation!!!
@KnowledgeMavens
@KnowledgeMavens 2 жыл бұрын
You're welcome, thank you for watching!
Lucky Numbers in a Matrix - Leetcode 1380 - Python
16:21
NeetCodeIO
Рет қаралды 8 М.
Quest To Find The Largest Number
11:43
CodeParade
Рет қаралды 449 М.
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 8 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 15 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 20 МЛН
Do you choose Inside Out 2 or The Amazing World of Gumball? 🤔
00:19
LeetCode - Richest Customer Wealth in Python
7:34
Knowledge Mavens
Рет қаралды 1,6 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 81 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 484 М.
This is Why Programming Is Hard For you
10:48
The Coding Sloth
Рет қаралды 884 М.
How I Would Learn Python FAST in 2024 (if I could start over)
12:19
Thu Vu data analytics
Рет қаралды 351 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Maximum Odd Binary Number - Leetcode 2864 - Python
9:42
NeetCodeIO
Рет қаралды 6 М.
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 8 МЛН