Pergunta de entrevista da empresa Tanium

Two-sum: given an array and an integer N, find all the non-repeating pairs that sum to N.

Resposta da entrevista

Sigiloso

16 de fev. de 2022

Optimal solution is to add each value in the array to a hashset as you iterate, subtract that value from N to get value m, and count a pair if m exists in the set.