Ice Cream Parlor

  • + 1 comment

    Input the values in an array a[] Make a temporary array with it temp[] O(n) Do all the operations in temp[] after which you would know which 2 elements form the sum. O(n*logn) After that just search for those element's index in the a[] array in O(n) time.

    Final Complexity= O(n*logn)