Inversion count

my code is not passing all testcases showing segmentation fault
question–>
https://practice.geeksforgeeks.org/problems/inversion-of-array-1587115620/1
code–>


help!!!

Hey @sheikhhaji18
You are allocating too much space ,and once u run out of it and still try to allocate u get segmentation error
Here Updated ur code : https://ide.codingblocks.com/s/378436

thx , bro ,one doubt in this question we cannot use the brute force approach of two loop
according to the constraint
1 ≤ N ≤ 10^7
so this gives TLE for brute force because O(N^2) -->10^14/10^8=10^8sec (so i get TLE)
but using mergesort T.C is O(Nlogn)–>0(10^723)=2.310^8/10^8=2.0SEC(so it fine)
So the number of operation per second is -->10^8? is that right?
also how much space can we allocate statically for an array?

Hey @sheikhhaji18
Yes correct u cant do n^2 approach here
n log n is fine

Yes this is correct as well , in very rare cases u might find it different

I guess u meant in static allocation

So that is close to 10^6 inside any function and close to 10^8when declared globally.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.