Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
983 B
2
Indexable
Never
Sherlock received a strange case that had an interesting twist. The murderer had placed the victim's body on the top of a tree. The tree was a special one with its roots at the top and leaves at the bottom. As any crime is not perfect, this murderer had left a series of clues in the leaves and the nodes of the tree. The clues were a series of numbers present at the leaves and nodes starting from the bottommost leaves and moving up one by one and Sherlock has to find them and crack them in order to solve the crime. You have to help Sherlock crack the puzzle. You are given the set of numbers, but in two of the allowing different ways:

1. Such that the root is between its children 2 Such that the root is before its children

Input Specification:

input1: The number array representing the values in the 1st way

input2: The number array representing the values in the 2nd way input3: Size of the array

Note in the case where the body is not on the tree the tree can be empty