OMG 😱 never thought this would be that easy. Can't stop u appreciating for solving Gfg questions 👏. Keep posting, Thanks dude
@hariharibolll3459 Жыл бұрын
Dhanyawad MataJi. 🌸🙌🙏
@ashfaqmurshed503 Жыл бұрын
class Solution{ public: long long int count=0; long long int inversionCount(long long arr[], long long N) { mergesort(arr,0,N-1); return count; } long long int* mergesort(long long arr[],long long low, long long high) { if(low==high) { long long int* ans=new long long int[1]; ans[0]=arr[low]; return ans; } long long mid=(low+high)/2; long long int* left=mergesort(arr,low,mid); long long int* right=mergesort(arr,mid+1,high); return merge(left,right,mid-low+1,high-mid); } long long int* merge(long long int* left,long long int* right,int n, int m) { int i=0; int j=0; long long int* ans=new long long int[n+m+1]; int k=0; while(i
@gedelasivakrishna6 ай бұрын
Superb explination ! I always understand your explination in one go ,, thankyou
@DipsOfficial802 Жыл бұрын
Thank you for the great explanation, you gain a new subscriber.
@mlLearning490 Жыл бұрын
Thanku you so much Alisha ...Amazing explanation!!!😎
@darshankalathiya86672 жыл бұрын
kitne dino se pata nai chal raha tha aaj cancept clear huaa thank you so much mem.
@nitinrai50532 жыл бұрын
Such a nice explanation 🔥
@ghanshyampatil5850 Жыл бұрын
Great Explaination!!!
@sunnyseconds Жыл бұрын
In python .....it is giving correct answer when count+=n-i+1.....in 52th line.........can you please tell me why
@rahul4142 Жыл бұрын
Best Explanation.
@GhostRider.... Жыл бұрын
Thank you Mam ,nicely explained
@rasputin35712 жыл бұрын
Great Explaination
@gypsygirlkigypsylife Жыл бұрын
how count+=n-i;,how did u come up with this ??
@basavarajhadimani44932 жыл бұрын
While passing mid to mergearrays function why did you pass it as (mid-low+1) why not simply (mid+1) and also for the high too... Could you please explain that part?
@nageshwarmali9631 Жыл бұрын
return merge(left,right,mid-low+1,high-mid); long long int* merge(long long int* left,long long int* right,int n, int m),lets see, actually n and m size of left and right array
@mayankmehra4370 Жыл бұрын
because its a length of a array
@bluegreen- Жыл бұрын
Hi Alisha, such an amazing explanation!! Btw there is another similar problem in leetcode called the reverse Pairs, I applied the same logic but i'm not able to get the output! class Solution { int count=0; public int reversePairs(int[] nums) { int N=nums.length; int a[]=mergesort(nums,0,N-1); return count; } public int[] mergesort(int arr[],int low,int high) { if(low==high) { int[] ans=new int[1]; ans[0]=arr[low]; return ans; } int mid=(low+high)/2; int[] left=mergesort(arr,low,mid); int[] right=mergesort(arr,mid+1,high); return merge(left,right,mid-low+1,high-mid); } public int[] merge(int[] left,int[] right,int n, int m) { int i=0; int j=0; int[] ans=new int[n+m+1]; int k=0; while(i
@sanachaitanyamotupalli490611 ай бұрын
if(left[i]>(2*right[j])) remove this
@amarshinde58632 жыл бұрын
nice
@yatri63292 жыл бұрын
Is this Q over Leetcode??
@probabilitycodingisfunis12 жыл бұрын
It is on hackerrank interview preparation kit , and geeksforgeeks, not sure about leetcode
@himanshusingh8693 Жыл бұрын
775. Global and Local Inversions(leetcode)
@harshkumaryadav3676 Жыл бұрын
😍🥰
@anshvashisht8519 Жыл бұрын
the thing you and i have same is number of tabs in chrome😂