We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Counting Perfect Subsequences
Counting Perfect Subsequences
Sort by
recency
|
32 Discussions
|
Please Login in order to post a comment
Spent an hour trying to figure out what was wrong with my modDivide function... Noticed I was using ab += abc in main loop. Changed to a = (a + abc) % mod. Passed all test cases. ;_;
We can learn many things from this Editorial!!
Can someone please tell me in layman terms, why do we do power of (MOD-2) for calculating inverse function for n?
My algorithm works with case 1 and simple cases found here in the discussion, where we can check by hand, but it fails with the test cases. For case 2, the solutions are: 67529287 67529287 441870358 916664717 834126565
mine are: 239514543 239514543 865533985 125267162 652571787 Besides reading the editorial, is there another way to check?
Example, these are some results for my algorithm:
The editorial for this one is awesome!