CrewScale interview question

Medium level DSA with array