[LeetCode/Python] 58. Length of Last Word
·
Algorithm/LeetCode
다시 알고리즘 공부를 꾸준히 하기 위한 작심삼일 x 1년! 프로젝트를 시작했다. (작심삼일이라도 꾸준히 하자라는 마음가짐이다) 문제 링크:https://leetcode.com/problems/length-of-last-word/description/?envType=study-plan-v2&envId=top-interview-150 Easy 난이도인 만큼, 특히 python으로서는 아주 풀기 쉬운 문제였다. [내 풀이]class Solution: def lengthOfLastWord(self, s: str) -> int: word_list = s.strip().split() return len(word_list[-1]) 시간 복잡도where n is the length of ..