Recent got the same question in Agoda interview for Engineering Manager. I just applied the greedy and it worked well, the only change required is that while finding out largest number for swapping in the remaining string your should start from the last like loop from length-1 to i+1 Since in case of repeat we need to find the least denomination to create the largest number, Enjoy 🎉
@divyanshmishra5121 Жыл бұрын
bhaaiii subah se 10 baar check chuka tha for new video as there was no video since last 10 days. finallyy!
@someshpatel76604 ай бұрын
Man we need more people like you. For any DSA topic I first search it with your name. Thanks for all your efforts. 🔥🔥🔥🔥
@simnidhnidh91225 ай бұрын
Aapne bhaiya bhaut ache se explain kiya especially that similarity and dissimilarity ig no can can explain like this in this whole youtube community
@Raj10185 Жыл бұрын
Bhot behterren question hai ye Backtracking ka pura hi concept clear kar diya . Bhut sare edgePoints hai isme ab iska code khud se try karta hai . Accept ho jyega to maza aa jyega
@Raj10185 Жыл бұрын
yes i finally i am able to do it :- class Solution { public: //Function to find the largest number after k swaps. string maxi = ""; void solve(int idx , string &str , int k) { if ( idx == str.size()-1 or k==0){ maxi = max(maxi,str); return; } for(int i = idx+1 ; i < str.size();i++) { char maxiChar = *max_element(str.begin()+i,str.end()); if(str[i] > str[idx] && str[i]==maxiChar) { swap(str[i],str[idx]); solve(idx+1,str,k-1); swap(str[i],str[idx]); } } //agar loop se kaam nhi hua solve(idx+1,str,k); } string findMaximumNum(string str, int k) { string temp = ""; solve(0,str,k); return maxi; } };
@onechance56644 ай бұрын
14:17 was funny "fhaaltu bakwaas hai"😂
@RitikaMajumdar__F6 ай бұрын
Jb maine phele question video ke baad yeh video dekha kya gajab ka smjh aya 💯💯
@lofireverbz-wy7go Жыл бұрын
bhaiya ek humble request hai bus ye btado backtracking ke bddd konsi playlist aeegi taaki vo topic khi or se na pdhu jab tak please bhaiya graph ya tree konsi aegi bhaiya??????????
@mithileshkumar9653 Жыл бұрын
tree
@mohit6215 Жыл бұрын
The legend(Aditya verma)will always come back for us❤❤
@11siddhesh5 ай бұрын
I like your videos a lot, I have a constructive feedback: same explanation is repeated multiple times which makes the video longer than it should be.
@shravani292211 ай бұрын
Hi when will you complete the dp series?
@abhayjoshi362 Жыл бұрын
Again amazing video well explained 🔥🔥 or ha biyaah nhi hua haii😂🤣
@ymanojx Жыл бұрын
CEO of voice recording
@ujjwalkatiyar324910 ай бұрын
Kese ne notes banae hai kya ? Please share kar do
@divyanshmishra5121 Жыл бұрын
please upload next videos. Its been more than a month. We've placements this year. Atleast complete this series.
@shreyashj.sharma974610 ай бұрын
he's a working professional doing this on the side for free for students such as yourself, be grateful and stop demanding.
@thorxn13825 ай бұрын
Free ka mile toh aur mangte hain
@divyanshmishra51215 ай бұрын
@@shreyashj.sharma9746 bhai tu thoda sa bkl hai kya? request hi toh kar rha tha main. teri kyu jal rhi bhai
@pinkysinghala Жыл бұрын
Bhaiya sequence pattern matching ka recursive version jo aapne 31 video of dp m kha tha upload krne ko plz upload it 🛑🛑🛑🛑
@rishabhahuja7413 Жыл бұрын
Bhai Graphs and Trees please🙏
@pinkysinghala Жыл бұрын
Bhaiya 27 video of dp not uploaded plz upload it 🛑🛑
@PiyushCodes-ph3hl Жыл бұрын
@Aditya Verma please complete the DP series as well 🙏🙏🙏
@janakiramireddikoki70845 ай бұрын
Did not understood why it's not a greedy choice. If we have 1 swap and number is 4577 then you will always swap 4 with last 7 then only the largest number comes. Ex: 4577 => 7574 if we swap with first 7, 4577 => 7547 which is not largest. So you will always swap with last largest no. Please correct me if i missed something
@SnoW-bk1zn4 ай бұрын
he is saying if there are only 2 swaps 4577 -------- with greedy 1st swap (4 with first 7) - 7547 2nd swap( 5 with 7) - 7745 -------- with backtracking(backtracking considers all the combinations) -1st combination 1st swap (4 with first 7) - 7547 2nd swap( 5 with 7) - 7745 -2nd combination 1st swap (4 with second 7) - 7574 2nd swap( 5 with 7) - 7754 *** now with backtracking we are able to find the largest I think this is it , but I don't have much knowledge about greedy so I may also be wrong.
@ankurrajput2367 Жыл бұрын
Finally legend back 🎉
@SagarMishra-r6h7 ай бұрын
Best Line - 22:32 🤣🤣
@PiyushCodes-ph3hl Жыл бұрын
bhaiya please DP series complete kardo
@Dezy_Kri Жыл бұрын
Aditya Bhaiya kar do upload videos bahut din ho gye🥲
@thesyazah Жыл бұрын
please upload the next video
@aishwaryacj5683 Жыл бұрын
Please continue to make vedios.. Strings , Queues , Trees Please cover this topic please
@solarsystem91566 ай бұрын
videos* :)
@mehulsuthar7554 Жыл бұрын
bhaiya i have one question, so i have started cp and getting quite good at it(currently at dp). i am studying bsc cs third year I was searching for the internship online and I am see everywhere that they mostly require some kind of framework more than the coding skill I am losing motivation to study cp tbh, also quite confused with this things. I want to get a job programming job please can you help with this? ik that cp is important and all for efficient and good coding skills but I am confused now.
@RohitKumar-kj3yl Жыл бұрын
same with me too
@munvut877 Жыл бұрын
bro maintain both like learn atleast one web framework like React,Angular.
@ronitkaushik46346 ай бұрын
those who know why it isnt greedy watch from 08:24
@nitinchoudhary3549 Жыл бұрын
Bhaiya roz ya alternate days video daala karo plss..
@khalidplayzz3189Ай бұрын
i watched whole video till end , im more confused now :)
@TanuKansal-nn4el Жыл бұрын
Is this question on leetcode?
@bommakantibeeraiah14868 ай бұрын
geeksforgeeks
@paradoxOP1002 Жыл бұрын
kisi pe problem link ho toh plz dena. thanks in advance :)
@riturajtrivedi7851 Жыл бұрын
Adi bhaiya at this point I doubt kisi aur youtuber ko DSA aata bhbi tha ya nahi 🥲
@RohitSharma-u2q5q3 ай бұрын
watching this video from mata mandir aditya bhiya know about this place
@dhonimsd9506 Жыл бұрын
Can you explain in English or add English subtitles so that non Hindi people like me can understand 😊
@rohitronte2405 Жыл бұрын
Hi again😍
@sumitbasu51468 ай бұрын
Tree Tree Tree Please please please
@solarsystem91566 ай бұрын
Plant a seed :)
@chandrasekar-ft9br Жыл бұрын
Can you please make a video in ENGLISH
@shashanksuman68047 ай бұрын
Sare problem tumne solve ni kiya 😢
@naveedwaddo8817 Жыл бұрын
class Solution{ private: void solve(int start , string &s , int k , string &ans){ if(k==0 || start==s.size()){ ans = max(ans , s); return; } char maxVal = s[start]; for(int j=start+1; j
@aryanmittal5676 Жыл бұрын
bro why did u add that no swapping statement. Can u explain ?
@naveedwaddo8817 Жыл бұрын
@@aryanmittal5676 statements Means : Move on to the next index (start+1) without making a swap at the current index. Explanation : The following code for exploring the possibilties for swap : for(int i=start+1; i s[start] && s[i]==maxVal){ swap(s[start] , s[i]); solve(start+1 , s , k-1 , ans); swap(s[start] , s[i]); } } lets suppose the if condition inside the forloop is not true for a atleast once then our recursion is not calling for next start+1. that case is s[start] > s[start+1,....n] then there no need to swap the s[start] with s[start+1 ,...n] so the problem is how can i call the recursion without making swap , so to do so we call the recursion with the line solve(start+1 , s , k , ans); // no swappting.
@aryanmittal567611 ай бұрын
@@naveedwaddo8817 Thanks man for the answer
@amarjeetyadav77837 ай бұрын
Bade dharmik vyakti ho @Aditya Verma. Backtracking me bh dharam ki baat.
@_desouvik9 ай бұрын
Biyah kar liya DSA ke sath, Unsubscribe kardu kya?