HackerRank P-sequences Problem Solution
In this post, we will solve HackerRank P-sequences Problem Solution. We call a sequence of N natural numbers (a1, a2, …, aN) a P-sequence, if the product of any two adjacent numbers in it is not greater than P. In other words, if a sequence (a1, a2, …, aN) is a P-sequence, then ai * ai+1 ≤ P ∀ 1 ≤ i < N You are given N and P. Your task is…