how they calculate subarrays complecity i.e == (nc2)*n and make time complexity of order n^3
In this video i am not able to understand bruteforce approch
why we are using nc2 pairs for calculating no of pairs why we selecting in pair its not mention in question that we need pair they are asking for the subarray
Hi @pankajsingh
nC2 means (n*(n-1))/2 which is O(n^2) as we take upper bound in big oh notation. So nC2*n becomes O(n^3).
When we are forming sub arrays then we have to choose 2 value corresponding to i and j from 0 to n-1 that is why we are taking nC2 as among 0 to n-1 we have to choose i and j.