Ali.Nour86
BAN USER
Comments (4)
Reputation -5
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
-1
of 1 vote
int mostCommonDin(int[] years) {
int allyears = new int[10000+2005+1];
for (int i=0; i<years.length; i+=2) {
for (int j=years[i]; j<=years[i+1]; j++) {
allyears[j+10000]++;
}
}
int max = 0;
for (i=0; i<years.length; i++) {
if (years[i]>max)
max= years[i];
}
return max;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
char* flip(char* bytes, int width, int height) {
for (int i=0; i<height; i++) {
for (int j=0; j<width/2; j++) {
tmp = bytes[width*i+j];
bytes[width*i+j] = bytes[width*i + width - 1 - j];
bytes[width*i + width - 1 - j] = tmp;
}
}
return bytes;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
Note that the input is one dimensional array.
- Ali.Nour86 January 26, 2013Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
what would be the used k?
- Ali.Nour86 February 03, 2013