일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 |
30 | 31 |
Tags
- Python Implementation
- Convert Sorted List to Binary Search Tree
- shiba
- attribute
- 밴픽
- Class
- 715. Range Module
- 컴퓨터의 구조
- concurrency
- Substring with Concatenation of All Words
- 운영체제
- 30. Substring with Concatenation of All Words
- data science
- Python Code
- Decorator
- 109. Convert Sorted List to Binary Search Tree
- Generator
- 43. Multiply Strings
- 프로그래머스
- 315. Count of Smaller Numbers After Self
- Protocol
- iterator
- Regular Expression
- Python
- t1
- 시바견
- DWG
- kaggle
- LeetCode
- 파이썬
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