Unable to pass one test case in Divisible Pattern

Sir I tried with 2D vector as DP table(getting runtime error here) as well as map data structure(getting TLE here). Rest of the cases are passing

Hey @pangatt4
Check this code: https://ide.codingblocks.com/s/331263
Feel free to ask if u don’t understand :slight_smile:
Constraints are tight on last case

1 Like

Hello, I tried to understand the solution, the logic looks same. However I tried replacing a section of my code with kmp algorithm from yours, still doesn’t work on both of those 2D vector and map ways. Please help to resolve error.

Please share ur code in Coding Blocks Ide.

Code link:

Hey @pangatt4
I did 4 changes in ur code and mentioned them in comments :https://ide.codingblocks.com/s/331328

1 Like

Okay, so it was the modulo operator which was causing the problem. Submitted.

1 Like