why are we choosing nC2 pairs in brute force approach and second approach
Divisible Subarrays , pigeonhole mathematics
In both approach we are considering all pairs of indices i and j which forms an subarray . That’s why from n indices we choose any two incides to form a subarray , because in brute force approach we are basically try to evaluate sum of every possible subarray.