# Challenge: Find Ancestors of a Given Node in a BST

Try to solve the Find Ancestors of a Given Node in a BST problem.

## We'll cover the following

## Statement

Given the `root`

node of a binary search tree (BST) and an integer value `k`

, find all the ancestors of the node whose value is `k`

.

An

ancestorof a node in a tree is any node on the path from the root to that node.

**Constraints:**

Let `n`

be the number of nodes in a binary search tree.

- $1 \leq n \leq 500$
- $10^{-3 }\leq$
`Node.data`

$\leq 10^3$ - The value
`k`

exists within the binary search tree - All
`Node.data`

are unique

## Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.