HashedIn by Deloitte Interview Question

Question from string and b tree