摘要:
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... 阅读全文
posted @ 2015-12-25 05:59
neverlandly
阅读(787)
评论(0)
推荐(0)
摘要:
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Hint: Expected runtime complexity 阅读全文
posted @ 2015-12-25 03:10
neverlandly
阅读(431)
评论(0)
推荐(0)
摘要:
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]表示有多少文章 阅读全文
posted @ 2015-12-25 01:16
neverlandly
阅读(342)
评论(0)
推荐(0)