Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 124: Maps: Fundamentals
Implement `hasPairWithSum(nums, target)` returning whether two distinct elements add up to `target`, using a set for O(n) lookups.
+ 1 hidden test run on Submit.
A running set lets you check each complement in O(1), giving O(n) time overall.
Run your code to see results.