Given an array of numbers and number k, check whether any two numbers add up to k in Java

Given a list of numbers and a number k, return whether any two numbers from the list add up to k.


For example, given [2, 10, 5, 8] and k of 12, return true since 10 + 2 is 12.
Here is the solution in java we have made 3 methods for 3 ways to solve it.



Previous
Next Post »

Pages