Let's march ahead, and create an unmatchable DSA course! ❤ Timestamps someone please :) Use the problem links in the description.
@brajeshmohanty2558 Жыл бұрын
At 23:47 my mind just got blown away. Me be like: - itna easy kese Benstocks 😂🙏. Bhai iPad ka notes ka bhi pdf dalo na . Tumaaher writing sei sab samajh mai ata hai. Boh tuf sight par itna bada article dekhne sei dar lagta hai 🙂. But you are doing amazing job bhai thank you 🙏😌.
@Atharva_kathiyawadi Жыл бұрын
appreciable !!
@ParasSharma-mf8or Жыл бұрын
Please upload the next video.
@gautamsethiya1397 Жыл бұрын
@takeUforward class Solution { public: void rotate(vector& nums, int k) { int n = nums.size(); k =k%n; int temp[k]; for (int i = n - k; i < n; i++) { temp[i - n + k] = nums[i]; } for(int i=n-k-1;i>=0;i--) { nums[i+k]=nums[i]; } for(int i=0;i
@yaswanthmitta8983 Жыл бұрын
for moving zeroes to the end we cen write it in 1 loop instead of two though time complexity is same , complexity for understanding decreases : v oid moveZeroes(vector& nums) { int j=0; for(int i=0;i
@zenithria_4144 ай бұрын
Who is grinding their head with DSA in their summer vacation?? Heartly thanks to striver for making us understand dsa in such depth :)
@prasannagodiyal67364 ай бұрын
Me😃
@avgguy71294 ай бұрын
me too lol
@JohnCena-uf8sz4 ай бұрын
bro this course from his website is completely free for now right ? ... or it has premium paid version as well ?
@victory73613 ай бұрын
What do u mean by summer vacation 😢?
@AdityaKumar-gx2ip Жыл бұрын
For Right Rotation of Array void rotate(vector arr, int d) { if(d>size) d = d % size; reverse(arr.begin(),arr.end()); reverse(arr.begin()+d,arr.end()); reverse(arr.begin(),arr.begin()+d); }
@bishalkundu7592 Жыл бұрын
Thanks a lot sir for taking out time from your busy schedule and making videos and uploading those videos in the span of 2-3 days. It takes a lot ot effort. Thanks a lot 😊😊
@arnab_1611 ай бұрын
not only your dsa knowledge is good also your communication skill, voice tone , body movement is superb 🥰🥰
@sanjana693118 күн бұрын
Agreed. He's so smart and confident, definitely a role model to students!
@luckshaeey Жыл бұрын
27:00 rotating an array left by 1 place is equal to rotating it right by n-1 places. We can use this information for rotating an array to right by d places.
@takeUforward Жыл бұрын
Perfect thought!
@bhargavanand7325 Жыл бұрын
great
@himanshukaushik9223 Жыл бұрын
Bhai leetcode pa left rotation question reverse .end() and begin() use karna pad Raha hai but gfg ma nahi why
@bhargavanand7325 Жыл бұрын
@@himanshukaushik9223 in case of vector we use stl function like begin() and end() but in case of array we don't use it for example in gfg
@himanshukaushik9223 Жыл бұрын
@@bhargavanand7325 thanks bro
@ruhiawasthi94 ай бұрын
I have written this approach for rotating the array to the right by k steps : void rotate(vector& nums, int k) { k%=nums.size(); reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin() + k); reverse(nums.begin()+k, nums.end()); }
@himadriroy7980 Жыл бұрын
I did not only enjoy the lecture but loved it too. Thanks Striver Bhaiya for explaining so lucidly. ❤
@hey-cg3fv Жыл бұрын
Move zeroes question another approach with O(1) space int j=0; // Firstly taking all non- zeroes number for(int i=0;i O(1)
@ByteBuilder-b6u3 ай бұрын
Really your thought process is really clear and the way you write the code is awesome.For union of two arrays you have written the code in such a simpler way whereas in first go I wrote the code this way : vector < int > sortedArray(vector < int > a, vector < int > b) { // Write your code here int i = 0; int j = 0; vector ans; while(i < a.size() && j < b.size()){ if(a[i] < b[j]){ if(i == 0){ ans.push_back(a[i]); } else if(a[i] != a[i-1]){ ans.push_back(a[i]); } i++; } else if(a[i] == b[j]){ if(i == 0){ ans.push_back(a[i]); } else if(a[i] != a[i-1]){ ans.push_back(a[i]); } i++; j++; } else{ if(j == 0){ ans.push_back(b[j]); } else if(b[j] != b[j-1]){ ans.push_back(b[j]); } j++; } } while(i < a.size()){ if(ans.back() != a[i]){ ans.push_back(a[i]); } i++; } while(j < b.size()){ if(ans.back() != b[j]){ ans.push_back(b[j]); } j++; } return ans; }
@honblegaurav99172 ай бұрын
can you tell me why i++ and j++ should be outside of if else loop. because for me it is not accepting the solution but accepts when i put i++ and j++ inside the if else loop
@Str13011 Жыл бұрын
Thank you for all the tutorials, Please keep supporting from starting to get good placement by the help of your tutorials!
@puneetnj Жыл бұрын
Right Shift Solution(Leetcode 189): k = k % arr.length; reverse(arr, 0, arr.length-1-k); reverse(arr, arr.length-1-k+1, arr.length-1); reverse(arr, 0, arr.length-1);
@hari7939 Жыл бұрын
Just do k=k%n, k=n-k!! as simple as that
@senseiAree Жыл бұрын
I always thought that the optimal solution to this code was the hashset one that you did in the middle part. It blew my mind when I saw the optimal one... And that too so easy man... Wow .. just wow to your observation ❤
@codeby_chance67285 ай бұрын
Striver please bring string series. Much needed
@sahadevbhaganagare4761 Жыл бұрын
me first getting the optimal solution and then finding the brute 🤣🤣
@he_KARTIK10 ай бұрын
mee too😂
@Vikas-dm9uc10 ай бұрын
#me2 moment
@helloworld-n1z9 ай бұрын
how to remember logic ,i always forget nd cant able to code
@sahadevbhaganagare47619 ай бұрын
@@helloworld-n1z I am not the right person but still always go back to the code after a week or so and try solving it again. Then review it after a month. That is it, it will get hard coded in your brain after that.
@Me_Meraj8 ай бұрын
Bro me too 😢 Isi wajah se easy problem solve krne me v time lgta h 😂😂 dimag me bs chlta h ki optimal hi krna h
@AbhishekSingh-rp6hp Жыл бұрын
Your course is awesome wish I could have found your course a year before currently I am in 3rd year of my clg 😊
@anshu59kumari Жыл бұрын
From which college u r
@AbhishekSingh-rp6hp Жыл бұрын
@@anshu59kumari Techno International New Town West Bengal
@sanjaykrishna6897 ай бұрын
left rotation to right rotation: simple approach is to think oppositely to left rotation. Shift all elements right of d and add to temp and push it. Just reverse the order of the reverse statements used in left rotation!.
@MotivexBeastt9 ай бұрын
Striver is the lion of this community
@MONESHSG6 ай бұрын
Brother, Actually only because of you i came to know what is coding and how to perform our own logic while writing code. Your teaching was nice and I really love it. once before viewing your videos i may code but i don't know how it works internally, but after seeing ur videos it is very easy to understand the working ❣. my first own logic: vector temp; int first = arr[0]; for(int i=1; i
@kushagramishra5638 Жыл бұрын
Understood 😄. Logic used for right rotate the array k places is that instead of rotating array right by k places I have rotated it n-k places to left . so code for this is - class Solution { public: void rotate(vector& nums, int k) { int n = nums.size(); k = k % n; reverse(nums.begin(),nums.begin()+(n-k)); reverse(nums.begin()+(n-k),nums.end()); reverse(nums.begin(),nums.end()); } };
@Miracle_shaw Жыл бұрын
hey, me also applied same approach
@itzmartin20 Жыл бұрын
same here
@jatinukey4062 Жыл бұрын
Exactly right
@expl0itr7 ай бұрын
reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin() + k); reverse(nums.begin() + k, nums.end()); u can do this also.
Timestamps: 0:00:00 - Intro 0:00:55 - Q1. Left rotate an array by 1 place 0:07:33 - Q2. Left rotate an array by D places 0:26:36 - Follow up Right rotate an array by D places 0:27:11 - Q3. Moving Zeroes to end 0:40:54 - Q4. Linear Search 0:43:01 - Q5. Union of Two Sorted Arrays 0:59:04 - Q6. Intersection of Two Sorted Arrays 1:12:22 - Outro
@MAX_RITIK2 ай бұрын
at 39:57 int j=0; for (int i = 0; i < n; i++) { if(arr[i]!=0){ swap(arr[i],arr[j]); j++; } for moving zeros to end also o(n)
@md.ualiurrahmanrahat2400 Жыл бұрын
Thanks for providng such amazing course for completely free. We are intended to you.
@shreyasr28852 ай бұрын
he never skips anything, Patience is next level!!
@UECSoumyaRay Жыл бұрын
code for right-rotation: void rotate(vector& nums, int k) { int n = nums.size(); if (k > n) { k = k % n; } reverse(nums.begin(), nums.begin()+n-k); reverse(nums.begin()+(n-k),nums.begin()+n ); reverse(nums.begin(), nums.begin()+n); }
@crazybro43838 ай бұрын
Hii brother can you pls explain me why time complexity of intersection is O(1) and not O(n), where n is the size of larger sized array. Time stamp- 1:12:01
@architha43055 ай бұрын
for the first time i guessed which concept can be used it might sound like a small thing but as a beginner who is just learning to code actually implementing codes without any reference and knowing which loop is used is really HUGE for me. THANK YOU SOO MUCH
@zenmonk294 ай бұрын
same for me. feels like a big leap
@KrishnaKumar-b4m9p2 ай бұрын
hi in which question u implemented the code yourself? i am having a hard time in writing code for right rotate an arrray ky k places on my own...
@satishmaurya7032 Жыл бұрын
What a wonderful video, it was vey good. Your way of teaching concepts through questions is best.
@devanshimehta780Ай бұрын
my motivation are your efforts, wont let them go in vain, thankyou STRIVER
@aswinsrikanth408 Жыл бұрын
Understood and what an explanation Love your explanation bro, just continue doing what you are doing for the coding community Amazing person
@curs3m4rk8 ай бұрын
I recommend everyone to solve the linked leetcode problems attached as well, as the code needs to be tweaked little bit . So u can understand and do by yourself Great approaches Striver. thanks
@valiant449810 ай бұрын
Guys i just wanna ask something....r u guys doing all these problems on your own or like just watching the lectures
@ishanmoykhede948410 ай бұрын
First Understanding the problem then finding approach to solve it then if I make the correct solution then codding it in vs code and moving to nxt question and if I didn't get the solution then watching striver
@AbhinavTiwari-u7b5 ай бұрын
done the assignment and understood each and every concept . Sir appreciate your hardwork
@sikanddhingra583510 ай бұрын
bhai ki pehli video lgayi h ye mene. bohut maja aya, dil garden garden hogya bilkul. thanku bhai.😁
@vasudev6559Ай бұрын
One more approach can be: void moveZeroes(vector& nums) { int n=0; for(int i=0;iO(N) SC->O(1) similar but less code
@kirankawade3424 Жыл бұрын
Thank you so much for sharing the content free of cost!! very nicely explained too😘
@RahulKumar-bd6py Жыл бұрын
Your are best amongst all I found on internet hatsoff to you sir.
@yashsaxena77879 ай бұрын
Great! btw in the worst case of Intersection, the space complexity would be O(n1>n2?n2:n1) because whichever one is smaller matches completely with the other array and ends. P.S.- the space is for returning the answer and not solution.
@b.bhargavitejaswi765512 күн бұрын
best teacher i have ever found in internet
@uttamvashisth4072 Жыл бұрын
Salute to this consistency.
@rohandhalpe9084 Жыл бұрын
😆😆
@saurabhtiwari9614 Жыл бұрын
@@rohandhalpe9084 😡😡😡
@rohandhalpe9084 Жыл бұрын
@@saurabhtiwari9614 kya hua bhai 😔
@saurabhtiwari9614 Жыл бұрын
@@rohandhalpe9084 Bhai aaisa face kyo bnaya h.
@PonVignesh-gv1xp5 ай бұрын
Learning a lot outta this guy..
@chiragbirla5606 Жыл бұрын
One thing striver..... In the sheet for the same question as we know there is a link attached for the gfg version and for the leetcode version but in some cases leetcode version is harder and sometimes gfg version. So please pick the hard problem for that
@ammarshaikh40544 ай бұрын
if you are geting confused in last loop at 18:55 i.e for(int i=n-d; i
@siddiqabr71102 ай бұрын
Bro the answer is fkn wrong has no one noticed it at all
@ammarshaikh40542 ай бұрын
@@siddiqabr7110Yes bro, i also got it wrong, when referred from video!
@AdityaKumar-be7hx Жыл бұрын
Actually, there is another optimal solution for moving zeroes problem. It is similar to the function we use in quicksort algorithm (quickselect part for arranging elements around pivot). void Optimal2(̀vector& nums) { int j=-1, n=nums.size(); for(int i=0; i
@nagame859 Жыл бұрын
Exceptionally concise👏
@KrishnaKumar-b4m9p2 ай бұрын
can u explain how the swap function works here. we want to move all the zeroes in the end how nums[++j]; ????
@KrishnaKumar-b4m9p2 ай бұрын
u wanna see my solution?? void Zero_at_last(int arr[], int n){ int i=0; for (int j = 1; j < n; j++) { if(arr[i]==0 ){ if(arr[j]==0){ continue; } swap(arr[i], arr[j]); } i++; // cout
@dhruvpatel05038 ай бұрын
In move zeroes to end problem we can use this also..., int y=0; for(int i=0;i
@anilkumar4200 Жыл бұрын
Why bro Why, Brute force->better-> optimal, Its really a big effort. thanks for such wonderful video series. Love the way u explain.
@triptisharma55505 ай бұрын
Your videos are awesome. I am finally learning to think about a problem and how to approach it. Thank you so much ❤️😬
@thebishalpaul9 ай бұрын
For left rotate by D places Brute can be : TC: O(n^2) if d==n Hence the rest two solutions shown in video will be better and optimal. int n=arr.size(); while (k>0) { Integer temp=arr.get(0); for (int i = 1; i < n; i++) { arr.set(i-1, arr.get(i)); } arr.set(n-1, temp); k--; } return arr;
@sangeetasharma8574 Жыл бұрын
Thank You Striver for such an effort. Your explanations and teaching is really amazing. Its really Valuable /priceless content :)
@AnshulVerma-cd1od10 ай бұрын
Thank you for making such great and useful videos by taking out time from your busy schedule.
@anuragprasad61169 ай бұрын
Concise solution for move zeroes to end: int p = 0; for (int i = 0; i < n; i++) if (arr[i]) swap(arr[p++], arr[i]);
@LearnwithEase20 Жыл бұрын
Love your explanation sir!You always make things simpler
@chandusweety33415 ай бұрын
class Solution { public void rotate(int[] nums, int k) { int n=nums.length; k=k%n; reverse(nums,n-k,n-1); reverse(nums,0,n-k-1); reverse(nums,0,n-1); } void reverse(int arr[],int start,int end) { while(start
@tanishagarwal599211 ай бұрын
In the three reversals, we are doing iterations just for half the time i.e O(d/2) + O((n-d)/2) + O (n/2) making it O(n) so TC as well as SC of optimal solution is better than the better solution.
@chidambarjoshi3470 Жыл бұрын
In the brute force approach of union of arrays, you could have directly returned the set instead of taking a temp vector and copying it all over, because the set would only take the single copies of the elements are the time of insertion
@nashimbiswakarma Жыл бұрын
bro you are right but most of the time they i.e., dsa practicing websites expect you to return the result in the form of array(for c++ vector and for Java ArrayList).
@prateekbhaisora Жыл бұрын
void rotateright(vector& nums, int k) { k = k % nums.size(); reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin()+k); reverse(nums.begin()+k, nums.end()); }
@harshavardhan184 Жыл бұрын
This much consistency is all we needed bhaiya🤞🤞🤞kudos to you
@karthikjadhav3464 ай бұрын
I guess I have an approach for "better" solution for "Move zeroes to end" ( 27:13 ) , correct me if i'm wrong but this is what I got, with T.C O(N+C) int count = 0; for(int i=0;i
@rohandhalpe9084 Жыл бұрын
Bhaiyaa ji please upload videos as fast as possible .Our placement season starting soon in June.💫💫💫💫💫💫💫💫💫💫💫💫💫💫
@Hi_kartik Жыл бұрын
Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. class Solution: def rotate(self, arr: List[int], d: int) -> None: n = len(arr) d%=n def reverse1(i,j,arr): while i
@tarun16843 ай бұрын
I gonna fainted..after watching at last that this was easy section..what will happen god in future..bcz I m beginner and finding difficulties 😢😢
@nishantsindhu34203 ай бұрын
Me too bro similar situation 😢
@sirishayatham18104 ай бұрын
You are making easy for us to understand DSA!! Heartfully Thanks to Striver Brooo
@ParasSharma-mf8or Жыл бұрын
0:00 Introduction of course 01:01 Left rotate an Array by 1 Place 04:38 Pseudo code 07:17 Code-compiler 08:05 Left rotate an Array by D Places 14:38 Pseudo code 20:18 Code-compiler 27:13 Move zeroes to end 37:41 Pseudo code 40:30 Code-compiler 41:05 Linear search 42:01 Pseudo code 42:43 Code-compiler 43:04 Union of two sorted array 53:33 Code-compiler 59:05 Intersection of two sorted array 1:09:30 Code-compiler
@takeUforward Жыл бұрын
Thank you Paras!
@ParasSharma-mf8or Жыл бұрын
@@takeUforward Welcome and thanks for this amazing course.
@samarthpai53592 ай бұрын
for rotaing by right: void rotateR(vector&arr, int k){ int n = arr.size(); reverse(arr.begin(),arr.begin()+n-k); reverse(arr.begin()+n-k,arr.end()); reverse(arr.begin(),arr.end()); }
@Lucifer-xt7un Жыл бұрын
Bro requesting you please upload videos alternatively as promised bcoz completely relaying on you for placements🥺🥺
@NithinvKumar-uk2he Жыл бұрын
Yes you are right, striver bro please we are requesting you please upload the video as promised by you 🙏
@takeUforward Жыл бұрын
I am keeping my promise, if you see am covering 5 problems in one video. So recording such a long video, then editing it, then uploading it takes time. I can upload daily, if you want me to to cover one video.
@NithinvKumar-uk2he Жыл бұрын
@@takeUforward ok brother thanks for helping us .we are waiting for upcoming videos ☺️
@harshavardhan184 Жыл бұрын
True
@Lucifer-xt7un Жыл бұрын
@@takeUforward understood ur pain bro thanks for everything.
@Gokul-gkl5 ай бұрын
We will have 2 solution one is talking the first 3(in case of d is 3) elements in the temporary array and then making the last 4 elements to the left most and then put back the first 3 elements in the temporary array to the array as you did And the another solution will be FIRST storing the LAST FOUR(which means for(i=d; i
@subhajitmandal18694 ай бұрын
"THERE IS A ONLY ONE KING IN DSA"
@Mythri3339 ай бұрын
Really it is world biggest best dsa course. 😊😊
@SatwikSharma21bcs0805 ай бұрын
✦ Learn left rotation of an array by one place 00:03 ✦ Understand the difference between space used and extra space in algorithms. 06:07 ✦ Learn how to left rotate an array in C++ or Java 18:42 ✦ Left rotate an array by D places 24:15 ✦ Use two pointer approach to move zeros to the end of an array. 34:25 ✦ Summary of array problems 40:19 ✦ Implementing a pointer approach to find the union of two sorted arrays. 50:18 ✦ Union and intersection of sorted arrays 55:30 ✦ Optimize time complexity using two pointer approach 1:06:02 ✦ Optimal solution for intersection of two sorted arrays Click to expand 1:11:14
@Unstoppable.Sakshi Жыл бұрын
I have reached here , sir . By following your A to Z DSA course . Thanks a lot sir..
@bipinsingh1490 Жыл бұрын
Can u tel me is that a fee course or free course?
@Akash-yr2if Жыл бұрын
Hey Striver, Won't this work fine for the Move Zero's to the end : void moveZeroes(vector& nums) { int i=0; for(int j=0;j
@arunimmalviya1605 Жыл бұрын
How do you know if the first index i.e. i=0, will always going to be zero? Also you cannot initiate j from 0, if arr[] = {1,2,3,0}, both I and j will point to 1 and since they both are non zero elements, you are swapping them with themselves only.
@dhruvsolanki4473 Жыл бұрын
Clear explanation and amazing teaching.
@vivek5144 Жыл бұрын
Hi Striver can you please please upload the notes which you are explaining it will be very helpful 🙏🙏
@RamPageMMA5 ай бұрын
Take your own notes
@eakanshbhardwaj9 ай бұрын
43:50 its not i
@suriyavs8685 Жыл бұрын
Hey striver wonderful video. I have a query. The code will be applicable only if the vector or array is sorted in the intersection part. So do we need to sort it again or is there any other optimal approach ?
@VaishaliDhokchawle7 ай бұрын
Thanks a lot sir for taking out time from your busy schedule and making videos. It takes a lot of effort. Thanks a lot.
@sudhirdaga3453 Жыл бұрын
Right rotate array by d places is equivalent to left rotate array by n-d places. void rightRotateArrayOptimal(int arr[],int n,int d){ d = d%n; d = n-d; reverse(arr,arr+d); reverse(arr+d,arr+n); reverse(arr,arr+n); }
@ayushmittal9666 Жыл бұрын
It's wrong it should be d=n%d reverse(a,a+n) reverse (a,a+n-d) reverse (a+n-d,a+n)
@rainbowwords69315 ай бұрын
void rotate(vector& nums, int k) { int s = nums.size(); k = k % s; if(k == 0) return; reverse(nums.end()-k,nums.end()); reverse(nums.begin(),nums.end()-k); reverse(nums.begin(),nums.end()); }
@itz_fuzzy69419 ай бұрын
Munnawar Faaroqi explaining dsa questions...😂😂😂😂😂
@hidden_star144 ай бұрын
??
@DeepakKumar-e2s5q3 ай бұрын
Aisa hai kaide me raho
@itz_fuzzy69413 ай бұрын
@@DeepakKumar-e2s5q Ooye Chomu😂 tujhe pta to hai kya bolna chaha rha h tu
@AnasKhan-pm5ys4 ай бұрын
vector rotateArray(vectorarr, int k) { reverse(arr.begin(),arr.begin()+k); reverse(arr.begin()+k,arr.end()); reverse(arr.begin(),arr.end()); return arr; } Striver check it !
@aryankoul12383 ай бұрын
Not good way to in interviews rounds
@rish7394 Жыл бұрын
Bhaiya kab tk poora hoga 🥲
@bishalkundu7592 Жыл бұрын
In a previous post bhaiya said that he will try to cover this course in the next 3 months.
@nikhild.20 Жыл бұрын
Reverse Approach Code for Right Rotate:- class Solution { public: void rotate(vector& nums, int k) { int n = nums.size(); k=k%n; reverse(nums.begin(),nums.begin()+n-k); reverse(nums.begin()+n-k,nums.end()); reverse(nums.begin(),nums.end()); } };
@crazyxyzk143 Жыл бұрын
// right rotation by k places int k;// no of rotation cin>>k; int d = k%n; reverse(arr,arr+(n-d)); reverse(arr+(n-d),arr+n); reverse(arr,arr+n); for(int i: arr){ cout
@PrithaMajumder6 ай бұрын
Raj, Thanks a lot for This Amazing Video about C++ Arrays Video - 2 Completed ✅
@udaytewary38097 ай бұрын
we can slightly optimise shift 0 to end by using only 2 loops that by first we will construct the temp array as bhaiya created but what additionally we can do is we will maintain a variable count which will store the count of n9.of zeros in the array And then after constructing of temp array we would insert those zeroes at the end of array using a loop or insert as arr.insert(arr.end(), count_zeroes,0) this will insert zeroes at the end of array
@KiritiSrisai9 ай бұрын
your explanation is awesome and it is easy to understand
@RaunitJaiswal-s9v2 ай бұрын
agar kise array ko left rotate kar re hai toh starting from zero index till d index ....and uske baad ka elements ko left lejao and temp array ke elements ko daal do original me ......aur agar kise array ko right rotate kar re hai toh starting from last index till last index-d-1 .....and uske baad ke elements ko right lejao and temp array ke elements ko daal do original me ..........bsc op...raj bhaiya like kardete toh thoda acha lagta
@lost_hand7 ай бұрын
Such a great lecture i wouldn't never forget these conceptss❤❤
@chinmaymathakari9704 Жыл бұрын
Thank you so much for taking out time of your busy schedule. Can you please make such videos on Trees as well ? That will be a great help. Thanks a lot😊😊
@senpaidawwwggg Жыл бұрын
two pointer approach is great ...
@suprithsk9595 Жыл бұрын
left rotate without extra space: i=0 for j in range(1,n): arr[i],arr[j]=arr[j],arr[i] i+=1 return arr
@harshitbajeta206 Жыл бұрын
Thank you for all the tutorials till now and much more waiting for the videos of those questions, which are in the A2Z DSA course sheet.
@pranshugoyal1571 Жыл бұрын
Alternative solution to move zeroes to end - void moveZeroes(vector& nums) { int i = 0, j = 0; while(j < nums.size()){ if(nums[j] == 0){ j++; } else{ swap(i, j, nums); i++; j++; } } }
@ayansiddiqui7383 Жыл бұрын
can you explain the logic behind this please
@abhishekjadhav22502 ай бұрын
conscise solution for move zeroes to end class Solution { public: void moveZeroes(vector& nums) { int n = nums.size(); int j = 0; for (int i = 0; i < n; i++) { if (nums[i] != 0) { swap(nums[i], nums[j]); j++; } } } };
@Codro098 ай бұрын
26:06 for right shift int n = nums.size(); k = k%n; //temp varible to store the values which are n-d from left vector temp; // int temp[]={}; for(int i = n-k;i=0;j--){ nums[j+k] = nums[j]; } //Put back the elements of" temp" int z = 0; for(int l = 0;l
@sunnymishra2120 Жыл бұрын
I'm really lucky to have you as a teacher
@pritishpattnaik4674 Жыл бұрын
Incase somebody need the code for right rotate , it is in Leetcode rotate array Solution : void rotate(vector& nums, int k) { int n = nums.size(); k = k % n; vector temp; for (int i=n-k ; i=0 ; i--){ nums[i+k] = nums[i]; } int j = 0; for (int i=0 ; i
@saumyasarngal6109Ай бұрын
Thanku
@Himani-t3g2 ай бұрын
understood! really like the relatable example of relationship🤣🤣 thank you for your efforts
@vivekbharadwaj4170 Жыл бұрын
I wish I could get to know about your course in my first year, I'm in second year now, not late, btw thanks a lot (UNDERSTOOD)
@cinime Жыл бұрын
Understood! Fantastic explanation as always, I've enjoyed the video. Thank you very much!!