New update is available. Click here to update.

Last Updated: 3 Dec, 2020

Difficulty: Easy

```
Ceil of an integer is the closest integer greater than or equal to a given number.
For example:
arr[] = {1, 2, 5, 7, 8, 9}, key = 3.
The closest integer greater than 3 in the given array is 5. So, its ceil value in the given array is 5.
```

```
The first line of input contains a single integer T, representing the number of test cases.
The first line of each test case contains elements in the level order form. The line consists of values of nodes separated by a single space. In case a node is null, we take -1 in its place.
The second line of each test case contains integer X, denoting the key value.
```

```
The first and only line of each test case in the output contains ceil of integer X from given BST.
```

```
You are not required to print the expected output; it has already been taken care of. Just implement the function.
```

```
for the above tree
X=2
ceil =3
X=7
ceil =8
X=12
ceil =13
```

```
1 <= T <= 10
1 <= N <= 10^5
0 <= node data <= 10^9
1 <= X <= 10^9
Time limit: 1 second
```

SIMILAR PROBLEMS

Guess Price

Posted: 13 Dec, 2021

Difficulty: Easy

Unique BSTs

Posted: 15 Dec, 2021

Difficulty: Hard

Unique BSTs

Posted: 15 Dec, 2021

Difficulty: Hard

Kth Largest Element in BST

Posted: 12 Mar, 2022

Difficulty: Moderate

Two Sum IV - Input is a BST

Posted: 22 Mar, 2022

Difficulty: Moderate

Icarus and BSTCOUNT

Posted: 1 Apr, 2022

Difficulty: Hard

Popular Interview Problems: