Count Valid Paths in a Tree
Walk outward from every node while counting primes on the path; a pair counts when exactly one node on it is prime.
Walk outward from every node while counting primes on the path; a pair counts when exactly one node on it is prime.