ServiceNow interview question

Ds mostly focused on heaps and sub array problems