We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Simple. Iterate through the array once, and add each number to a dictionary. Then, iterate through a second time, and, for each number, see if that number + k exists in the library. If it does, then you know you have a pair, and can increment anwser
Pairs
You are viewing a single comment's thread. Return to all comments →
Simple. Iterate through the array once, and add each number to a dictionary. Then, iterate through a second time, and, for each number, see if that number + k exists in the library. If it does, then you know you have a pair, and can increment anwser