Skip to content

Latest commit

 

History

History
7 lines (7 loc) · 574 Bytes

README.md

File metadata and controls

7 lines (7 loc) · 574 Bytes

sum of all distinct elements

Given two sets of elements, find the sum of all distinct elements from the set. In other words, find the sum of all elements which are present in either of the given set. Example: Set 1 : [3, 1, 7, 9], Set 2: [2, 4, 1, 9, 3] Output: 13 (distinct elements 4, 7, 2 ) Give two Solutions to this problem, using different types of data structures each time. Now, given two sets of integers, write also two algorithms to print the sum of overlapping elements in two sets. The elements in each set are unique or there are no duplicates within a set.