CFEdu9D Longest Subsequence
Solution Sketch
If a number $b$ can be divided by a number $a$, then this number $a$ can be contained in $b$’s LCM subsequence.
Recall how we build up prime table using Sieve of Eratosthenes
, we mark all multiples of a certain number $x$ if $x$ is a prime. We can use the same technique for this problem!
AC Code
|
|