Traverse it!
CodeChefOpen on judge ↗
*The story in this one is omitted due to lack of time. Just solve the problem. :P* You have been given a tree of $N$ vertices, where each vertex $i$ has a number $a_i$ associated with it. Lets call a path cool if the labels of the vertices along the path is non-decreasing. Your task is to find the longest cool path and also the number of such paths. The length of a path is defined to be the num
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