Skip to content
C

Search in BST

Easyjavapythonccppjavascript

Given a Binary Search Tree and a target value, determine whether the value is present.

The BST is given in level order: M tokens, each an integer or null; the first token is the root.

Input Format

The first line contains an integer M. The second line contains M space-separated tokens (integers or null). The third line contains the integer target.

Output Format

Print 1 if target is present, otherwise print 0.

Input (stdin)

Output

Run your code to see output here...