I have function
public static int func(int M,int N){ if(M == 0 || N == 0) return M+N+1; return func(M-1, func(M, N-1)); }
How to re
All the answers posted previously don't properly implement Ackermann.
def acker_mstack(m, n) stack = [m] until stack.empty? m = stack.pop if m.zero? n += 1 elsif n.zero? stack << m - 1 n = 1 else stack << m - 1 << m n -= 1 end end n end