Not able to understand the concept using divide & conquer

Hi,

can u give any hint, its same like a two sum problem, which can be solved using map, but how we can solve this problem using divide & conquer.

Hello @smrgrover2 yes right:
sort ur array .
then iterate from start of the array.
for each index i check whether M-a[i] is present in the right side of the index i or not .if it is then this can be ur answer . ( use binary search to look for M-a[i] ).

overall time complexity of this approach will be
n*log(n)

if you want any other help you can ask here:

Thanks, Got the concept…

@smrgrover2 you can mark this as resolved if you feel your query is resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.