string2 [LeetCode 풀이/python] 214. Shortest Palindrome (hard) 문제 설명: 문자열 s 가 주어졌을 때, 해당 문자열 앞에 적절한 문자를 추가함으로써 s 를 회문(palindrome) 으로 변환할 수 있다. 이러한 변환 과정을 수행하여 얻을 수 있는 가장 짧은 회문을 리턴하시오. (You are given a string s. You can convert s to a palindrome by adding characters in front of it. Return the shortest palindrome you can find by performing this transformation.) 예시 1) 입력: s = "aacecaaa" --> 출력: "aaacecaaa" 예시 2) 입력: s = "abcd" --> 출력: "dcbabcd" 제한 조건: 0 str: r.. 2021. 4. 3. [LeetCode 풀이/python] 127. Word Ladder (hard) 문제 설명: 사전 wordList 를 이용하여 단어 beginWord 를 endWord 로 변환하는 시퀀스는 다음과 같은 일련의 단어(단어 시퀀스) 를 가리킨다: 시퀀스의 첫번째 단어는 beginWord 이다 시퀀스의 마지막 단어는 endWord 이다 시퀀스에서 인접한 각 단어 쌍은 서로 오직 한 글자씩만 다르다 시퀀스의 모든 단어는 wordList 에 존재한다 두 단어 beginWord 와 endWord, 그리고 사전 wordList 가 주어졌을 때, beginWord 에서 endWord 로의 가장 짧은 변환 시퀀스의 길이 (단어의 개수) 를 리턴하고, 만약 그러한 시퀀스가 존재하지 않는 경우 0 을 리턴하시오. (A transformation sequence from word beginWord to .. 2021. 3. 12. 이전 1 다음