Full binary tree
Submissions: 5165   Accuracy:

63.63%

  Difficulty: Easy   Marks: 2

Given a Binary tree, your task is to check whether the Binary tree is a full binary tree or not.

Input:
First line consists of T test case. First line of every test case consists of N, denoting number of Nodes in a binary tree. Second line of every test case consists 3*N elements 2 integers and a character.

Output:
Single line output, return true if it is a full binary tree else false.

Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

2
4
1 2 L 1 3 R 2 4 L 2 5 R
3
1 2 L 1 3 R 2 4 L
Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.