I solved this problem using sorting. Is there any better approach so as to optimise it in terms of time complexity ?
Dividing Array problem
@vaishnavtannu no your one is good enough , sorting must be done
dont forget to hit like and mark resolved if cleared 