Function to return the index
Pair * getSubArray ( int * arr , int n , int K ) { int currSum = 0 ; int prevDif = 0 ; int currDif = 0 ; Pair * result = new Pair ( -1 , -1 , abs ( K - abs ( currSum ) ) ) ; Pair * resultTmp = result ; int i = 0 ; int j = 0 ; while ( i <= j && j < n ) {