摘要: 提交: class Solution: def findLeastNumOfUniqueInts(self, arr: List[int], k: int) -> int: count = collections.Counter(arr) order_dic = sorted(count.items 阅读全文
posted @ 2020-06-19 22:37 oldby 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 方法:倍增法dp ACM经典 class TreeAncestor: def __init__(self, n: int, parent: List[int]): self.cols = 20 # log(50000) < 20 self.dp = [[-1] * self.cols for _ i 阅读全文
posted @ 2020-06-19 22:36 oldby 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 方法:迭代+栈 O(N) class Solution { public TreeNode recoverFromPreorder(String S) { Deque<TreeNode> path = new LinkedList<>(); int pos = 0; while(pos < S.le 阅读全文
posted @ 2020-06-19 00:07 oldby 阅读(127) 评论(0) 推荐(0) 编辑