I was doing this spoj problem and written tabulation method which got accepted, then I wrote recursive solution but this gave me the wrong solution(WA), Where is my recursive solution is wrong:-

my tabulation solution which got AC.

I want to ask:-

1). What is wrong with my recursive solution.

2). Can we do all dp problem with tabulation and memoization i.e if we can do with memoization than can we do with tabulation and vice versa for every dp problem?