일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 밴픽
- concurrency
- data science
- 715. Range Module
- kaggle
- 30. Substring with Concatenation of All Words
- Generator
- Python Implementation
- Substring with Concatenation of All Words
- Protocol
- 109. Convert Sorted List to Binary Search Tree
- Python
- 운영체제
- 파이썬
- 43. Multiply Strings
- Class
- attribute
- 315. Count of Smaller Numbers After Self
- 컴퓨터의 구조
- 시바견
- DWG
- iterator
- Python Code
- Decorator
- LeetCode
- Regular Expression
- t1
- 프로그래머스
- shiba
- Convert Sorted List to Binary Search Tree
Archives
- Today
- Total
목록1048. Longest String Chain (1)
Scribbling
LeetCode: 1048. Longest String Chain
class Solution: def longestStrChain(self, words: List[str]) -> int: ret = 1 # First, we sort words by its length # By this way, we only need to check the previous length (or current length - 1) # That is, if the length(word) is k, # We only need to check words that have length of k - 1. words.sort(key=lambda word: len(word)) # dp[word]: max chain length until the word dp = {} for word in words: ..
Computer Science/Coding Test
2022. 2. 27. 15:39