![[Rolling Hash] Shortest Palindrome](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FRynJf%2FbtsJJKmC9Az%2FAAAAAAAAAAAAAAAAAAAAADmMa5nHWtuElFEBb724Qyp9GjNSXczRoMlJT-8ik3HK%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DRlv2JNWPAXNYieMy94ToTZKrab0%253D)
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%2Fdna%2Fpr72Z%2FbtsJG4kxcHH%2FAAAAAAAAAAAAAAAAAAAAAL7ZU-Tea6TR49Rbfan0wFXIcifpOyMNeUd0aHwpNLSV%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DKkpS%252FalWAMekKpHtkJfCgogX5Ak%253D)
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%2Fdna%2F7DCFO%2FbtsJw2TFdul%2FAAAAAAAAAAAAAAAAAAAAADn7uVTPEamS30qIira-XaEXCqbZcVEU1ggqPHOC_qid%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DDx9RbD8LSt4S57sgMj9fopZ2eyE%253D)
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%2Fdna%2F8DpD5%2FbtsJux7V2HT%2FAAAAAAAAAAAAAAAAAAAAADwB4l1qQO8DOBJO1uFezuEAYpXxCztJTom-9ycxcIJE%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D%252F7YDrLtiPfFhDVsKBGu6zV5oB5I%253D)
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%2Fdna%2FMYROI%2FbtsJqd9aaZd%2FAAAAAAAAAAAAAAAAAAAAAIciFDZiztfNsXYOhdpOPW_7F42_8ocI2O5sRM4txGdL%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DwKn%252BaTAHHYltPzLgWiKGrzBgIqM%253D)
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%2Fdna%2Fcki5Hy%2FbtsI5U4xGoC%2FAAAAAAAAAAAAAAAAAAAAAHlR0MfsC_BQVBoackZtn19TmtIwBBXi73dlJHJ2pQcf%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DMCyQW234FUlVnJi1xB2%252BG7617Wo%253D)
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%2Fdna%2Fc5yrfI%2FbtsI6dbvT4y%2FAAAAAAAAAAAAAAAAAAAAALrHl0YK5dtXU5baNmANZnV7Q2uh1jJ4SsE89WvsuB_V%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DBSPsKTLtZskU5KLBcVzpLrYj1s8%253D)
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%2Fdna%2FcFqh7x%2FbtsI7IBhEFh%2FAAAAAAAAAAAAAAAAAAAAAOIiX6uWCafeCuQ9tzSIMy77yz3MYEtWYsgwyZQ5WSmn%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DY6CfHoG8i2PzyjhebImObg7oBZY%253D)
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%2Fdna%2FuX6Uk%2FbtsI6ZcyI6s%2FAAAAAAAAAAAAAAAAAAAAAPY6EqUu9R8GF3tXBrSwZhKQpS0OiUOB9fgd6RsiaWCs%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DWz56O1p3xCU0g2f7VY4IYgn8Yd4%253D)
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..
![[DP] Minimum Deletions to Make String Balanced](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FUjv99%2FbtsI6CB83D1%2FAAAAAAAAAAAAAAAAAAAAABDF4A7IVRCNiNnjBxio6xU7hYBOC05pHYafAfFQXFU4%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DUZEQf8U%252BXmV0vuuZDYMnrRsQ7tU%253D)
https://leetcode.com/problems/minimum-deletions-to-make-string-balanced/description/?envType=daily-question&envId=2024-07-30https://github.com/Yellome-in-the-BOK/leetcode/blob/main/240730_Minimum%20Deletions%20to%20Make%20String%20Balanced/explanation.md leetcode/240730_Minimum Deletions to Make String Balanced/explanation.md at main · Yellome-in-the-BOK/leetcodeContribute to Yellome-in-the-BOK/..