Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit95a44e4

Browse files
EASY/src/easy/TwoSumIIIDataStructureDesign.java
1 parentd0b126f commit95a44e4

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+
packageeasy;
2+
3+
importjava.util.HashSet;
4+
importjava.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+
publicclassTwoSumIIIDataStructureDesign {
11+
privateSet<Integer>set =newHashSet();
12+
13+
// Add the number to an internal data structure.
14+
publicvoidadd(intnumber) {
15+
set.add(number);
16+
}
17+
18+
// Find if there exists any pair of numbers which sum is equal to the value.
19+
publicbooleanfind(intvalue) {
20+
return
21+
}
22+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp