본문 바로가기
반응형

Study86

[LeetCode] #819. Most Common Word (python) 문제 https://leetcode.com/problems/most-common-word/ Most Common Word - 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 주어진 문단에서 금지된 단어들을 제외하고 가장 자주 나온 단어를 소문자로 반환하는 문제다. 예시 입출력값 Input: paragraph = "Bob hit a ball, the hit BALL flew far after it was hit.", banned = ["hit"] Output: "b.. 2022. 2. 17.
[LeetCode] #937. Reorder Data in Log Files (python) 문제 https://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 주어진 로그는 문자로된 로그와 숫자로 된 로그로 이루어져 있다. 모든 로그의 첫 번째 단어는 식별자고 각 단어들 사이에는 공백이 있다. 문자 로그는 모두 소문자다. 주어진 예시 입력값을 보면 아래와 같다. Input: logs = ["dig1 8 1 5 1",".. 2022. 2. 17.
[LeetCode] #344. Reverse String (python) 문제 https://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 주어진 문자열을 뒤집어야 하는데 리턴 없이 리스트 내부를 조작해야 하고 시간복잡도가 O(1)이어야 한다. 풀이 #책풀이 1. 파이썬 내장함수 reverse() 사용 처음에는 인덱싱을 쓰면 되는건줄 알았는데 계속 안되길래 모르겠어서 책을 보니까 s.reverse()를 사용하면 되는 간단한 문제였다. 책.. 2022. 2. 17.
[LeetCode] #125. valid palindrome (python) 문제 https://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(self, .. 2022. 2. 17.
반응형