Count the number of pairs in LinkedList (where each node has a integer) whose sum equals given sum (all elements are unique). Use hashmap to solve this problem; do not perform delete operation on hashmap Input: 0->2->5->7->4->6->10->20->-10- >NULL Sum: 10 Output : 3 [(0, 10), (4, 6), (20, -10)] 

// here is the definition of SintNode public class SintNode { public int num; public SintNode nextNode; public SintNode(int num){ this.num = num; } }

Similar questions and discussions