活跃农民
- 积分
- 571
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2012-3-22
- 最后登录
- 1970-1-1
|
8/10/20
340 Longest Substring with At Most K Distinct Characters
Two pointers O(n) time O(k) space (k is the number of unique characters)
(看错题目以为是最多K个只出现一次的character只想出n^2)
375 Guess Number Higher or Lower II
dp[start][end] = max cost to guess between start and end
When start >= end, dp[start][end] = 0
dp[start][end] = min(pivot + max(dp[start[[pivot-1], dp[pivot+1][end]) for all pivots from start to end
1315 Sum of Nodes with Even-Valued Grandparent
一遍bfs, queue里面记录(node, parent_val, grandparend_val) |
|