Given a BST with duplicates, how do you find out the most frequent value?
50
/ \
40 58
/ \ / \
40 40 58 62Most frequent element is 40.
Approaches:
There was a bug in the second approach which I didn't catch during the interview and realized it after the interview. Will it be held against me? The interviewer didn't point out that there was a bug in the code.
[Update] - Cleared the screening. Going for onsites.