Tree Connectivity
Chef recently got influenced by the Joker and loves to carve things up with his new collection of knives. One afternoon Chef decides to cut off some vertices from a tree that has N vertices. Chef creates the following plan for cutting the vertices : - He chooses a pair of integers (L, R) such that (1≤L≤R≤N) and cuts off all vertices whose indices do not belong in the interval [L, R]. - He also
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