Increment result by 1 , if current digit is divisible by 2 and sum of digits is divisible by 3. And recur for next index with new modulo .
int ans = ( ( x + m ) % 3 == 0 && x % 2 == 0 ) + f ( i + 1 , ( m + x ) % 3 , s , memoize ) ; return memoize [ i ] [ m ] = ans ; }