HashedIn by Deloitte Interview Question

Sub array problems