Bounteous × Accolite Campus Hiring Challenge OA
Summary
I participated in the Bounteous × Accolite Campus Hiring Challenge Online Assessment. The assessment featured a detailed problem named 'Festival of Spirits' that involved navigating a network of sacred sites and applying a specific traversal rule.
Full Experience
I recently took part in the Bounteous × Accolite Campus Hiring Challenge Online Assessment. During the assessment, I encountered a problem titled 'Festival of Spirits', also known as 'Eywa's Festival'. The problem presented a scenario involving N sacred sites and required me to process connections between them, effectively forming a tree-like structure. The main challenge was to correctly parse the intricate input format and then implement a specific 'hallowed traversal' (which seemed like an in-order traversal based on the description: "left first, then the site itself, and finally the right") to find the Mth site. The problem's description was quite immersive, set in the world of Pandora and the Na'vi tribes. It tested my ability to handle custom input formats, graph/tree representation, and specific traversal algorithms to determine the guardian count at the chosen festival site.
Interview Questions (1)
Problem: Festival of Spirits
Eywa's Festival
In the mystical world of Pandora, the Na'vi tribes live in harmony with the life force of Eywa. They have N sacred sites, numbered from 0 to N-1, connected by pathways with the Great Tree at site 0 at the center.
When new sacred sites are discovered, they are added to this network, favoring a connection to the left. If the left is occupied, they connect to the right instead. The Na'vi keep track of the number of guardians at each site in the Book of Souls.
For the upcoming Eywa Festival, the Na'vi need to choose the perfect site for the celebration. They use a special number, M, to determine this site through a specific traversal of the network. This hallowed traversal respects the order of connecting to the left first, then the site itself, and finally the right.
The chosen Mth site, revealed through this hallowed traversal, will host the festival, and its guardian count will ensure a gathering resonant with Eywa's energy and peace.
Input:
- Enter an integer N (the number of sacred sites) followed by a semicolon (;).
- Then, enter N space-separated integers representing the number of Na'vi guardians at each sacred site.
- Then, enter a semicolon (;) and two space-separated integers representing the pathwayCount and connectionCount (which will always be 2).
- Then, enter pathwayCount sets, each separated by a semicolon (;), with each set consisting of connectionCount space-separated integers representing the sacred sites connected by an energy pathway.
- Finally, enter a semicolon (;) and an integer M, which specifies the site number chosen using a specific traversal of the network.
Output:
- Print an integer representing the number of Na'vi guardians at the chosen sacred site.
Constraints:
- siteCount <= 10^4
- 0 < siteGuardians[i] < 10^4
- festivalSite <= siteCount
Example:
Input:
7;10 20 15 25 30 18 22;6 2;0 1;0 2;1 3;1 4;2 6;3
Output:
30
Explanation:
The hierarchy of sacred sites, as represented by the given energy pathways, is shown below:
1 - 2 - 3 - 4 - 5 - 6
A
Following the given traversal rule (connect left first, then the site itself, and finally the right), the generated sequence of sacred sites is:
3, 1, 4, 0, 5, 2, 6
The Mth (3rd) sacred site in the sequence is site 4. The number of Na'vi guardians at sacred site 4 is 30.
Thus, the output is 30.