Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions contains-duplicate/river20s.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.HashSet;

class Solution {
public boolean containsDuplicate(int[] nums) {
HashSet<Integer> set = new HashSet<>();

for (int num : nums) {
if (!set.add(num)) {
return true;
}
}

return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@river20s 보통 이런 부분은 리뷰로 남기진 않는데, indent 정리가 필요해보입니다! 🧹

}
}
15 changes: 15 additions & 0 deletions valid-palindrome/river20s.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public boolean isPalindrome(String s) {

// 문자열 s의 대문자를 소문자로 치환한다.
String lowerCase = s.toLowerCase();
// 소문자 a-z, 숫자 0-9에 해당하지 않는 문자를 지운다.
String alphanumeric = lowerCase.replaceAll("[^a-z0-9]", "");
// 뒤집은 문자열을 만든다.
String reverse = new StringBuilder(alphanumeric).reverse().toString();
// 두 문자열을 비교한다.
boolean isEqual = alphanumeric.equals(reverse);

return isEqual;
}
}
Loading