This is no doubt a good question, but for this particular test case the solutions give different answer. Precisely because the Editorial solution missed handling one test case where the duplicate sub-tree has only the right child.

The sample test case, I came up with is:

15 5 6 6 -1 6 -1 6 -1 -1 -1 -1 -1 -1 -1 -1

The answer should be 1, it is the expected output and the editorial fastest and lightweight gives the correct answer as 1 (Yayy!!). Unfortunately the First Editorial solution gives the answer as 0.

Kindly fix this.