K Path Query
You're given a tree with $N$ vertices numbered from $1$ to $N$. Your goal is to handle $Q$ queries. For each query you are given $K$ nodes $v_1, v_2, \ldots, v_K$. Find if there exists a simple path in the tree covering all the given vertices. ### Input - The first line contains a single integer $T$ - the number of test cases. The description of $T$ test cases follows. - The first line of each te
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.
Sign in to chat with the tutor and save your progress.
Sign in to start