check if it is a power of 2 , then only move diagonally
if ( ( num & ( num - 1 ) ) == 0 ) : NEW_LINE INDENT dp [ m ] [ n ] = a [ m ] [ n ] + maxCost ( a , m - 1 , n - 1 , dp ) ; NEW_LINE return dp [ m ] [ n ] ; NEW_LINE DEDENT