Loading...
2024. 5. 18. 00:36

문자열 hashing function 빠르게 계산하는 방법

1. 왜 문자열의 hashing이 필요한가? https://deepdata.tistory.com/960 문자열 해싱(hashing) 기본 개념 배우기String Hashing - Algorithms for Competitive Programming (cp-algorithms.com) String Hashing - Algorithms for Competitive Programming String Hashing Hashing algorithms are helpful in solving a lot of problems. We want to solve the problem of comparing stringdeepdata.tistory.com  두 문자열 S1, S2가 서로 같은지 다른지 비교하고 싶을 때가 있..

2023. 8. 19. 02:46

DFS도 재귀보다는 반복문으로 구현 연습하기1

1. 문제 1987번: 알파벳 (acmicpc.net) 1987번: 알파벳 세로 R칸, 가로 C칸으로 된 표 모양의 보드가 있다. 보드의 각 칸에는 대문자 알파벳이 하나씩 적혀 있고, 좌측 상단 칸 (1행 1열) 에는 말이 놓여 있다. 말은 상하좌우로 인접한 네 칸 중의 한 칸으 www.acmicpc.net 2. 풀이1 기본적인 DFS문제긴한디 분명히 맞는데 시간초과에 애먹었다.. from sys import stdin def dfs(x,y,s): global answer for i in range(4): dx = x + d[i][0] dy = y + d[i][1] if dx >= 0 and dx = 0 and dy = 0 and dx = 0 and dy = 0 and dx = 0 and dy = 0 a..

2023. 3. 18. 21:29

SQL 코딩테스트 복기 - 알파벳으로 시작하는 데이터 추출하는 방법(정규표현식)

알파벳 ABCDEFGHIJKLMNOPQRSTUVWXYZ 중 하나나 abcdefghijklmnopqrstuvwxyz중 하나로 시작하는 데이터를 찾으라하면 어떻게 해야할까 WHERE (column) like "A%"; 이러면 (column)이 A나 a로 시작하는 모든 행을 조회해준다. 그러면 WHERE (column) like "A%" or (column) like "B%" or (column) like "C%" or (column) like "D%" or (column) like "E%" or (column) like "F%" or (column) like "G%" or(column) like "H%" or (column) like "I%" or (column) like "J%" or(column) lik..