class Solution { public int solution(int[] A) { // write your code in Java SE 8 if(A.length number[j + 1]) { temp =...
分类:
其他好文 时间:
2015-06-07 14:32:15
阅读次数:
126
question:https://codility.com/programmers/lessons/9
To solve this question , I get each element's divsors which appearing in input Array A using Sieve of Eratosthenes method. Time complexity is O...
分类:
其他好文 时间:
2015-06-03 23:32:45
阅读次数:
156
question: https://codility.com/programmers/lessons/4
we need two parts to prove our solution.
on one hand,
there is no false triangular. Given the array has been sorted, if A[i]+A[i+1]>A[i+2]...
分类:
其他好文 时间:
2015-06-02 23:32:26
阅读次数:
361
Solution of Codilitycodility.com is another great place to improve your programming skill. Train myself , and record here.Lesson 1: Time Complexity
Lesson 2: Counting Elements
Lesson 3: Prefix Sums...
分类:
其他好文 时间:
2015-06-02 23:30:49
阅读次数:
247
question:https://codility.com/programmers/lessons/4
trap: int overflow
code:
#include
int solution(vector &A) {
// write your code in C++11
int size = A.size();
if (size <2)
...
分类:
其他好文 时间:
2015-06-02 23:27:23
阅读次数:
347
今天在https://codility.com/上面测试了几道题,我发现用C++比用C 方便多了。因为如果用C++,我们可以使用STL 的结构及算法,但是使用C的话就要自己实现了。毕业之后 就没有专门做过算法题了,今天使用起来有些生硬,费事不少。现在将一些常用结构整理一下,作为自己的知识库储存在大脑...
分类:
其他好文 时间:
2015-06-01 06:08:53
阅读次数:
155
A zero-indexed array A consisting of N integers is given. A triplet (P, Q, R) istriangularif it is possible to build a triangle with sides of lengths ...
分类:
其他好文 时间:
2015-04-28 20:52:42
阅读次数:
210
Aprimeis a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13.A prime D is cal...
分类:
其他好文 时间:
2015-04-28 20:28:10
阅读次数:
263
A non-empty zero-indexed array A consisting of N integers is given.A triplet (X, Y, Z), such that 0 ≤ X 3 4 // you can write to stdout for debugging.....
分类:
其他好文 时间:
2015-04-24 15:35:59
阅读次数:
193
1.题目(HARD)A non-empty zero-indexed array A of N integers is given. A pair of integers (P, Q), such that 0 ≤ P ≤ Q < N, is called asliceof array A. The...
分类:
其他好文 时间:
2015-01-22 01:38:03
阅读次数:
1345