File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1- import java .util .*;
1+ import java .util .HashSet ;
2+ import java .util .Set ;
3+
24class SolutionGotprgmer {
35 // 해당 문제는 어느 한 숫자가 2개이상 존재할 경우 true를 그렇지 않을 경우, false를 반환하는 문제이다.
46 // set을 사용해서 set에 이미 값이 존재한다면 개수가 2 이상이므로 true 그렇지 않으면 false를 출력한다.
@@ -14,20 +16,15 @@ class SolutionGotprgmer {
1416 public boolean containsDuplicate (int [] nums ) {
1517 distinctNums = new HashSet <>();
1618 boolean ans = false ;
17- for (int checkNum : nums ){
18- if (distinctNums .contains (checkNum )){
19+ for (int checkNum : nums ) {
20+ if (distinctNums .contains (checkNum )) {
1921 ans = true ;
2022 break ;
2123 };
2224 distinctNums .add (checkNum );
2325 }
2426 return ans ;
2527 }
26- public static void main (String [] args ){
27- Solution s = new Solution ();
28- System .out .println (s );
29-
30- }
3128
3229
33- }
30+ }
You can’t perform that action at this time.
0 commit comments