JAVAAID community: KZbin recently changed the way they monetize my content. My channel now needs 1,000 subscribers so it would be awesome if you could show your support by both watching my videos and subscribing to my channel. please hit the like button too, if you find it useful. if you haven’t already done so. Monetizing my videos allows me to invest back into the channel with new equipment so a small gesture from you goes a huge way for me. Many thanks for your support!
@sunilpatra90373 жыл бұрын
Wow, Amazed. That was quick. Thank you
@suchitragiri45464 жыл бұрын
yeah!! i got your point Thank you so muchh sir , i solved this problem using this logic but still i confused so , i decided to watching your video. Now i know the logic which is behind the code. 😊
@igorbarros96204 жыл бұрын
I just wanna say thank you, man! I really appreciate your efforts creating this videos with explanations.
@JavaAidTutorials4 жыл бұрын
Glad you like them!
@srikarchatla51783 жыл бұрын
awesome bro you were just very clear about this i loved it
@mihirk9535 жыл бұрын
Excellent explanation. Very easy to understand. Thanks very much for providing this.
@JavaAidTutorials5 жыл бұрын
Most welcome..:)
@FirMizzZ3 жыл бұрын
thanks. your channel is the best explanation. keep doing.
@dilipshukla21355 жыл бұрын
Awesome observation and explanation!!!! I am happy to come acrossed this post on first day of the new year !!!! Thanks for sharing!!!
@JavaAidTutorials5 жыл бұрын
Thanks a lot for your lovely feedback. 😊 If you find our channel helpful, please do share among your friends.
@aakashmudigonda33754 жыл бұрын
You are an excellent teacher❤️
@JavaAidTutorials4 жыл бұрын
Thanks for the compliment 😊
@humzarahman19453 жыл бұрын
Very helpful, thank you so much!
@perihanhill43975 жыл бұрын
Thank you so much! I missed % in my program and was trying to understand what's going on. Please share more codes! :)
@JavaAidTutorials5 жыл бұрын
Most welcome 😊
@HugoAyala19834 жыл бұрын
Perfect solution and formula explanation such a clean solution
@JavaAidTutorials4 жыл бұрын
Glad you think so!
@vigneshhendrix44474 жыл бұрын
Just Vera Level Bro!✨🔥. Expecting more !✨
@JavaAidTutorials4 жыл бұрын
😊
@vrashankraom3 жыл бұрын
By vector u can solve like this vector rotLeft(vector a, int d) { vectorarr; for(int j=d;j
@sushmitgoswami68363 жыл бұрын
is the same thing will work when rotation d is greater than array lenght?
@SoupTurtle165 жыл бұрын
Thanks for showing me an unique method of solving this
@JavaAidTutorials5 жыл бұрын
Most welcome..
@munazzainamulhaque88634 жыл бұрын
Such a nice explanation ...Plz make more videos on Interview Preparation Kit
@JavaAidTutorials4 жыл бұрын
Thanks and sure. We already have a playlist which has couple of videos, you can go through that. kzbin.info/aero/PLSIpQf0NbcCleuffqepcYEU5HLoSY8B_X will add more videos to it future.
@officialnizam5 жыл бұрын
very good explanation
@JavaAidTutorials5 жыл бұрын
thanks, Nizam for your feedback. Keep watching, keep commenting. It really motivates me to do more and better for you all. please hit the like button too, if you find it useful.
@poomaniraj93755 жыл бұрын
Super Explanations
@JavaAidTutorials5 жыл бұрын
thank you..
@dibasbaral47405 жыл бұрын
Nice explanation keep it up
@JavaAidTutorials5 жыл бұрын
Thanks @Dibas
@org29894 жыл бұрын
Where did you put the input? I did exactly the same as you did but I dont have the array's elements..
@JavaAidTutorials4 жыл бұрын
cross verify once, May be you have done some mistake code while implementing it
@ketanlalcheta45583 жыл бұрын
Can we avoid additional space of new array and sort in place from existing array ?
@kraisk11 ай бұрын
That's quite easy if you use an additional array. Now, try to do this in place.
@arshneetkathuria49994 жыл бұрын
this logic is not working for rotation which are greater than length of array.....sir kindly tell any other optimal solution.
@JavaAidTutorials4 жыл бұрын
Can you provide your input and share your code? because this solution is tested and working fine.
@charanp99315 жыл бұрын
Thumps up
@JavaAidTutorials5 жыл бұрын
Thanks..
@martinomamic3 жыл бұрын
Hi, first of all, thanks for your efforts, I haven't been doing these for a while now and getting back into it. What do you think about this solution? I've taken into account that array is smaller than "d". func rotLeft(a: [Int], d: Int) -> [Int] { var rearranged: [Int] = [] let arraySize = a.count let dividerIndex = arraySize > d ? d : d % arraySize rearranged = a.suffix(arraySize - dividerIndex) + a.prefix(dividerIndex) return rearranged }
@shaone_syem4 жыл бұрын
One other solution that crossed my mind is using a linked list so that we add the first d elements at the end while also moving the head. Complexity O(d).
@DharmendraKumar-ut2bn4 жыл бұрын
What if d=1, then RR will be more complex, right ?
@aishwaryaverma71295 жыл бұрын
if we had to do a right rotation then it would have been newindex=oldindex%n ?Is this correct?
@JavaAidTutorials5 жыл бұрын
what about d, you did not considered d at all in your formula then how you are going to find the new array without d ? just for analogy purpose- Suppose, people are standing in a queue as mention below (added their rank on top which can treat as index)- 1 2 3 4 5 6 7 💃💃💃💃 🚶💃💃 how far away the boy is? if look from left side, boy is on 5th place but if you look from the right side he is on 3rd place. and the same concept is used here to find left and right rotation...🙂
@vishalcoder49644 жыл бұрын
What is the exact space complexity of this code? I guess O(n), if so we can try Reversal Algorith that takes O(1) Space complexity... need not to mention, a very good approach followed here too!! hats ^
@JavaAidTutorials4 жыл бұрын
It is enough to say, time complexity is inversely propositional to space. So based on give constraint people can choose which approach they have to follow.
@AK_sheikh9334 жыл бұрын
Sir I need help in one question in Dsad solving airport solution
@JavaAidTutorials4 жыл бұрын
you can ping me on Instagram, will review it, if possible will surely upload video on that.
@AK_sheikh9334 жыл бұрын
@@JavaAidTutorials Thanks sir..I sent
@brandon-225 жыл бұрын
now if i understood what you talk it would be perfect
@JavaAidTutorials5 жыл бұрын
Sorry, I did not get your comment. Did you understand this problem or not?
@anonymous8038-c4m5 жыл бұрын
What about if we are trying to rotate n times?
@JavaAidTutorials5 жыл бұрын
Hi Rishabh, if you use the formula which is mentioned in the video you can see for rotating n times if you take modulo with n then result will be 0. it means no rotation at all. after n rotation array will become the same as it was in starting.
@jiteshkumar31125 жыл бұрын
the array will remain same
@sanandapodder50275 жыл бұрын
i am getting output in array not in String though converted to String, help me sir
@JavaAidTutorials4 жыл бұрын
Did not get you. paste your code here with detailed explaination.
@damodaranm30445 жыл бұрын
bro why dont u star a telegram or whatapp group . so the i we have any doubts u may sole it
@JavaAidTutorials5 жыл бұрын
We already have couple of telegram channels and groups, even whatsapp group as well, just check out the description of any video, you will come to know...😜
@AshuYadav-lk4rp5 жыл бұрын
what is the complexity of this ? can it be better ?
@JavaAidTutorials5 жыл бұрын
both time & space complexity for this solution is O(n).
@indianking00174 жыл бұрын
why this logic works only in java not in python or c++
@JavaAidTutorials4 жыл бұрын
The explained logic was generic, it should work in all language. would suggest try pasting your code here, will try to review it.
@indianking00174 жыл бұрын
U r absolutly right i will revisit an check might be i was do8ng sm silly mistake..as i tried i c++ then in python then i have to do it in java there it worked.! Soo ill be seding the codes if still i can't debugg thanks javaaid page is soo helpful!!
@pradeepmondal49434 жыл бұрын
Bro , we need 0(1) space solution
@kevinhu75813 жыл бұрын
This is only work when d
@claire39464 жыл бұрын
I still don't get it. Why right rotation??
@JavaAidTutorials4 жыл бұрын
Let me explain in another way, if 10 people are standing in a row and someone ask who is standing at 6th position then there are two ways to find it, either from front (or left) will go to 6th place or from back(from right) we can go to 4th place. Hoping this analogy can help you to understand this better.