Programming interview test

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

Programming interview test

Unread post by bannination » Thu Apr 09, 2015 7:46 pm

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.
When I was a small girl, I dreamt of standing in a room, looking at a girl who was and was not myself, who stood looking at another girl who was and was not myself. My mother took this as a nightmare. I saw it as the beginning of a career in physics.

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

Re: Programming interview test

Unread post by JTA » Thu Apr 09, 2015 8:18 pm

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: 4314
Joined: Sun Sep 16, 2012 7:58 am
Location: Hendersonville
Contact:

Re: Programming interview test

Unread post by bannination » Thu Apr 09, 2015 8:21 pm

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.
When I was a small girl, I dreamt of standing in a room, looking at a girl who was and was not myself, who stood looking at another girl who was and was not myself. My mother took this as a nightmare. I saw it as the beginning of a career in physics.

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

Re: Programming interview test

Unread post by JTA » Thu Apr 09, 2015 8:22 pm

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