Hello there!

Welcome to today’s coding interview test challenge. This is a series of blog posts where your coding skills are put to the test with real coding challenges asked by real companies. Take our challenges and see if you have what it takes to crack the coding interview of the top tech companies in the world.

Difficulty: Easy

Write a program in any programming language or pseudo-code, that will accept a random array of integers X and a randomĀ  integer Y as input. Your program should return true if any 2 numbers in X add up to Y, and false if none add up to Y.

eg. if X = [3, 7, 11, 12, 9, 2] & Y = 20, return true (because 11 + 9 = 20). if X = [11, 5, 7] & Y = 3, return false (because no 2 numbers in the array add up to 3).

Can you solve this problem? Brownie points if you can solve it in a single pass.

Post your answer in the comments.