- 博客(3)
- 资源 (1)
- 收藏
- 关注
原创 Codility Lesson 5 Brackets 解答
Thinking:This lesson is about two kinds of data structures -- queue and stack. After reading the question carefully, you can tell stack is a good choice. As it's a EASY-level question, there is neit
2015-01-15 15:18:18 1325
原创 Codility Lesson 4 NumberOfDiscIntersections 解答
Thinking:1. Look every circle as a range, that will help us think in a simpler way. So the first step is translate circles into ranges(from "center&radius" to range):A[0]=1 >> [-1,1]A[1]=5
2015-01-13 07:46:05 1921
原创 Codility Lesson 3 MinAvgTwoSlice解答
*大多数朋友如果找到这篇文章,就是来看解答的,所以完整的题目放到文章的最后了。思路:1、首先根据题目,大家第一反应就是无脑嵌套遍历所有情况,这样的时间复杂度是O(n^2+n)/2,远远超出O(n)的题目里的要求。2、其次就是找规律了,这个slice一定发生在最小值周围吗?不一定!比如[-1, -1, 12, -9, 10]。所以不用去思考先找到最小值,再向两边递归的思路了。
2015-01-10 10:15:28 2060
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人