Post order traversal of the tree. Track the number of elements seen, starting with the largest and exit when the second largest element is found.
Anonymous
23 Jan 2021
In these sorts of interviews you really need to drill down and understand what the interviewer is looking for.
A good way to simulate a real interview experience is to do a mock with one of the Splunk Software Engineering experts on Prepfully, rated super strongly on TrustPilot...
prepfully.com/practice-interviews