Remove Duplicate Letters | Leetcode 316

  Рет қаралды 22,424

Pepcoding

Pepcoding

Күн бұрын

Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. 1. Given a string s, remove duplicate letters so that every letter appears once and only once.
2. You must make sure your result is the first in dictionary order among all possible results.
Topic: #RemoveDuplicateLetters #Leetcode316
Used #DataStructure: #Stack #String #Array
#TimeComplexity: O(n)
#SpaceComplexity: O(n)
--------------------------------------------------------------
Linked Questions:
1. Remove Duplicate Letters : www.pepcoding....
--------------------------------------------------------------
Smimilar Questions:
1. Remove K Digits : www.pepcoding....
2. Asteroid Collision : www.pepcoding....
---------------------------------------------------------------
For detailed information and other exercises, VISIT: www.pepcoding.com
Have a look at our result: www.pepcoding....
Follow us on our FB page: / pepcoding​
Follow us on Instagram: / pepcoding​
Follow us on LinkedIn: / pepcoding-education
----------------------------------------------------------------
#RemoveKDigits #Leetcode316 #Stack #String #Array

Пікірлер: 58
@leetcode7091
@leetcode7091 3 жыл бұрын
You are true gem..... teaching is awesome. Explained like a piece of cake.
@shang_chi4651
@shang_chi4651 3 жыл бұрын
It's so good to see that you build the soln from scratch right in front of us and debug your code which really gives us an insight. Other teachers just explain the code that how it works but your technique is amazing. Thanks diwakar sir and thanks pepcoding 🙏
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad you enjoy it! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@ChandraShekhar-by3cd
@ChandraShekhar-by3cd 2 жыл бұрын
Great explantion ever in this Planet! Keep uploading more leetcode contents questions.
@chauhanabhisheksheshnath2640
@chauhanabhisheksheshnath2640 Жыл бұрын
Great explanation!
@amruthammohan1667
@amruthammohan1667 2 жыл бұрын
Best explaination
@yuvraj2038
@yuvraj2038 2 жыл бұрын
khud se usko koi kaise hi kar paega agar pehle kabhi aisa question nhi kia to. HOLI hai but DSA zaruri hai :)
@ankitkumarpathak6768
@ankitkumarpathak6768 2 жыл бұрын
thanks bhaiya for your all video explanations
@s1mple965
@s1mple965 2 жыл бұрын
thanks man ...your multiple testcase methodology helped me to think !
@Pepcoding
@Pepcoding 2 жыл бұрын
Happy to help, for better experience and well curated content sign up on nados.io
@rohitshinde8478
@rohitshinde8478 3 жыл бұрын
Thank you sir your way of explanation with examples is best
@youngshahrukhkhan8179
@youngshahrukhkhan8179 2 жыл бұрын
Very Nice Explanation.....Keep making videos
@Pepcoding
@Pepcoding 2 жыл бұрын
We will, for better experience and well curated content sign up on nados.io and keep learning.
@akhilesh59
@akhilesh59 2 жыл бұрын
Nice explanation Sir, Thank you!
@AshutoshKumar-es8xy
@AshutoshKumar-es8xy 2 жыл бұрын
Bahaut sahi padhaaya bhai
@akatsuki1363
@akatsuki1363 2 жыл бұрын
Best👌👌
@Pepcoding
@Pepcoding 2 жыл бұрын
Keep learning. And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@aakashparmar560
@aakashparmar560 2 жыл бұрын
Nicely explained.!
@letmehelp8927
@letmehelp8927 2 жыл бұрын
amazing explanation sir keep it up thanks
@sunilpanchal1498
@sunilpanchal1498 2 жыл бұрын
Great explanation
@editorera239
@editorera239 3 жыл бұрын
Thanks sr Nicely explained
@Pepcoding
@Pepcoding 3 жыл бұрын
For better learning experience watch the same content on nados.pepcoding.com
@tarungarg9762
@tarungarg9762 2 жыл бұрын
Thanks bro! Really good explanation. Got every point clearly.🤩
@amansamal8233
@amansamal8233 2 жыл бұрын
Awesome Explanation!!
@Pepcoding
@Pepcoding 2 жыл бұрын
Keep learning. And for better experience, visit nados.io, where you will get well curated content and career opportunities.
@sharuk3545
@sharuk3545 3 жыл бұрын
wonderfull explanation.
@Whaleshamu
@Whaleshamu 2 жыл бұрын
very nice explanation !! Keep making the videos :) Good Luck.
@indranilchakraborty5949
@indranilchakraborty5949 3 жыл бұрын
দারুন❤❤❤❤👏
@Pepcoding
@Pepcoding 3 жыл бұрын
Keep learning, Keep growing and keep loving Pepcoding!😊
@bhailog_gaming_2000
@bhailog_gaming_2000 3 жыл бұрын
Thank you so much
@satyamabhishek1317
@satyamabhishek1317 3 жыл бұрын
u r superb sir.
@_inspireverse___
@_inspireverse___ 2 жыл бұрын
awesome
@istudentlabsindia124
@istudentlabsindia124 2 жыл бұрын
why time complexity is O(n)? it has while loop inside for loop right
@theuntoldtree
@theuntoldtree 2 жыл бұрын
👍
@kannupriyarana4971
@kannupriyarana4971 3 жыл бұрын
amazing explanation sir🤠
@divasbhadani9225
@divasbhadani9225 10 ай бұрын
you must teach why you use stack ?
@16crypt49
@16crypt49 3 жыл бұрын
Good explaination
@prachiagarwal9771
@prachiagarwal9771 3 жыл бұрын
What's the time complexity?
@letsdoeverythinginoneweek9398
@letsdoeverythinginoneweek9398 3 жыл бұрын
nice explanation easy
@Pepcoding
@Pepcoding 3 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzbin.infoabout?view_as=subscriber
@sahilsaxena8374
@sahilsaxena8374 3 жыл бұрын
Sir in an interview , What we use HashMap or int[] for frequency map ??
@yashvarshney6761
@yashvarshney6761 3 жыл бұрын
@Sahil Saxena We should use bool array for frequency.
@mickyman753
@mickyman753 3 жыл бұрын
use hashmap first ,then just for optimisations say we could use int[] too
@siddheshsagar9212
@siddheshsagar9212 2 жыл бұрын
Hashmap will work !
@rabinarayansabat9166
@rabinarayansabat9166 3 жыл бұрын
Can we go for TreeSet collection here? It will remove duplicates and provides the result in sorting order.
@diwakargupta0
@diwakargupta0 3 жыл бұрын
Treeset wont preserve ordering. Example for "bac" treeset will give "abc" but it's answer is "bac".
@vivekjaiswal3663
@vivekjaiswal3663 3 жыл бұрын
what would be space and time complexcity for this sol
@shang_chi4651
@shang_chi4651 3 жыл бұрын
It will be linear. Because every element goes into the stack and gets popped only or i should say at max one time. The inner while loop can't execute more than n times in total irrespective of the outer for loop
@RiteshYadav-rc1np
@RiteshYadav-rc1np 3 жыл бұрын
time and space will be O(n)
@satyamabhishek1317
@satyamabhishek1317 3 жыл бұрын
sir, plz start bit masking series also :)
@Pepcoding
@Pepcoding 3 жыл бұрын
Already there, check level2 on website.
@abhishekkhanna6649
@abhishekkhanna6649 2 жыл бұрын
Thoda attitude sahi kro sir teacher type nhi lgra h waise good explanation
@trevorPhillips284
@trevorPhillips284 3 жыл бұрын
Understood the logic but i failed to implement it even after many tries😫
@Pepcoding
@Pepcoding 3 жыл бұрын
Don't loose hope. Its hard to see right now, but its temporary, For better experience visit :- nados.pepcoding.com
@DhananjayKumar-vn5tc
@DhananjayKumar-vn5tc 2 жыл бұрын
run for this test case it will show wrong ans :"cbacdcbc" after line 26 u must add exist[ch-'a']=true
@srishtikapoor8590
@srishtikapoor8590 2 жыл бұрын
great explanation
Traping Rain Water
21:32
Pepcoding
Рет қаралды 9 М.
Remove K Digits | Leetcode 402
27:00
Pepcoding
Рет қаралды 12 М.
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 11 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 3,2 М.
Basic Calculator | Leetcode 224
36:45
Pepcoding
Рет қаралды 19 М.
Maximal Rectangle | Leetcode 85
17:28
Pepcoding
Рет қаралды 11 М.
The Most Mind-Bending Optical Illusions Ever
5:12
CurioVault
Рет қаралды 3
The Skyline Problem || Leetcode
34:19
Pepcoding
Рет қаралды 18 М.