Possible O(nlogn) solution

  • 0

    Sort the input array, which would take time O(nlogn)
    Then for each pair of elements (i, i+1), find the element -(i+i+1) in the remaining array using binary search.
    2 pass solution, but O(nlogn)?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.