On the Optimal Approximation of Discrete Functions with Low-dimensional Tables