Apt Network Private Limited

Interview Questions for Apt Network Private Limited

1. K-th Largest Number in a BST Given a binary search tree (BST) consisting of integers and containing 'N' nodes, your task is to find and return the K-th largest element in this BST. If there is no K-th largest element in the BST, return -1. Example: Input: 1K: 3BST elements (level-order): 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1 Output: 5 Explanation: For the binary search tree created from the input, the in-order traversal gives the sequence [1, 2, 3, 4, 5, 6, 7]. The 3rd largest element is 5. Constraints: 1 <= T <= 100 1 <= N <= 5000 1 <= K <= 5000 0 <= Data <= 10^6 and Data ≠ -1 Time Limit: 1 second Note: You do not have to print anything; only implement the function to return the desired result.

2. Design a Time Series Database

3. How can you create a fair game using a biased die that lands heads with probability p?