Find Sum in Set of Numbers


Create a method called find_sum that accepts an array of numbers and a sum. The method will search the array of numbers if the sum is present in the array.

For example

arr = [1, 2, 3, 4, 4]
sum = 8

def find_sum arr, sum

The method will search the array and find if two numbers in the array are equal to the sum, if so it will return true, if not, it will return false. To make this problem more challenging, do so without sorting the array and without using two each loops.

def find_sum(num_set, sum) end
< >