[Python/LeetCode] 49. Group Anagrams
https://leetcode.com/problems/group-anagrams/ 입력 : 소문자 영어 단어들로 이루어진 문자열 배열(리스트) `strs`출력 : `strs` 내의 groups of anagram으로 이루어진 2차원 리스트Input: strs = ["eat","tea","tan","ate","nat","bat"]Output: [["bat"],["nat","tan"],["ate","eat","tea"]]Input: strs = [""]Output: [[""]]Input: strs = ["a"]Output: [["a"]]직관 및 접근당장 드는 생각은,일단 strs를 순회를 돌거임 for문으로. 대신 첫 단어는 미리 어떤 리스트에 할당시켜둠.그리고 그 다음 단어부터, 이게 이미 존재하는 리스트..
[Python/LeetCode] 344. Reverse String
https://leetcode.com/problems/reverse-string/description/문자열을 뒤집는 함수를 작성하시오.입력값은 문자 배열이며, 리턴 없이 리스트 내부를 직접 조작하라.입출력 예시 : Input: s = ["h","e","l","l","o"]Output: ["o","l","l","e","h"] 처음 시도class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ s = s[::-1]그러나, 채점기에 전달된 s는 수정되지 않음.GPT) 이 코드는 s를 뒤집은 새로운..