Function to sum of arr [ x ] + arr [ x + y ] + arr [ x + 2 * y ] + ... for all possible values of X and Y , where Y is less than or equal to Math . Sqrt ( N ) .
static void precomputeExpressionForAllVal ( int [ ] arr , int N , int [ , ] dp ) {