Endava Interview Question

Implementing data structures to solve a question