This question evaluates a candidate's ability to design and analyze efficient array algorithms and use appropriate data structures and techniques such as hash maps or sorting with two-pointer strategies, with attention to time and space complexity.
Given an integer array nums and an integer T, in one operation you may remove two elements whose sum equals T. Return the maximum number of operations you can perform. Provide an algorithm with O(n) expected time using a hash map or O(n log n) time using sorting and two pointers, prove correctness, and discuss edge cases (duplicates, negatives, large values).