Check if sum of two numbers in an array is divisible by k
Answers
Answered by
0
Explanation:
Print all pairs with given sum. A simple solution is be traverse each element and check if there's another number in the array which can be added to it to give sum. Method 2 (Use hashing). We create an empty hash table. Note that the worst case of time complexity of this solution is O(c + n) where c is count of pairs
Similar questions