Company: Msci_30july
Difficulty: medium
Find Parent in Tree Problem Description A sequence of processes is represented as a tree structure. Each process is numbered sequentially starting from 1. Process number n spawns n new child processes. For example: Process 1 spawns 1 child process. Process 2 spawns 2 child processes. Process 3 spawns 3 child processes. Given a specific process number, determine the process number of its parent. Complete the findParent function in the editor with the following parameter(s): int processNumber : the process number to query Returns: int : the process number of the parent Examples Example 1: Input: processNumber = 6 Output: 3 Explanation: Refer to the graph in the problem statement. The child of 1 is 2. Children of 2 are 3 and 4. The children of 3 are 5, 6, and 7. Therefore, the process number of the parent process of the given process is 3. Constraints 2 <= processNumber <= 10^9