Two numbers sum upto a given value using Hashmap

Find if there are two elements in the array sum up to given value. You MUST use the hashmap passed as an argumentto solve the problem. If you don't your test cases will fail. Input: {1, 2, 3, 4, 5} Value: 6 Output : true Input: {1, 2, 3, 4, 5} Value: 2 Output : false Your Answer.java should implement the following interface import java.util.Map; public interface TwoNumbersSumInterface { public boolean TwoNumbersSumWithHashInterface(int[] array, int value, Map<Integer, Integer> hashMap); }

Answer


No comments:

Post a Comment