codility
pipi666661
学习中。。。
展开
-
[codility]equi
Find an index in an array such that its prefix sum equals its suffix sum. A[0] + A[1] + ... + A[P−1] = A[P+1] + ... + A[N−2] + A[N−1]. A[0] = -7 A[1] = 1 A[2] = 5 A[3] = 2 A[4] =原创 2013-12-13 15:54:26 · 1096 阅读 · 0 评论 -
[codility]CountMultiplicativePairs
Count the number of pairs (A, B) such that A * B > A + B. More formally, A[I] and B[I] represent C[I] = A[I] + B[I] / 1,000,000. For example, consider the following arrays A and B:原创 2013-12-13 16:10:42 · 3893 阅读 · 0 评论 -
[codility]MinAbsSumOfTwo
Find the minimal absolute value of a sum of two elements. A[0] = -8 A[1] = 4 A[2] = 5 A[3] =-10 A[4] = 3 the function should return |(−8) + 5| = 3. Assume that原创 2013-12-13 16:06:27 · 1559 阅读 · 0 评论