Programming interview test

Post Reply
User avatar
bannination
Captain
Posts: 5563
Joined: Sun Sep 16, 2012 7:58 am
Location: Hendersonville
Contact:

Programming interview test

Unread post by bannination »

http://www.thousandtyone.com/blog/Easie ... 00To1.aspx


I did it in under two minutes, my solution wasn't the most straight forward though.

Spoiler:
for (int i = 0; i < 100; i++)
{
Console.WriteLine(Math.Abs(i - 100));
}

With a couple more minutes I did it without the abs function.

JTA
Commander
Posts: 3898
Joined: Sat Oct 13, 2012 4:04 pm

Re: Programming interview test

Unread post by JTA »

Wham bam thank you maam:
Spoiler:

Code: Select all

for (var i = 1; i < 101; i++)
{
	console.log(101 - i);
}
Edit - Ahhhh shit nevermind I broke the rules (supposed to start with i = 0). Dammit!
Last edited by JTA on Thu Apr 09, 2015 8:21 pm, edited 1 time in total.
You aren't doing it wrong if no one knows what you are doing.

User avatar
bannination
Captain
Posts: 5563
Joined: Sun Sep 16, 2012 7:58 am
Location: Hendersonville
Contact:

Re: Programming interview test

Unread post by bannination »

JTA wrote:Wham bam thank you maam:
Spoiler:

Code: Select all

for (var i = 1; i < 101; i++)
{
	console.log(101 - i);
}

Hey now, the part of the challenge was you couldn't change the "for (var i =0 " part! ;-)

Other than that, it was exactly like my second solution. Amazing how many different ways to skin that cat.

JTA
Commander
Posts: 3898
Joined: Sat Oct 13, 2012 4:04 pm

Re: Programming interview test

Unread post by JTA »

bannination wrote:
JTA wrote:Wham bam thank you maam:
Spoiler:

Code: Select all

for (var i = 1; i < 101; i++)
{
	console.log(101 - i);
}

Hey now, the part of the challenge was you couldn't change the "for (var i =0 " part! ;-)
Haha i just modified my comment.
You aren't doing it wrong if no one knows what you are doing.

Post Reply