摘要:
There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f... 阅读全文
摘要:
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Hint: Expected runtime complexity 阅读全文
摘要:
Hint: Sort first then scan: O(NlogN) time, O(1)space use another array: O(N) time, O(N) space(有点像counting sort) 我们额外使用一个大小为N+1的数组stats。stats[i]表示有多少文章 阅读全文