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
This is the a correct version which already examined by myself.
public static int Ackermann(int m, int n){ Stack s = new Stack; s.add(m); while(!s.isEmpty()){ m=s.pop(); if(m==0) { n+=m+1; } else if(n==0) { n += 1; s.add(--m); } else{ s.add(--m); s.add(++m); n--; } } return n; }