please tell how is the complexity nC2*n in brute force?
Divisible subarray problem-pigeon hole principle
because-:
NC2=n*(n-1)/2;
so there is no need to calculate all combinations just use NC2.
NC2 is just a constant , do sol is O(N).
…
we are using NC2 , we are not running any loop till NC2.