NVIDIA Interview Question

Given an array and a value, how can you determine if there are two elements in the array sum up to the value?

Interview Answer

Anonymous

Dec 20, 2021

At first, nested loop - too easy Then asked to upgrade the solution - use of dictionary would solve the problem - everytime we scan an element we store in dictionary the element and its complement value to the given sum