as we know we have to calculate the amount of water in jth glass of ith row . so first we check if we find solutions for the the every glass of i 'th row.  so, if we have calculated the result  then we break the loop  and return our answer
if ( curr . row == i ) break ;