Rearrange Array Alternately in O(1) space complexity and O(N) Time Complexity Geeksforgeeks Solution

  Рет қаралды 49,256

Hello World

Hello World

Күн бұрын

Пікірлер: 153
@otismilburn9018
@otismilburn9018 3 жыл бұрын
Awesome explanation! Please continue LeetCode Series sir. Cover atleast 600 questions so that we get prepared for Placements! One video daily sir:)
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
mera v yahi thought hai ekdum
@bhupeshpattanaik7150
@bhupeshpattanaik7150 4 жыл бұрын
7:25. ...phool paate wala division 😝😂👌 leaning ke saath entertaining hae yeh video 👍
@theroastingtoaster8542
@theroastingtoaster8542 2 жыл бұрын
Excelent explanation buddy......have been thinking for like 1 day, never thought of this approach, solved it using O(n) extra space. But your explanation is the best. Keep making these types of videos. You just earned a subscriber. Thankyou.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Very welcome! Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@AnandSharma-lt8wq
@AnandSharma-lt8wq 3 жыл бұрын
some key points any no%m = [0 to m-1] min elements are at odd postitions [1,3,,,,] max elements are at even postitions [0,2,,,,] we're basically storing 2 no's with a single no: using basic concept: dividend = divisor * quotient + remainder using modulo in each operation will give us older number(As that number may have modified already) (around 14:00 to 16:00 in video)
@ankushladani496
@ankushladani496 2 жыл бұрын
Jalwa Gajab Ka tha sirji....💯💯🙌🙌
@Knowledgeduniya1432
@Knowledgeduniya1432 2 жыл бұрын
Better than others explaination its good but still filling like zajbat badal gye
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks , Hahahhaah
@sahilverma3976
@sahilverma3976 2 жыл бұрын
I've watched many videos regarding this problem and this video has the best explanation. You were not rushing to teach the concept and made even the tiniest bit of things clear. Your new subscriber. Keep it up!
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
You're welcome! Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@ahn360
@ahn360 Жыл бұрын
@@HelloWorldbyprince cost to free but itna awsome concept share karne me jalan to hoti hai na bhaiya 🤪🤪🤪🤪🤪
@shashanksabharwal8591
@shashanksabharwal8591 4 жыл бұрын
By the end of 2021 you might have around 1 million subs... Bhai please... Sare graph, trees linked list jo bhi sb important questions hote h.. Jitne bhi interview k lie sare questions jo usually puchte h .. Please complete all of these if possible Array , string sab kuch sorting A to Z ... *I recentlt watched a video of your on linked list. And after watching that video i realised that you are the person i am looking for previous 3 months on youtube... Please complete ASAP.. If possible come live and exoplain code .. Please please please try to make as much as videos you can on a single day...
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks a lot for these wonderful response ❤️ I don't know I reach 1M or not ? But right now subscribers like you are the need of Hello World Thanks a lot I will definitely make videos and each and every topics And I will try ASAP
@pavankumar-lv4ne
@pavankumar-lv4ne 3 жыл бұрын
this guy trying this best to teach the concept. respect
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks Pavan for support
@sajalsangal1436
@sajalsangal1436 4 жыл бұрын
great I solved that practise question you gave, you explained the formula very well, this is what I wanted great job.
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks for watching ❤️ Keep sharing with your friends
@ishitaroy2238
@ishitaroy2238 3 жыл бұрын
One of the best problem solving video.... great job bhaiyaa.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep learning buddy 😊
@ROHITRAJ-bc7nq
@ROHITRAJ-bc7nq 2 жыл бұрын
Bhai tera padhane ka tarika mst h 👍👍👍
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
dil se thanks bhai
@saurabhvishwakarma2320
@saurabhvishwakarma2320 4 жыл бұрын
Very helpful video ...I like it 😊
@insanecode9374
@insanecode9374 5 ай бұрын
bhai you are entertaining !!
@rafiqn2675
@rafiqn2675 4 жыл бұрын
Bayya make 1 videos per day.... please...main thing is to group these videos according to their concepts (playlist)...very help full...
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
I will definitely try to make one vidoe ❤️
@musafirgauravv
@musafirgauravv 11 ай бұрын
In simple english --> By adding arr[i] every time, you are making sure that whenever you will take a % with maximum element, you will always get the original array in return, and by multiplying with modulo of alternate maximum and minimum values you are making sure that when you divide it by maximum element you will always get the new alternate array back
@ayushanand4530
@ayushanand4530 2 жыл бұрын
Beautiful Explanation! bhaiya you give each and every thing with logic and all the Concepts with Reason which is not Present anywhere else. Thanks a Lot bhaiya. Generally I do not Comment but Today I couldn't Refrain myself.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
So nice of you
@harsimran.27
@harsimran.27 3 жыл бұрын
such a good explanation. Thanks bhaiya.👍🏻👍🏻
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks buddy ❤️
@nayankhuman1043
@nayankhuman1043 2 жыл бұрын
Best Explanation !! Thanks a lot 🙌
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
thanks nayan
@trigunadityapnd
@trigunadityapnd 3 жыл бұрын
I've just started DSA and a friend suggested me this video. Turned out to be really helpful !!!
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks brother I hope you also spread my channel and someone else also send me message like u 🙂🙂
@samridhup
@samridhup 4 жыл бұрын
wow loved it, but there was lag in audio... though keep up the good work
@VivekKumar-ui1ro
@VivekKumar-ui1ro Жыл бұрын
Gajab concept bhaiya..maja aa gaya
@divy04
@divy04 7 ай бұрын
beautifully explained, awesome
@pranavkochhar9352
@pranavkochhar9352 3 жыл бұрын
Your explanation is very good!!
@anotherstranger3968
@anotherstranger3968 3 жыл бұрын
Really Great intuition!🙏🙏
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks a lot buddy
@vinothkannans1910
@vinothkannans1910 4 жыл бұрын
Great explanation 👍. Please explain in English
@shaiksabiha5796
@shaiksabiha5796 2 жыл бұрын
Jajakallahu khair bhaya ..
@mayankgarg4157
@mayankgarg4157 4 жыл бұрын
Nice logic sirrr❤❤❤❤❤❤
@sudhadevi6692
@sudhadevi6692 Жыл бұрын
Thx bhaiya for this ❤ lecture
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
thanks a lot
@akashkhandelwal-altruistic5363
@akashkhandelwal-altruistic5363 4 жыл бұрын
Sir, please make a video on how to find time complexity of any algorithm. I'm beginner in ds/algo
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Yeah sure
@RakeshKumar-pi8wh
@RakeshKumar-pi8wh 3 жыл бұрын
Buddy, i never commented on anyone's video.. but your explaination,, literally made me do so.. no words to explain.. just wanna say, thanks buddy.. fabulous work🙌🙌
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Waoo I feel lucky today 😎😎
@alexmercer5870
@alexmercer5870 3 жыл бұрын
Beautifully explained
@vikas5840
@vikas5840 2 жыл бұрын
finally found the best explanation for this question
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Glad it helped! Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@JaikishanJaikumar
@JaikishanJaikumar 3 жыл бұрын
Bhaiya u r awesome. No more words for u
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
thanks a lot Jaikishan keep learning buddy and be consistent and share my channel with your college groups that helps me a lot
@yagizegemen7303
@yagizegemen7303 Жыл бұрын
Thanks sir you made it very easy to understand this concept. Please Continue uploading questions sir. Fortunate to discover this explanation series.
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thank you, I will
@Socrates225
@Socrates225 3 жыл бұрын
nicely explained such a complex approach
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep learning and sharing buddy ❤️
@sidharthreddyarutla7483
@sidharthreddyarutla7483 3 жыл бұрын
Very good explanation sir
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep watching
@alphazero0
@alphazero0 3 жыл бұрын
Perfect video like karke iss video ke top me push kardo bhailog.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
keep learning buddy and be consistent and share my channel with your college groups that helps me a lot
@user93-i2k
@user93-i2k 10 күн бұрын
also Bhaiya has mentioned that the array will be sorted, so if you are applying it to unsorted array, sort it first
@nayasavlog1816
@nayasavlog1816 4 жыл бұрын
good explanation
@pritamsarkar3371
@pritamsarkar3371 4 жыл бұрын
this is the best youtube channel I found in 2020
@mohammedayan7157
@mohammedayan7157 2 жыл бұрын
ncy explaination!!!!!
@coderbhai4958
@coderbhai4958 3 жыл бұрын
Thank you 💘
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Any time!
@chidambarjoshi3470
@chidambarjoshi3470 4 жыл бұрын
bro, I have participated in hacktoberfest 2020, please can you make a video on that , as to how make quality pull request and win the challenge
@RiteshYadav-rc1np
@RiteshYadav-rc1np 3 жыл бұрын
its very simple bro just write or copy paste any good programs and make pull requests try to make 2 or 3 extra and you are done then after around 7 months raom outside with hacktoberfest T shirt
@InvincibleMan99
@InvincibleMan99 3 жыл бұрын
Thanks bro How to deal with, when we have -ve numbers ?
@sushantpandey2127
@sushantpandey2127 3 жыл бұрын
Thank you x 100
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Welcome x 1000000
@bhupeshpattanaik7150
@bhupeshpattanaik7150 4 жыл бұрын
16:53 confusion start 😂 ... Confused between mod and divide , itna part delete kar dete
@ARSHADKHAN-sy7vb
@ARSHADKHAN-sy7vb 3 жыл бұрын
yehi toh genuinity h bande ke !!
@sudhakarkumar3039
@sudhakarkumar3039 2 жыл бұрын
Very Nice
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks
@cr7johnChan
@cr7johnChan 2 жыл бұрын
Thanks
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Keep learning buddy
@shikhar2k01
@shikhar2k01 3 жыл бұрын
🔥🔥
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks brother 😊
@SunnyKumar-ud9gp
@SunnyKumar-ud9gp 3 жыл бұрын
Great explaination
@dhairyataneja3211
@dhairyataneja3211 2 жыл бұрын
Amazing!
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thank you! Cheers!
@asthadubey6571
@asthadubey6571 4 жыл бұрын
Sir, please tell me from where do I build this kind of logic during the placement coding interview. It doesn't click directly after seeing the question and we have a time limit to finish the question. How to improve the logic building part??
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Trust me 😀.... One simple RULE ...only practice .... Don't think like that... Ye questions agar interview me aata to first time me mere se nahi hota ... Think like that ....ki bahut saraa question practice karne ke baad ye logic to generate ho hi jata
@unnatigupta6647
@unnatigupta6647 3 жыл бұрын
sir please tell the solution order will be maintain
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Matlab ?
@unnatigupta6647
@unnatigupta6647 3 жыл бұрын
@@HelloWorldbyprince in gfg there was a question to rearrange the array where order should be maintained in question 5 in arrangement section of array
@ProgrammingWithProject
@ProgrammingWithProject 3 жыл бұрын
Bhaut badiya sir
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks a ton yaar
@mohammedwaseem8599
@mohammedwaseem8599 3 жыл бұрын
Thank You So Much!.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
your welcome buddy
@vishalshukla3299
@vishalshukla3299 4 жыл бұрын
Highly conceptual...
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks buddy
@Sasta.Engineer
@Sasta.Engineer 4 жыл бұрын
@@HelloWorldbyprince ghanta mera lele...
@harshalgarg1149
@harshalgarg1149 3 жыл бұрын
Great explanation.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
keep learning buddy and be consistent and share my channel with your college groups that helps me a lot
@harshalgarg1149
@harshalgarg1149 3 жыл бұрын
@@HelloWorldbyprince Sure. :)
@paraskumar693
@paraskumar693 2 жыл бұрын
We can do it in O(N^2) by reversing array starting from ith index to last index
@succeedwithuttam2271
@succeedwithuttam2271 3 жыл бұрын
arr[k]=(arr[j]%maxx)*maxx+arr[k], sir in statement (arr[j]%maxx) we are getting same arr[j] value, then why is this showing error when i am direct putting arr[j] ?
@shubhampatel6325
@shubhampatel6325 4 жыл бұрын
Nice video sir
@chandrashekharpatil6332
@chandrashekharpatil6332 2 жыл бұрын
class Solution: def rearrangeEvenOdd(self, head): #code here if head==None: return head temp=head x=head y=head.next t=head while temp.next!=None: ptemp=temp temp=temp.next ptemp.next=temp.next while x.next!=None: x=x.next x.next=y return t #reply if it is wrong #like if it is correct
@kothapalliavinashkumar8699
@kothapalliavinashkumar8699 2 жыл бұрын
if u teach in english itwill be very grateful
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
sure i will try my best
@division-gaming
@division-gaming 3 жыл бұрын
3:17 roasted me so bad i was trying to swap 😂😂
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
It happens 😂😂
@330_atharvashirgave8
@330_atharvashirgave8 3 жыл бұрын
Explanation was too good but logic samjna ma ek do din laag jayenga😂
@mohdyasir5421
@mohdyasir5421 2 жыл бұрын
👍👍👍❤❤
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
🔥🔥
@UnKnown-id7ih
@UnKnown-id7ih 3 жыл бұрын
home work is done Sir in O(1) Space complexity but I'm unable to digest this Method.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Try
@mcaddit6802
@mcaddit6802 3 жыл бұрын
Awesome bruh!
@rabindrakumar949
@rabindrakumar949 3 жыл бұрын
How the formulation created.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Just by analysing the data
@engineer966
@engineer966 4 жыл бұрын
bhaiya Phd wale professors aapke saamne paani bharenge ..pura concept smjh aaa jata hai ...thanks bhaiya
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
🤣🤣
@suryanshbaranwal8702
@suryanshbaranwal8702 3 ай бұрын
what if we have given random values then
@VaibhavSutar-xm3cn
@VaibhavSutar-xm3cn 7 ай бұрын
2.06 ultimately nahi hua hoga hits hard
@aryamansingha9984
@aryamansingha9984 Жыл бұрын
I got stuck in this part bhaiya like you are sayin Index (n-1) = 6*7 kaise hua
@jasmeenkaur6001
@jasmeenkaur6001 4 жыл бұрын
bhaiya agar app blackboard pe smjate too clearly jhda hotii ppt pe nhi ho rhiiiiiiiiii
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
😊
@yashgoswami9227
@yashgoswami9227 3 жыл бұрын
nicely explaination
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks Yash
@davidsharma9662
@davidsharma9662 11 ай бұрын
Bhai jahan khud ko yaad naa aaye wo part cut kar diya karo! bachche darr jaayenge ki kitna tough questiom hai
@1piecegaming622
@1piecegaming622 4 жыл бұрын
this code is not working for negative integers in array
@mohdyasir5421
@mohdyasir5421 2 жыл бұрын
Gjb sir
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
yeahh thanks bro
@adityatayal3147
@adityatayal3147 3 жыл бұрын
Thanks bro
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Welcome
@nikhilchaurasiya5156
@nikhilchaurasiya5156 3 жыл бұрын
i don't know how this code work for the same problem but please tell me this #User function Template for python3 class Solution: ##Complete this function #Function to rearrange the array elements alternately. def rearrange(self,arr, n): ##Your code here i=0 j=n-1 temp=[] if n==1: return arr elif n%2!=0: while i
@suryapratapsinghrathor7042
@suryapratapsinghrathor7042 3 жыл бұрын
There must be some internal Issue, it is not of O(1) Space
@ahmedanwer1767
@ahmedanwer1767 Жыл бұрын
but for negative values it will not work
@sidharthdhiman4522
@sidharthdhiman4522 2 жыл бұрын
i did not understant why we are doing arr[i]%maxi , why not take only arr[i]
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
bro i guess u must have to do dry of the code
@gamingcircus2637
@gamingcircus2637 2 жыл бұрын
If to understand the logic, i am taking such long, how can i create my own logic?😂 whoever has solved this problem in his first attempt without any hint must be genius.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
its beginning and you are going good
@VaibhavSutar-xm3cn
@VaibhavSutar-xm3cn 7 ай бұрын
aisa lag raha he 5th standard me aa gaya
@jasmeenkaur6001
@jasmeenkaur6001 4 жыл бұрын
baki bhaiya thankuuuuu
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks a lot jasmeen ❤️
@anandparashar4589
@anandparashar4589 Жыл бұрын
bhai apne mai hi krlo video yu daale ho
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
😇
@kaustubhgaikwad2562
@kaustubhgaikwad2562 13 күн бұрын
samaj nahi aya
@Anuj-vf7bg
@Anuj-vf7bg Жыл бұрын
do your revision first then teach no dry run wt was that
@inspiredomkar1239
@inspiredomkar1239 Жыл бұрын
Bhaiya please directly explaination bataya kro , bakiki baate mt bataya kro
@Lolzzzzz77
@Lolzzzzz77 11 ай бұрын
Taaki tm chhap ke count bdha sko
@DeepanshMaurya-w7i
@DeepanshMaurya-w7i Жыл бұрын
ping++
@technical3199
@technical3199 2 жыл бұрын
Bro dont give wrong content
@tricksforsolving2804
@tricksforsolving2804 5 ай бұрын
@amanmahajan1666
@amanmahajan1666 2 жыл бұрын
great explanation
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Glad it was helpful!
@Sonsourav
@Sonsourav 3 жыл бұрын
nice explanation
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Rearrange array alternately
10:37
Techdose
Рет қаралды 75 М.
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 251 М.
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 681 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 557 М.
Longest Consecutive Sequence | Leetcode(Hard) | GooGLe
13:47
take U forward
Рет қаралды 146 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН