Please watch our new video on the same topic: kzbin.info/www/bejne/d6TIhqCti7OUpbs
@namannema3349 Жыл бұрын
this link take u to the same video we are watching
@yogeshkaushik83169 ай бұрын
@@namannema3349 thats what recursion means
@user-ic7xs9vh7i4 ай бұрын
@@yogeshkaushik8316 😆
@anuplohar23 Жыл бұрын
Best count inversion video on KZbin, your method of teaching is very best that it gets me understand very easily 🌟🌟🌟
@satvrii Жыл бұрын
Nowadaya strivers voice has become so calm and soft 😅❤
@anuradha3868 Жыл бұрын
True...as compared to his previous vdos 😂
@newsbuster2194 Жыл бұрын
😂
@shubhamkumar-hx1fb Жыл бұрын
@@anuradha3868 same thought 😂
@saswatrath46468 ай бұрын
abe mic kharap tha pehle😂
@THEReFleXАй бұрын
ladki ka chakar
@attackgaming99404 ай бұрын
Making the complex problem looks simpler is a kind of skill that striver only has🛐
@Manishgupta200 Жыл бұрын
I'm trying this problem and solved it by myself by taking count as global variable.. But you taught us in a vary optimal way without taking count as a global variable. Really best optimal approach. Thankyou ❤
@bishakhdutta8427 Жыл бұрын
whats the complexity of your solution? can you share it?
@Manishgupta200 Жыл бұрын
@@bishakhdutta8427 same as merger sort merge algorithm
@bmishra985 ай бұрын
Completed the playlist. This was the best recursion playlist I ever went through. Thanks a lot Striver.
@_AASHISHSHAH Жыл бұрын
this is the best playlist in world. thank you stiver for your effort.
@SuvradipDasPhotographyOfficial Жыл бұрын
The best count inversion video on KZbin.. Thanks a lot Raj.. stay blessed❤
@gajendrakumar82718 ай бұрын
Finally completed this recursion playlist and Thanks a lot striver for great explanation throughout and patiently drawing recursion tree. patience is the key to solve and teach anything . And you have it man and you are teaching that too. Thanks a lot again
Striver your voice is very soothing and calm bro ❤.... I use it to sleep at night AND study... and I don't feel sleepy
@mranonymous1982Ай бұрын
Bro what
@MehtabReviews Жыл бұрын
I usually don't comment but wanted to say that just subbed your channel. This is the best explanation I've ever got. THANKS A LOT:>)
@vaibhav565 ай бұрын
I was struggling with the solution but as soon as you mentioned merge sort it clicked in my mind
@cinime Жыл бұрын
Understood! Super amazing explanation as always, thank you very very very much for your effort!!
@shiveshgupta1705 Жыл бұрын
i just imagine if all the problems would be available on this channel in future
@PriyaGanti-m7c3 ай бұрын
I understood the solution clearly... Thank you very much, sir.
@selvaarumugam370 Жыл бұрын
As usual your teaching jus made coding much easier than it is bruh!! Waiting for Binary Search series bruh!!!!
@aradhyaagrawal47663 ай бұрын
00:06 Count the number of pairs in an array where the left element is greater than the right element. 02:12 Brute Force solution 04:10 Counting the number of pairs in two sorted arrays where the left element is from the left array and the right element is from the right array, and the right element is smaller than the left element. 06:11 Inversion count can be found by counting the number of elements greater than the element on its right in a sorted array 08:28 The number of pairs formed in an array can be determined using the merge sort algorithm. 10:41 Counting inversions in an array by merging sorted subarrays. 13:03 Count the inversions in an array using a merge sort algorithm 15:17 Merge sort algorithm helps in counting inversions in an array 17:25 Count the number of inversions in an array 19:15 Count the number of inversions in an array 21:08 The solution uses a recursive function to merge and count inversions in an array. 22:51 The time complexity of counting inversions is O(n log n) and it requires extra space to merge arrays.
@InduAnuga7 ай бұрын
Understood THE BEST EXPLANATION Excellent playlist 👌 👏 ❤
@prateek52085 ай бұрын
such an awesome expalination bhaiya just approach dekhkr hi dimag ma intution agya ki merge ma kase implement krenge , you are best
@aditijagtap78535 ай бұрын
Best teaching approach so far!!!!
@bgmihighlights6378Ай бұрын
Omg Striver you are great , someday will love to reach at your level!
@prateekgoyal7009 Жыл бұрын
This is the best explanation I've ever got.
@xtzyrox2764 Жыл бұрын
I am happy with the brute force now I will see optimal 1 week before interview bcz University exams are in this month
@b39_navkaransingh73 Жыл бұрын
Did anyone ask you?
@SaumyaSharma007 Жыл бұрын
OMG Bawal explanation Striver Bhaiya.😃
@sourabhsoni506514 күн бұрын
Just cleared the intution so well.
@pallavi22222 Жыл бұрын
your problem solving approach explanation is superb
@pranavdharkar2 сағат бұрын
I feel so happy when i saw that the merge function returns the cnt and then add it to the ans i had exactly done the same
@the_haryannvi_coder7 ай бұрын
If u don't wanna use cnt in mergeSort function, you can do this:- int mergeSort(vector &arr, int low, int high) { if (low >= high) return 0; int mid = (low + high) / 2 ; int left = mergeSort(arr, low, mid); // left half int right = mergeSort(arr, mid + 1, high); // right half int m = merge(arr, low, mid, high); // merging sorted halves return left + right + m; }
@lakshaysawhney99885 ай бұрын
Thoroughly enjoyed the problem!!
@chiragbirla5606 Жыл бұрын
Best explanation ever for this problem
@shashwatpandey32852 ай бұрын
took me 1 day to solve this problem on my own , no outside help or anything , when i first saw the problem it was like hmm , we want total number of elements less than arr[i] on its right side , so it was basically like the array was being spilt, at first i coded the bruteforce which was very easy ofcoursse , and then i had to brainstorm for hours , in the question it was said the inversion count tells us how far or close the array is from being sorted , thats when merge sort came into my mind , because as i said earlier we want number of elements less than arr[i] on the right side of i , merge sort was the only soritng algo i studied in which arrays were being split and i thought while merging 2 sorted arrays we can count the number of elements smaller than arr[i[, from the right side of the splitted array
@vikasbagri1225 Жыл бұрын
Understood it very well Thanks for this amazing series
@akritisneh2849 Жыл бұрын
So much crystal clear!!!!Thank youu❤
@8bit_hero8509 ай бұрын
Can we realistically solve this if it comes in an interview given we haven't solved it before? I mean how do can you get the intuition of merge sort from this problem? I really don't get it.
@unknown478965 ай бұрын
no way bro
@flakky6264 ай бұрын
Exactly my thought, No way you gonnna come up with something like that on your own
@NoniSabharwal8 ай бұрын
The way he said wow! Uff in love with the voice
@iamnoob759324 күн бұрын
Brilliant video. Thank you striver
@abhishekverma469310 ай бұрын
thank you so much for watching
@the_avii_723 күн бұрын
Please take care, in this problem inside 1st while loop if-condition should be { lesser than equal to ---> if ( arr[left]
@vishakhakhanna81152 ай бұрын
Understood! Great explaination.
@abhaypatel3796 ай бұрын
thanks striver for making a complex question into very easy question 🤗
@GnaniDarshan12 күн бұрын
Nice intution! Thanks
@elamaran3503 ай бұрын
Understood ❤ At last
@AbjSir Жыл бұрын
// Everytime while sorting you move an element to the left (assume nobody moves to right agar chote walo ko aana hoga to left me aa jayenge) // if an element crosses another element while moving to the left for the purpose of sorting then it should increase the count of inversion
@creepitup6 күн бұрын
@mohd786ishaan Жыл бұрын
UNDERSTOOD SIR ! GREAT EXPLAINATION
@HR-pz7ts8 ай бұрын
Amazing I solved two questions using the same logic.
@theresilientpianist711411 ай бұрын
Really it was a great series Striver.🔥🔥
@rushidesai283624 күн бұрын
Crazy good solution.
@harigs723 ай бұрын
Happy teacher day 🎉❤
@kaichang81863 ай бұрын
Thanks for the great video, well understood
@shaikhanuman80124 ай бұрын
good explanation on count inversion
@ishangujarathi10 Жыл бұрын
loved the optimal solution, intuition op!
@pushankarmakar178311 ай бұрын
understood! def merge(arr,l,mid,h): temp=[] i=l j=mid+1 cnt=0 while i
@gauristar40945 ай бұрын
Superb logic, Understood!!!
@muqeemuddin805710 ай бұрын
Hey, can you make a video on binary insertion sort and compare it's time complexities with insertion sort. Thanks for your videos on DSA.
@KapilMaan-vw9sd3 ай бұрын
thanks sir for making this wonderful video sir !!!
@shivanshagrawal4179Ай бұрын
understood the solution striver thankyou
@harim79458 күн бұрын
Striver is my man crush now lol after Tom cruise....jk You are great man....your videos help me a lot!
@JatinKumar-pl4sq3 ай бұрын
Bro u have destroyed all so called tech schools
@ishasinghal3457 Жыл бұрын
Best explanation ever
@pavanjegurupati9 ай бұрын
Great explanation!!
@ganeshjaggineni4097Ай бұрын
NICE SUPER EXCELLENT MOTIVATED
@prabhakaran55423 ай бұрын
Understood ❤
@ajaykr2811 Жыл бұрын
13:05 the kind of excitement I want while learning DSA.
@unnatishukla8513 Жыл бұрын
awesome as always!!!!🤩
@MJBZG6 ай бұрын
didn't understand much but will try again
@yashisrivastava6196 Жыл бұрын
just wow explanation
@sivasaimanchem4399 Жыл бұрын
All i can say is Thankyou so much ❤🙌
@sukhpreetsingh5200 Жыл бұрын
Understood amazing explanation
@309_dussasainath83 ай бұрын
arr=[2,4,1,3,5] count=0 res=[] for i in range(len(arr)-1,-1,-1): res.append(arr[i]) res.sort() j=0 while jres[j]: count+=1 j+=1 print(count) try this
@vk-mc5tq9 ай бұрын
Global vs Local In Global variables values updated dynamically but in local variables we need to pass updated values (manually) to subsequent functions
@steverogers70509 ай бұрын
very nice explanation bhaiya
@Sumeet_100 Жыл бұрын
Thank you for this video !!
@SukanyaGhosh-c4t11 ай бұрын
Thank You Bhaiya
@cursed_nerd Жыл бұрын
Badhiya kaam kar rahe ho, see you soon
@GuruPrasadShukla Жыл бұрын
understood the approach sir thanks alot
@calmcrussaderАй бұрын
can we pass our counter integer by reference in the functions ?
@creepopsub293611 күн бұрын
Understood! but how to get this approach in interview pressure. Such a Unique Solution ngl.
@saitehith6647 Жыл бұрын
Superb Explanation
@anshasati19206 ай бұрын
Understood Sir🥳
@TathagatTiwari-t6b Жыл бұрын
These types of questions always demotivate me... like how you can think of such kind of solution in an interview
@sarangkumarsingh79019 ай бұрын
Nice lecture................
@hashcodez7579 ай бұрын
understood Bhaiya!!
@NazeerBashaShaik9 ай бұрын
Understood, thank you.
@atharva3571 Жыл бұрын
I understood the problem
@grm64210 ай бұрын
Thank you😊
@YourCodeVerse Жыл бұрын
Understood✅🔥🔥
@gautamsaxena46472 ай бұрын
understood bhaiya
@ShubhamKumar-uf3gc6 ай бұрын
loved that bhaiya
@navdeepkumar9160 Жыл бұрын
Great video
@satyamgupta4808 Жыл бұрын
very nice video
@ravalikatalks528511 ай бұрын
thanks alot bhaiya
@mridulathya120111 ай бұрын
Should'nt the line at 19:30 be "cnt += (mid - left + 1) - i "
@venup2813 Жыл бұрын
Understood brother❤️
@GhostVaibhav10 ай бұрын
Understood🔥
@parasarora5869Ай бұрын
Epic 🔥
@her_soulmate Жыл бұрын
Understood 🎉
@anshulrai60582 ай бұрын
understood👍
@TheNullDeveloper6 ай бұрын
understood the solution . But how do i get the intution that it will solve in this way i.e using this approach 😕 in most of the cases i don't have idea about the optimal one how would I approach it
@infomania_by_ayush79016 ай бұрын
Understood, but I am gonna need some time to implement this.