Search
⌘K

Leetcode 1865. Finding Pairs With a Certain Sum

Design a data structure that supports point-add updates to nums2 and count queries that return how many pairs (i,j) satisfy nums1[i] + nums2[j] == tot. The challenge is to answer many updates/queries efficiently (nums1 is relatively small) by maintaining frequency bookkeeping rather than recomputing all pairs.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.