Removing Stars From a String | Leetcode - 2390 | MICROSOFT | Explanation ➕ Live Coding

preview_player
Показать описание
This is the 9th Video on our Stack Playlist.
In this video we will try to solve a very popular but interview centric problem "Removing Stars From a String" (Leetcode-2390).

We will do live coding after explanation and see if we are able to pass all the test cases.

Problem Name : Removing Stars From a String
Company Tags : MICROSOFT

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish
Рекомендации по теме
Комментарии
Автор

Your videos are always so engaging and entertaining, thank you for making learning so much fun!

MyCodingDiary
Автор

I solved it myself using Stack. Come here to see your approach and find out two more approaches. As always top notch videos.

anuppatankar
Автор

I had already solved this problem in Feb, but I came here to watch your approach.

molyoxide
Автор

i have solved using stack and string but I'm here to watch your approach, your word always make me motivate

ashusheikh
Автор

I solved using approach-1 using your story to code technique. Thanks a lot

souravjoshi
Автор

only first approach came to my mind (only because to your story-->code technique) thanks bhaiya

rest two approaches were just 🔥🔥

oqant
Автор

Deque is also a good approach here, we don't need to reverse in last.

GouravArora-hxsb
Автор

I didn't have approach of stack but it's good that I came to know

prudhvirajmacherla
Автор

sir just bcoz of uh i am able to create logic, we love uhh

vaidehi
Автор

Bhaiya thanku for the video ❤
Bhaiya please every question ki end mai time and space. Complexity bhi discuss kar digeye

UmeshBisht-ikli
Автор

class Solution {
public String removeStars(String s) {
Stack<Character> word=new Stack<>();
int i=0;
while(i<s.length()){
if(s.charAt(i)!='*'){
word.push(s.charAt(i));
}
else{
word.pop();
}
i++;
}
StringBuilder s1=new StringBuilder();
while(!word.empty()){
s1.append(word.pop());
}
s1.reverse();
return s1.toString();
}
}

Java implementation using stack

Sawlf
Автор

Waiting for today's Leetcode bro.

souravjoshi
Автор

ye toh same remove adjacent duplicate characters type question hai

sakshamGupta-gi
Автор

public String removeStars(String s) {
StringBuilder builder = new StringBuilder();
for(char c: s.toCharArray()) {
if (c == '*') {
-1);
} else {
builder.append(c);
}
}
return builder.toString();
}

TechieTech-gxkd
Автор

Try improving your thumbnail make it more professional your content is quite amazing compared to others..

raghavsundriyal
Автор

like off kyu kiye hai? itna toh smjhaye hai.. on rkha kijiye.

ashutosh
join shbcf.ru