![[Rolling Hash] Shortest Palindrome](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FRynJf%2FbtsJJKmC9Az%2F1Vdp2L2d6KR6gVhwkR0tUk%2Fimg.png)
https://leetcode.com/problems/shortest-palindrome/description/?envType=daily-question&envId=2024-09-20 ✨ 인사이트Hash를 사용해서 두 문자열이 같은지 판단하는 방법도 있을 것이다. (Palindrome임을 판단하기 위해서 원래 문자열과 뒤집어진 문자열이 같은지 확인할 때 Hash)가 사용된다. 그런데 Hash를 그대로 사용하면 시간이 오래 걸리기 때문에 Rolling Hash를 사용할 수 있다. Sliding Window 방식 중 하나다. 새로운 문자열로 넘어갈 때 사라지는 문자 하나를 빼고 추가한 문자열을 더하면 매번 해시값을 통째로 구해야 하는 어려움을 피할 수 있다. ✨ 인사이트 - Rolling Has..
![[KMP] Shortest Palindrome - ㄹㅇ 어려움 주의 🥲](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fpr72Z%2FbtsJG4kxcHH%2F0775ePw0s3A56rV5fKC6T1%2Fimg.png)
https://leetcode.com/problems/shortest-palindrome/description/?envType=daily-question&envId=2024-09-20 ✨ 인사이트Brute-force를 사용해서 (왼쪽부터 시작하는) 가장 긴 palindrome을 찾을 수 있다. 하지만 그것은 Time Complexity가 O(n^2)이다. 이보다 빠른 방법이 있다. 바로 KMP 알고리즘을 사용하는 것이다! ✨ 인사이트 - KMP 알고리즘KMP 알고리즘은 특정 패턴이 주어진 텍스트 안에서 어디에 위치하는지 빠르게 찾는 방법이다.이는 두 단계로 나뉜다. 1️⃣ LPS 배열 만들기2️⃣ 이 배열을 활용해서 텍스트에서 패턴 찾기 LPS는 Longest Prefix which is a..
![[Matrix] Spiral Matrix IV](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7DCFO%2FbtsJw2TFdul%2Frhjgl9xA8yQ6uF1Tq0mGWK%2Fimg.png)
https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240909_Spiral%20Matrix%20IV/explanation.md leetcode/240909_Spiral Matrix IV/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.github.com ✨ 인사이트방향 전환이 나오면 자고로 `directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]` 그냥 써두고 시작하면 된다. 괜히 최적화 해보겠다고 시계방향으로 도는 싸이클 ..
![[Hash Table, Linked List] Delete Nodes From Linked List Present in Array](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F8DpD5%2FbtsJux7V2HT%2FI2ZDVQN9bXnOg1k3fRom2k%2Fimg.png)
https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240906_Delete%20Nodes%20From%20Linked%20List%20Present%20in%20Array/explanation.md leetcode/240906_Delete Nodes From Linked List Present in Array/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.github.com ✨ 인사이트해당 node의 `val`이 `nums`에 포함되어 있는지 확인할 때,..
![[Array] Find the Student that Will Replace the Chalk](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMYROI%2FbtsJqd9aaZd%2Ffn0MZW8wAcxtb8QtWOo2F1%2Fimg.png)
https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240902_Find%20the%20Student%20that%20Will%20Replace%20the%20Chalk/explanation.md leetcode/240902_Find the Student that Will Replace the Chalk/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.github.com ✨ 인사이트처음에는 Binary Search를 생각했으나,, 그렇게 찾은 인덱스를 상대..
![[Binary Search, Two Pointers] Find K-th Smallest Pair Distance](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcki5Hy%2FbtsI5U4xGoC%2FzENKEmUkO6LYgVa9fWzBv1%2Fimg.png)
https://leetcode.com/problems/find-k-th-smallest-pair-distance/description/?envType=daily-question&envId=2024-08-14https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240814_Find%20K-th%20Smallest%20Pair%20Distance/explanation.md leetcode/240814_Find K-th Smallest Pair Distance/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creat..
![[Backtracking] Combination Sum II](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc5yrfI%2FbtsI6dbvT4y%2FyVZbvoss6oaEPWQqI2D3cK%2Fimg.png)
https://leetcode.com/problems/combination-sum-ii/description/?envType=daily-question&envId=2024-08-13https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240813_Combination%20Sum%20II/explanation.md leetcode/240813_Combination Sum II/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.github.com ✨ 인사이트모든..
![[BFS, DFS] Regions Cut By Slashes](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcFqh7x%2FbtsI7IBhEFh%2FwFLgNX8fQzRV8HCoMnd60k%2Fimg.png)
https://leetcode.com/problems/regions-cut-by-slashes/description/?envType=daily-question&envId=2024-08-10https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240810_Regions%20Cut%20By%20Slashes/explanation.md leetcode/240810_Regions Cut By Slashes/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.github...
![[DP] Filling Bookcase Shelves](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuX6Uk%2FbtsI6ZcyI6s%2FPq7Tm9ZANvHNklskMHgKh1%2Fimg.png)
https://leetcode.com/problems/filling-bookcase-shelves/description/?envType=daily-question&envId=2024-07-31https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240731_Filling%20Bookcase%20Shelves/explanation.md leetcode/240731_Filling Bookcase Shelves/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/leetcode development by creating an account on GitHub.git..