Getting WA but all answers seem correct after comparing to another AC

I used memoization to solve the problem: CodeChef: Practical coding for everyone however I get WA for some reason.

Here’s an AC solution: CodeChef: Practical coding for everyone

The problem constraint says that N would lie between an inclusive range of 1 and 10^5.

I compared the AC solution and my DP solution for each N where 1<=N<=10^5, here’s the jdoddle: Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc. solve1 is my solution. solve2 is the AC O(1) solution. All the answers for each N are equal for both solutions. Not sure what test case fails.

64796703.cpp:14:1: Blunder: int function returning ull {aka ‘unsigned long long int’}
14 | return dp[n];
   | ^

:stuck_out_tongue:

1 Like

Omg, I feel so stupid. I was going crazy. :sob: Thanks. @suman_18733097