Computer, Games

Computer, Games: Hacked app solutions Levels 1-3 (Copied)

Level one: The Hackpad

Stage One:

input + 1;

Stage Two:

input> 0;

Stage Three:

if input < 0 {
return -input;
}
return input;

Stage Four:

abs(input);


Level two: High School Hack

Stage One:

while var_a < input {
var_b = var_b + input;
var_a++;
}
return var_b;

Stage Two:

pow(input, 2);

Stage Three:

foreach var_a in input {
var_b++;
}
return var_b;

Stage Four:

var_a = [];
while var_b < input {
var_a.push(var_b);
var_b++;
}
return var_a;


Hacked App – level three: Jailbreak

Stage One:

foreach var_a in input {
if var_a > var_b {
var_b = var_a;
}
}
return var_b;

OR

while var_a < input.length { if input[var_a] > var_b {
var_b = input[var_a];
}
var_a++;
}
return var_b;

Stage two:

foreach var_a in input {
var_b = max(var_b, var_a);
}
return var_b;

OR

while var_a < input.length {
var_b = max(var_b, input[var_a]);
var_a++;
}
return var_b;

Stage three:

while input > 1 {
input = input – 2;
}
return input;

OR

if input / 2 * 2 == input {
return 0;
}
return 1;

Stage four:

foreach var_a in input {
if var_a != input.pop {
return false;
}
}
return true;

OR

while var_a < input.length {
if input[var_a] != input[input.length – 1 – var_a] {
return false;
}
var_a++;
}
return true;


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s