leetcode 23

[알고리즘][Python] LeetCode 937 Reorder Data in Log Files 문제 풀이

문제 출처 : leetcode.com/problems/reorder-data-in-log-files/ Reorder Data in Log Files - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 해석 : 로그 파일을 정해진 규칙 대로 재 정렬하는 문제이다. 문제 풀이 : 파이썬 기본 내장 Sort 함수의 정렬 방법을 알면 쉽게 풀 수 있다. 풀이 코드 from typing import List class Solution: def reorderLogFil..

[알고리즘][Python] LeetCode 344 Reverse String 문제 풀이

문제 출처 : leetcode.com/problems/reverse-string/ Reverse String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 해석 : 문자 배열을 뒤집어라 문제 풀이 : 다양한 방법으로 풀 수 있지만 가장 간단하게 built-in 함수를 이용했다. 가능한 다른 풀이 : index를 이용해서 직접 변경해 줄 수 있다. 풀이 코드 class Solution: def reverseString(self, s) -> None: s...

[알고리즘][Python] LeetCode 125 Valid Palindrome 문제 풀이

문제 출처 : leetcode.com/problems/valid-palindrome/ Valid Palindrome - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 해석 : 입력된 문자열이 뒤집어도 같은 문자열인지 판별하는 문제이다. 문제 풀이 : 이 문제에서는 숫자, 알파벳만 고려한다고 하였기 때문에 전처리후에 뒤집어서 같은지 비교하면 된다. 가능한 다른 풀이 : 리스트를 이용한 풀이 풀이 코드 class Solution: def isPalindrome..