← All problemsSign in

Longest Prime Subsequence

Given an array of size N ( N) ( all elements are less than or equal to 300 and greater than 1) you need to find the length of the longest subsequence which follows the following property : Let x[1]... x[n] be a subsequence , let p[1],p[2]..p[m] be prime numbers which divide atleast one of the numbers in x[1],..x[n] . Now for each p from 1 to m lets do the following let productX ( a variable ) =1

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start