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.

# P-sequences

# P-sequences

#### Sort by

recency

#### |

#### 14 Discussions

#### |

Please Login in order to post a comment

Here is my solution in java, javascript, python, C, C++, Csharp HackerRank P-sequences Problem Solution

This problem is definitely easier than a fair number of the medium-rated DP problems. At least in this case it's obvious how to relate the desired solution to the solution to a smaller version of the problem. Sure, you need to figure out how to condense some of the sub-problems together so you can handle large P without running out of time or memory, but that's a much more straightforward problem.

Here is P-sequences problem solution- https://programs.programmingoneonone.com/2021/07/hackerrank-p-sequences-problem-solution.htmlThe algorithm is correct

Still it will not work for very large number TestCases: 10,11,13,16,17 and 18. They exceed computational capacity of 53bit integers. Then, a special multiplication procedure will be needed in order to get the correct modulus without errors induced by those really really really really big numbers,,,,,

In JavaScript,

something is not working here.