HashedIn by Deloitte Interview Question

coding the given data structure