Given an array **‘pre[]**’ that represents Preorder traversal of a binary tree where every node has either 0 or 2 children. One more array **‘preLN[]’** is given which has only two possible values **‘L’ **and **‘N’**. The value ‘L’ in ‘preLN[]’ indicates that the corresponding node in Binary Tree is a **leaf node** and value **‘N’** indicates that the corresponding node is **non-leaf node**.

Your task is to complete the function **constructTree()**, that constructs the tree from the given two arrays and return the root pointer to new binary tree formed.

For Example:

```
Input: pre[] = {10, 30, 20, 5, 15}, preLN[] = {'N', 'N', 'L', 'L', 'L'}
Output: Root of following tree
10
/ \
30 15
/ \
20 5
```

**Input:**

The function takes three arguments as input, first an integer **N**, denoting the size of both the array, second an array **"****pre[]" ** that represents Preorder traversal of the binary tree and the last argument an character array **"preLN[]"** which indicates that the corresponding node in Binary Tree is a leaf node or a normal node.

There will be **T**, test cases and for each test case the function will be called separately.

**Output:**

For each test case return the reference pointer to the root node of the new binary tree formed.

**Constraints:**

1<=T<=100

1<=N<=100

**Example:
Input:**

3

5

10 30 20 5 15

N N L L L

4

1 2 4 3

N N L L

6

1 2 4 6 5 3

N N N L L L

20 30 5 10 15

4 2 3 1

6 4 5 2 3 1

**Note:**The **Input/Ouput** format and **Example** given are used for system's internal purpose, and should be used by a user for **Expected Output** only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

Author: harshitsidhwa

Anshul Wadhawan | 280 |

NoobNoob | 203 |

aild78 | 190 |

Shivam_Kumar_Singh | 183 |

stevecooper | 183 |

rambo | 868 |

Anshul Wadhawan | 740 |

Calahan | 677 |

fullmetal27 | 675 |

ks75 | 657 |

akhayrutdinov | 4698 |

Ibrahim Nash | 3664 |

sanjay05 | 3633 |

Quandray | 3491 |

surbhi_7 | 2748 |