Count binary string dp

https://ide.codingblocks.com/s/248324(i used memoization, but not passes all test cases)

hi @Rishabhsharm there are multiple test cases, your dp array is not being reset for every case.

https://ide.codingblocks.com/s/248324(still not passing all testcases)

@Rishabhsharm what error are you getting?

wrong answer for test case 1 and 2

@Rishabhsharm use long long datatype, rest logic is correct

https://ide.codingblocks.com/s/248324( after using long long , again same pblm)

@Rishabhsharm the dp array is still int, it cannot support long long values. Change datatype for all the values.

yeah , now changes dp array also .but not pass

@Rishabhsharm this is my code using memoisation, and it passed all the test cases. You can see that logic is same, only datatype is different.

@Rishabhsharm you might not have changed the return type of the function

thanks ,now resolves

1 Like