homework for algorithm analysis

nlogn for find the number ans that ans[i]+ans[j]==x