Skip to content

Commit 95a44e4

Browse files
EASY/src/easy/TwoSumIIIDataStructureDesign.java
1 parent d0b126f commit 95a44e4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package easy;
2+
3+
import java.util.HashSet;
4+
import java.util.Set;
5+
6+
//Your TwoSum object will be instantiated and called as such:
7+
//TwoSum twoSum = new TwoSum();
8+
//twoSum.add(number);
9+
//twoSum.find(value);
10+
public class TwoSumIIIDataStructureDesign {
11+
private Set<Integer> set = new HashSet();
12+
13+
// Add the number to an internal data structure.
14+
public void add(int number) {
15+
set.add(number);
16+
}
17+
18+
// Find if there exists any pair of numbers which sum is equal to the value.
19+
public boolean find(int value) {
20+
return
21+
}
22+
}

0 commit comments

Comments
 (0)