💡 오늘의 학습 키워드
- 완전탐색
✅ 오늘 공부한 내용
- TreeNode
- 완전 탐색
- 오늘은 LeetCode 문제였다! 745번 Prefix and Suffix Search
👀 오늘의 회고
🤣 오늘의 문제점
- 오늘은 사실 문제를 제대로 읽고 풀지는 못했다..ㅠ
🔥 어떤 시도를 했는가?
- GPT를 써서 한국어로 설명해 달라했는데 무슨소린지 못알아 들어서 꼭 다시 봐야할 문제이다..
class WordFilter {
TrieNode trie;
public WordFilter(String[] words) {
trie = new TrieNode();
for (int weight = 0; weight < words.length; ++weight) {
String word = words[weight] + "{";
for (int i = 0; i < word.length(); ++i) {
TrieNode cur = trie;
cur.weight = weight;
for (int j = i; j < 2 * word.length() - 1; ++j) {
int k = word.charAt(j % word.length()) - 'a';
if (cur.children[k] == null) {
cur.children[k] = new TrieNode();
}
cur = cur.children[k];
cur.weight = weight;
}
}
}
}
public int f(String prefix, String suffix) {
TrieNode cur = trie;
for (char letter: (suffix + '{' + prefix).toCharArray()) {
if (cur.children[letter - 'a'] == null) {
return -1;
}
cur = cur.children[letter - 'a'];
}
return cur.weight;
}
}
class TrieNode {
TrieNode[] children;
int weight;
public TrieNode() {
children = new TrieNode[27];
weight = 0;
}
}
👏 무엇을 새로 알았는가?
- TreeNode
- 완전 탐색
👩💻 내일은 무엇을 학습할 것인가?
- 아침에 급하게 원티드 못한 기능 2개 꼭 수정하기
- 항해 99문제 풀기
바쁘다 바빠 현대사회.. 내일 다시 힘내고 한 3일 뒤쯤부터 제대로 글을 쓸 수 있을 것 같다 😭 힘내보자...
그래도 코드 8시간 동안 짜느라 밥도 못먹고 불태운 것 같다..
3일 뒤에는 이 글도 수정해놓을 예정이다 ㅠ
'개인 공부 > TIL' 카테고리의 다른 글
[ TIL - PGS ] 99클럽 코테 스터디 17일차 TIL + 오늘의 학습 가이드 (0) | 2024.08.07 |
---|---|
[ TIL - PGS ] 99클럽 코테 스터디 16일차 TIL + 오늘의 학습 가이드 (0) | 2024.08.06 |
[ TIL - PGS ] 99클럽 코테 스터디 14일차 TIL + 오늘의 학습 가이드 (0) | 2024.08.04 |
[ TIL - PGS ] 99클럽 코테 스터디 13일차 TIL + 오늘의 학습 가이드 (0) | 2024.08.03 |
[ TIL - PGS ] 99클럽 코테 스터디 12일차 TIL + 오늘의 학습 가이드 (0) | 2024.08.02 |