Each node of a tree carries a letter. Find the longest path on which no two adjacent nodes have the same letter.
Each node of a tree carries a letter. Find the longest path on which no two adjacent nodes have the same letter.
Unlock the full question, the code runner with test cases, and reference solution
One-time unlock. Yours forever.
Or get a for every question, unlimited code runs and AI mock interviews.
Opens with the full question.