Literally itna details mei youtube mei time leke koi nahi padhata, direct approach batake 10-20 mins mei video khatam kar dete hai . Thanks a lot bhaiya for your efforts Love you 3000❤❤ and Eid mubarak❤🌙✨
bhai maine kam se kam 10 article padhe par kahi bhi intution nahi mili phir last m video dekhi aur inution samzi aur code khud se likh liya heads off you brother
@@RishabhChatterjee-fg2gz if you are know some about coding and then you practice striver he is best because its question choice and all are no comparison. He explained well no doubt but why comparing with the person with best playlist all over UA-cam tuf and tuf+
Niceee! I implemented it on my own using the approach, but I modified original input instead. string removeKdigits(string num, int k) { for(int i =0; i(int)num[i+1] && k>0 ) { num.erase(i,1); i--; k--; } else i++; // agar index out of bound chale gaye less than 0 toh.. if(i0) num = num.substr(0,num.size()-k); // just to remove leading zeros int leading = 0; while (num[leading] == '0') leading++; if(leading) num.erase(0, leading);
// agar sabhi kuch remove ho raha hai, toh.. if(!num.size()) num = "0"; return num; }
I don't know you will read my comment or not but your explanations are the best, literally your tone of speaking , interaction with audience. Literally I have don't have words to say hats off brother .... Keep it up ☺️
you simply beat the explanation of all other UA-cam channels. All teach how to solve the problem, but you show how to build it. In your case, DS comes later because that can be self-understood which DS to use.
I am not sure about my approach, but tried using sliding window of k size here, like for input num = "1432219", k = 3, we have windows 143, 432, 332, 221, and 219. Out of these, max one is 432. So, its removal gives 1219. When I implemented it, it gave TLE at last testcase 😅
amazing explanation thank you I tried to solve this earlier without watching any videos... I was trying to remove consecutive numbers only, when my code started failing earlier then I realize it was wrong one doubt, when k>0 , e.g. 123678 after traversal we are removing from the back and not considering the place value here I can see from example those are the largest numbers but earlier place value was more important hence confused, so please explain
When a number is already in ascending order then removing from front will be better because we already have lower numbers in most significant places and don’t want to get rid of them. For example : “1234” , K = 2 If you remove from front - “34” If you remove from back - “12” Obviously second one is smaller.
i submitted wrongly 6 times, coz of those shitty corner cases. But how do we know in real interview that these many corner cases are actually exist in the problem?? Finding all corner cases are not easy sometime, thats what i feel.
bhai yaar apan ko string de rki h like-"1432219" toh sabse chota Number jo ban sakta h vo toh ---"1122" here i remove 4,3,9... why this was not a answer ?? please tell me
i did on my own, can't believe i figured out the stack part (❁´◡`❁) but got an mle later on reading out the discussion section saw a person with the same problem, realised str = a + str is o(n) then used str.push_back(a); and revered it. class Solution { public: string removeKdigits(string num, int k) { stackst; for(auto &digit:num){ while(k > 0 && !st.empty() && st.top() > digit){ st.pop(); k--; } if(st.empty() && digit == '0'){ continue; } st.push(digit); } while(!st.empty() && k>0){ st.pop(); k--; } string ans; while(!st.empty()){ char val = st.top(); st.pop(); ans.push_back(val); } reverse(ans.begin(),ans.end()); return ans == ""?"0":ans; } };
Stack jaae bhaad me. 🤣🤣🤣
Koi aapki tarah parha nahi sakta bhai. love you
explaining code is for kids ..Legends build intuition from ground up .. 🔥🔥🔥🔥🔥🔥"bhadme jae stack"
Best video of entire DSA community among all DSA channels in youtube..
Love from Bangladesh ❤️
Love from 🇮🇳 😇😇❤️❤️
Thumbnail khtrnaak h bhai😂😂
😅
Literally itna details mei youtube mei time leke koi nahi padhata, direct approach batake 10-20 mins mei video khatam kar dete hai . Thanks a lot bhaiya for your efforts Love you 3000❤❤ and Eid mubarak❤🌙✨
Bhai ekdm crystal clear samjhate ho, Love you brother ❤❤
bhai maine kam se kam 10 article padhe par kahi bhi intution nahi mili phir last m video dekhi aur inution samzi aur code khud se likh liya heads off you brother
Awesome explanation ❤❤
amazing explanation, subscribe to banta hai (done✅)
Eid Mubarak bhayya 🌙 🌙
You are soo good making vedio for us on this day also .
Waah explaination better than striver, Great brother you made every problem looks easy.
He teaches good and explain very nice .. but there is no comparison of striver 😊
@@harshitshrivas5444 striver bhai is question ko direct stack mein intuition build karaya isiliye bol rage hai
@@RishabhChatterjee-fg2gz if you are know some about coding and then you practice striver he is best because its question choice and all are no comparison. He explained well no doubt but why comparing with the person with best playlist all over UA-cam tuf and tuf+
you deserve more subscriber
Your videos are toooooo good.
Many students are with youuu.
🤯🤯🤯💥💥💥💥💥💥💥💥💥💥
Amazing! This place value is similar to “Next greater element III”
aaj pata chala ki school ke basics kis tarah se use kar sakate hai is question me aur monotonic ka dr khatam ho gaya
🙂🙃
Thanks bro, great work.
keep making videos like this .
Bro ur content quality is soo soo much good.
I always love ❤ the way you explain the question, the intuition, and then the code.. Thank you very much for such amazing content.
Best Teacher ever😊
bhai, bohot sahi explanation kiya he aapne, thank you bhai.
bhaiii yar tum aadmi OP ho
you are my best teacher
Niceee!
I implemented it on my own using the approach, but I modified original input instead.
string removeKdigits(string num, int k) {
for(int i =0; i(int)num[i+1] && k>0 )
{
num.erase(i,1);
i--;
k--;
}
else i++;
// agar index out of bound chale gaye less than 0 toh..
if(i0)
num = num.substr(0,num.size()-k);
// just to remove leading zeros
int leading = 0;
while (num[leading] == '0')
leading++;
if(leading)
num.erase(0, leading);
// agar sabhi kuch remove ho raha hai, toh..
if(!num.size()) num = "0";
return num;
}
I don't know you will read my comment or not but your explanations are the best, literally your tone of speaking , interaction with audience. Literally I have don't have words to say hats off brother .... Keep it up ☺️
😇🙏❤️
Really liked this approach of solving this problem... Bhaiya you are great , your explanations are best😊
crazy explanation best one hands down
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Truly the Intuition God
Eid Mubarak Bhai 🌙
Eid mubarak, bhaijaan!🌛
nice yaar.. really aaj frustate hi hi gya tha
Best Explanation
bro, ur explanation is very good... nice video
thank you bhai for clearing T.C. Confusion
Sir we need this type Intuition it's great 👍 100% understand basic to advance thanks you Sir
Really great way to explain and approach problem 🙌🙌.
It really helps me
your intuition explanations are best!
amazing Guru!
Hats off to your explanation ❤
BESTESTT EXPLAINATION!❤❤❤
you are legit bro.
Very Intuitive Solution 👍👍Can you upload leetcode 729 too ?😅
Amazing Explainationssss ❣❣
you simply beat the explanation of all other UA-cam channels.
All teach how to solve the problem, but you show how to build it.
In your case, DS comes later because that can be self-understood which DS to use.
gr8!!
Eid Mubarak ✨ Bhai ❤️
thanks bhai for making me consistent
Aaj lga ki code krna bhi entertaining ho skta hai>>>
Kyoki Nyi Nyi stories sunna kisko nhi Pasand😂
So guys, “Aao, story se code likhe” 😁❤️
Was waiting 🎉for
Thank u so much bhaiya ❤
Stack jaae bhaad me. 😂
Thank You!
class Solution {
public:
string removeKdigits(string num, int k) {
string fa = "";
int n = num.size();
for(int i = 0; i < n; i++){
while(fa.size() > 0 && fa.back() > num[i] && k > 0){
fa.pop_back();
k--;
}
if(fa.size() > 0 || num[i] != '0'){
fa.push_back(num[i]);
}
}
while(k > 0 && fa.size() > 0){
fa.pop_back();
k--;
}
if(fa.size() == 0){
return "0";
}
else{
return fa;
}
}
};
Great Explanation Sir
Best Explaination !!!
Eid Mubarak bro. Aaj bhi video daaldiya 🥺
great solution bhaiya
Best Explanation🔥🔥🔥
bhaiya apne aapna intution itna acha kaise bana rakha h
❤🪄ur magesian sir🎉
Please make video on 877 stone game question from leetcode .
I am not sure about my approach, but tried using sliding window of k size here, like for input num = "1432219", k = 3, we have windows 143, 432, 332, 221, and 219. Out of these, max one is 432. So, its removal gives 1219. When I implemented it, it gave TLE at last testcase 😅
yeah me too trying to do this but unable to implement it. Can you share your code here
That is not always gonna give you correct answer
Eid Mubarak
Eid Mubarak❤
Mast paaaji ....Eid mubarrak saar
Eid Mubarak 😇❤️
I see future Coding Carryminati in your video
aaj pahli baar school m padha hua kaam aya 😅😅
Happy Eid sir❤
class Solution {
public:
string removeLeadingZeros(string &str) {
size_t pos = str.find_first_not_of('0');
if (pos !=string::npos) {
return str.substr(pos);
}
return "0";
}
string removeKdigits(string num, int k) {
if(k==num.length())
return "0";
string st="";
int i=0,n=num.length();
while(i
amazing explanation thank you
I tried to solve this earlier without watching any videos... I was trying to remove consecutive numbers only, when my code started failing earlier then I realize it was wrong
one doubt, when k>0 , e.g. 123678 after traversal we are removing from the back and not considering the place value here
I can see from example those are the largest numbers but earlier place value was more important hence confused, so please explain
When a number is already in ascending order then removing from front will be better because we already have lower numbers in most significant places and don’t want to get rid of them.
For example : “1234” , K = 2
If you remove from front - “34”
If you remove from back - “12”
Obviously second one is smaller.
Bhai leetcode 53 kadane algorithm p ek video dalo please begineer se advance tk
Used dynamic programming , 23/43 test cases passed
Eid Mubarak!!!
Eid Mubarak ❤️❤️🌙🌙
Eid Mubarak dada❤
😊😊
Bhaiya Leetcode Q. No. 25 (Remove Nodes in K Group ) ka easy approach bato na
Love u bro, happy ugadi
❤️❤️😍😍 Happy Ugadi
understood
i submitted wrongly 6 times, coz of those shitty corner cases.
But how do we know in real interview that these many corner cases are actually exist in the problem??
Finding all corner cases are not easy sometime, thats what i feel.
Respect
Bro maximum wins from two segment ye wala question karo please
Dynamic programming is more intutive
Provide these slides link well It will be really helpful
Sure thing.
I am a little occupied now, I will share the slide link tonight for sure ❤️❤️
❤❤
aapka video kaafi long hota h thoda short banao sir...
mzaa aaya ❤
Stone Game 7 pe ek video bna do sir please
bhai yaar apan ko string de rki h like-"1432219" toh sabse chota Number jo ban sakta h vo toh ---"1122" here i remove 4,3,9... why this was not a answer ?? please tell me
You can’t rearrange the number.
💯💯💯💯💯💯
Please complete dp concept series
yes please sir @codestorywithmik
Sure. Next video Coming this weekend
Leetcode 853
please solve in java also
I will definitely try to cover java coding in future videos. As of now, I put C++ as well as JAVA code in the github link in the description 😇🙏
full dsa laooo
i did on my own, can't believe i figured out the stack part (❁´◡`❁) but got an mle
later on reading out the discussion section saw a person with the same problem,
realised
str = a + str is o(n)
then used
str.push_back(a);
and revered it.
class Solution {
public:
string removeKdigits(string num, int k) {
stackst;
for(auto &digit:num){
while(k > 0 && !st.empty() && st.top() > digit){
st.pop();
k--;
}
if(st.empty() && digit == '0'){
continue;
}
st.push(digit);
}
while(!st.empty() && k>0){
st.pop();
k--;
}
string ans;
while(!st.empty()){
char val = st.top();
st.pop();
ans.push_back(val);
}
reverse(ans.begin(),ans.end());
return ans == ""?"0":ans;
}
};
Awesome 😍
Bhaiyya can you explain in English in your videos
Bhaiya but sabse chota to 1123 ho ga na
You can’t rearrange the digits in the string
aise teacher ke itne kam subscribers?😕
thumbnail 😂🔥🔥
Bro your leetcode id