alexalghisi
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
I believe he wanted to test the speed of solving some certain tasks that doesn't really need code, it can be simply solved using awk from linux :)
- alexalghisi March 24, 2015Comment hidden because of low score. Click to expand.
0
of 0 vote
int solve(int n){
int minimumSquares[100];
for(int i=0;i<=n;++i)
minimumSquares[i] = i; /// i = 1^2 + .... + 1^2
for(int i=1;i<=n;++i)
for(int j=1;j*j<=i;++j)
if( minimumSquares[i] > 1 + minimumSquares[i - j*j])
minimumSquares[i] = 1 + minimumSquares[i - j*j];
return minimumSquares[n];
}
- alexalghisi March 23, 2015Comment hidden because of low score. Click to expand.
0
of 0 vote
void solve(int n){
int a = 0,b = 1,c;
for(int i=1;i<=n;++i){
c = (a + b)%10;
cout<<b<<" "<<c<<"\n";
a = b;
b = c;
}
}
- alexalghisi March 23, 2015Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
What about 4 ? 4 also comes up two times in the initial array.
Here you have a shorter and prettier code:
}
- alexalghisi March 26, 2015