Comment On Trouble With Founders, the Lost Candidate, and More

Trouble with Founders (from Ben C.) A few of my friends (all CS people) were attending a startup mixer hosted at a little airport near our university. At one point, we all got kind of bored of talking with everyone, so we stepped outside to look at the planes. Soon enough, some business people in suits noticed the nerds talking outside so slowly started approaching. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7Next »

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:05 • by Lockwood
That frist one?
All I'm thinking is about how the dreamer will chase the coder around the moons of Nibia...
What? There was a nebula involved during that, and that's the cloud.....

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:08 • by Remy Porter
I'm not taking the Star Trek job unless I get a free trip to TechEd on Risa.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:09 • by coder guy (unregistered)
It seems to me that anyone who can't even come up with a lame attempt at successive approximation to figure out a square root without running to a reference isn't fit for a programming job.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:10 • by vwiggins (unregistered)
The second one has made me really sad. I get lost all the time, especially if I'm nervous. If someone judged my ability as a developer based on my inability to learn left from right or find my way around a place I've never been before I'd be horrified.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:14 • by Rhywden
390053 in reply to 390051
coder guy:
It seems to me that anyone who can't even come up with a lame attempt at successive approximation to figure out a square root without running to a reference isn't fit for a programming job.

Then again, if you don't have access to the internet, don't have anyone to ask and there's no other source of information around...

... then it's most likely the time of the Zombie Apocalypse, in which case I'd ask myself as to why in the seven frozen hells I'd need to calculate the square root of two.

Some smart guy once said: “I don't need to know everything, I just need to know where to find it, when I need it”

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:15 • by snoofle
390054 in reply to 390051
coder guy:
It seems to me that anyone who can't even come up with a lame attempt at successive approximation to figure out a square root without running to a reference isn't fit for a programming job.
Why? The guy wanted an exact value, not an approximation.

If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:17 • by Rodnas (unregistered)
M: So, there is no one around. The people that aren't around have not invented the book yet or the internet, but trough some magic occurence there is a computer... I guess would get completely naked run around town, get drunk and destroy random objects. I would certainly not go solve some stupid programming problem

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:19 • by Dim (unregistered)
square root.

Asking someone to solve a problem using the most creative,original or complicated solution is clearly the best way to hire programmers who will create the worst thing possible to solve everyday problems.

Leaving the interview is clearly the best approach to that kind of question, your clearly don't want to work with people who answer "correctly"

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:20 • by Niels (unregistered)
An iterative approximation for a square root shouldn't be hard to come up with.

private static double EPSILON = 0.00001;

public static double sqrt(double x)
{
if (x <= EPSILON) return 0; // should error
double lower = 0, upper = x;
while (upper - lower > EPSILON)
{
double guess = (upper - lower) / 2;
if (guess * guess > x)
lower = guess;
else
upper = guess;
}
return lower;
}

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:20 • by myke (unregistered)
the real wtf is to consider Carmack's formula for solving sqrt.

Re: What's the Square Root of Stupid?

2012-09-18 08:21 • by Michael (unregistered)
I have been in one of those "Square Root of Stupid" before. I once interviewed with a bank, when the interviewer asked:
He: So, imagine our data center in London goes down, what are you going to do?
Me: We hopefully automatically fall over to NYC.
He: What if NYC also goes down?
Me: We hopefully automatically fall over to Tokyo.
He: What if Tokyo also goes down?
Me: I will go to the nearest supermarket, grab all the cans of food and drinks I can get and drive up North as fast as I can.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:30 • by asdbsd (unregistered)
That last one was awful. Although you don't get to write square root formulas often, in real life not all answers are readily available. Being a programmer means that sometimes there's no site, no person, no book with the answer, and you have to patch something up by yourself. It is this ability which the interviewer obviously wanted to test. Walking away at this point is just stupid.

I know no formula for square root calculation, but I'd suggest some variation of binary search for instance. Take (a+b)/2, check it's square, if it's bigger than x then a:=(a+b)/2 else b:=(a+b)/2, repeat until you have the required precision.
This probably sucks in terms of speed, but hey, at least it works.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:32 • by Matt (unregistered)
>> I: What if there were no bookstore?

I'd ask you as you obviously seem to know all the answers...

captcha : secundum (but not fristum...)

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:33 • by asdbsd (unregistered)
390063 in reply to 390054
snoofle:
Why? The guy wanted an exact value, not an approximation.

If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.


Just to remind you, there's no such thing as "exact" with floating point numbers. So they didn't ask him to give "exact" value. They asked to do his best at approximation.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:36 • by TheRider
390065 in reply to 390057
Niels:
An iterative approximation for a square root shouldn't be hard to come up with.

private static double EPSILON = 0.00001;

public static double sqrt(double x)
{
if (x <= EPSILON) return 0; // should error
double lower = 0, upper = x;
while (upper - lower > EPSILON)
{
double guess = (upper - lower) / 2;
if (guess * guess > x)
lower = guess;
else
upper = guess;
}
return lower;
}
What if you can't use the multiplication operator to square a number?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:38 • by Andrew (unregistered)
What if there were no square root function?
This tells me that I am not working in a language I know, as all of them require sqrt implementations in their libraries. I wouldn't look for an approximation; I'd look for another job.

It's funny how it's always Carmack's approximation, when in fact it was done by someone else at SGI. I wonder if that guy did it in 640k of RAM?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:41 • by Studley (unregistered)
390068 in reply to 390065
What if there were no numbers?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:47 • by Anonymous Coward (unregistered)
390070 in reply to 390054
1. How do you know he wanted an exact value? You left without offering a non-exact solution.

2. Successive approximation WILL give you an exact value. You just repeat it until it converges. You know when it has converged because either square(x)==y or square(x)<y && square(Math.nextAfter(x))>y .

3. The problem is that the interviewer didn't portray it very well as a brainteaser and/or mathematical aptitude type question. If he'd started out by asking, "How would you calculate a floating-point square root without using the library function? (or the whole math library, depending on how easy you want to make the problem)", hopefully you wouldn't have given silly answers like, "ask someone".

Calculating a square root isn't something where you either know it or you don't. If you ask someone the arguments to an API function, they have to either know it, say they don't know, or walk out or whatever. For a square root, there are a large number of solutions of varying degrees of quality. Obviously it is not a hugely relevant question for upgrading a legacy system, but neither is asking how many golf balls would fill the Washington Monument or something. Giving up a feasible problem without attempting it is not going to help your job prospects.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:47 • by Ron Moses (unregistered)
...although I do agree with the guy's assessment of THE CLOUD. Pure marketing cr*p.

This morning I commuted to work on this new thing called THE GRID. It's a nationwide network of interconnected asphalt lanes - it really is the future of personal and commercial transportation. We have an IPO coming up if you're interested...?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:50 • by Fool (unregistered)
If I was writing java code and there were no Math.sqrt function i would try to figure out what what jar file is missing, where and then contact IT to fix it.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:52 • by snoofle
390073 in reply to 390061
asdbsd:
That last one was awful. Although you don't get to write square root formulas often, in real life not all answers are readily available. Being a programmer means that sometimes there's no site, no person, no book with the answer, and you have to patch something up by yourself. It is this ability which the interviewer obviously wanted to test. Walking away at this point is just stupid.

I know no formula for square root calculation, but I'd suggest some variation of binary search for instance. Take (a+b)/2, check it's square, if it's bigger than x then a:=(a+b)/2 else b:=(a+b)/2, repeat until you have the required precision.
This probably sucks in terms of speed, but hey, at least it works.
True, one can approximate, but coming up with an algorithm usually requires a little thought (aka: time), and in an interview, you don't get to take the required time to think things out; you either know it or you don't.

After that interview, I had time to think about it and I came up with:

Start squaring numbers from 1 up until you exceed the target value, then back up one, and start incrementing the next smaller digit (1's, then tenths, then hundredths, etc) until you arrive at the required precision. Big deal; I can come up with a crappy algorithm for calculating something for which there are known formulas. I make no claims of being a mathematician. nor would I even want a job where I was responsible for coming up with such formulas.

A more sensible question might be to ask me: we've got A amount of data, B amount of storage, C transaction rate and D throughput. There is a problem xxx. How would you diagnose this? What are the likely causes and possible solutions?

That tells the interviewer how I think in terms of things pertinent to the job.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:53 • by @Deprecated
390074 in reply to 390068
Studley:
What if there were no numbers?


That's easy!

function sqrt() { return NaN; }

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:56 • by Chris P. Peterson (unregistered)
390076 in reply to 390054
There is no way the guy wanted an exact answer. He was trying to see the candidate's thought process when the answer was not available. The interviewer could've done a better job at asking the question and the candidate should've done a better job at realizing what was being asked and made an attempt.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:56 • by John (unregistered)
390077 in reply to 390054
snoofle:
...
The guy wanted an exact value, not an approximation. If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.


Hey, where can I get a computer like yours, that can represent sqrt(2) exactly? I could really use a computer with infinite-precision reals.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:57 • by The REAL WTF (unregistered)
390078 in reply to 390054
snoofle:
coder guy:
It seems to me that anyone who can't even come up with a lame attempt at successive approximation to figure out a square root without running to a reference isn't fit for a programming job.
Why? The guy wanted an exact value, not an approximation.

If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.

Without commenting on the value of the question for the interview, the above is simply wrong, at least for square root. Your approximation function should either find the exact value (what's the square root of 25?) or there IS no exact value (what's the square root of 2?) and it should be able to calculate it to any desired precision.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 08:59 • by Anonymous Coward (unregistered)
390079 in reply to 390073
[quote="snoofle"]That tells the interviewer how I think in terms of things pertinent to the job.[/quote]
Do you walk out of interviews whenever posed any problem to solve that's not directly pertinent to your job?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:01 • by Anoldhacker (unregistered)
390080 in reply to 390057
Niels:
An iterative approximation for a square root shouldn't be hard to come up with.

private static double EPSILON = 0.00001;

public static double sqrt(double x)
{
if (x <= EPSILON) return 0; // should error
double lower = 0, upper = x;
while (upper - lower > EPSILON)
{
double guess = (upper - lower) / 2;
if (guess * guess > x)
lower = guess;
else
upper = guess;
}
return lower;
}


This should be considered a good example of precisely why you don't do things like this yourself. The square root of x for small x is much larger than x. The quick return is not needed for non-negative numbers, and if it were, the boundary would be EPSILON * EPSILON. (And no, the square root of -1.0 is NOT even close to 0.0.)

Yes, my degrees are in mathematics, and I did floating point validation in the '90s. Seriously, don't try this at home, kids.

(The way that we actually compute floating point square roots is fun. We look up the first several digits for the inverse square root, and then refine it based on polynomials designed to cancel the error term, usually quadratically. Once there is enough precision, you multiply back the original value to get the square root. Yes, you want a real proof that the algorithm works.)

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:02 • by AGray (unregistered)
Snoofle's tale of the interview is probably the most alarming - you apply for a job where apparently the boss expects you to work with zero resources?

I think Snoofle was right - the employer was totally wasting his time, and did a great job of letting Snoofle know that that was totally the wrong place to be, let alone work. The place next door that lets developers use Internet is a vast improvement!

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:02 • by Wide Awake (unregistered)
we're dreamers, we're entirely conceptual
Wow! That is one refreshing level of honesty there! I know there are at least a hundred million "business leaders" who should stand up to the same admission, but I never thought any of them actually would!

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:06 • by foo (unregistered)
390084 in reply to 390052
vwiggins:
The second one has made me really sad. I get lost all the time, especially if I'm nervous. If someone judged my ability as a developer based on my inability to learn left from right or find my way around a place I've never been before I'd be horrified.
That's not what happened. The candidate walked away.

The way I read it, he "pimped up" his CV and was trying to cheat his way through the interview. When he learned there'd be a technical test, he was "not prepared for" cheating it, so he made up a lame excuse to leave.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:07 • by DES (unregistered)
If I was conducting interviews for a programmer position, I'd immediately fail any candidate who didn't know Newton's method and was unable to come up with it (or a similar successive approximation method) on the spot. It is blindingly obvious, and trivial to implement.

I'd probably also fail any candidate who didn't, at some point, suggest Math.exp(Math.log(x) / 2). And even if Math.log() isn't available, you can easily compute a rough lower bound of log(x) through successive division, as an initial guess for successive approximation.

(to those who complained that Newton's method does not give an exact value: where does it say that the interviewer expected an exact value? in any case, with a few exceptions, the floating-point representation of a number will always be an approximation of the actual value.)

As for Carmack's method: assuming it can be implemented in Java (it can't—not without a lot of contortions), it can easily be derived from first principles if you know basic algebra and the layout of IEEE 754 floating-point numbers. If you don't know the layout, you can easily figure it out by looking at the binary representation of a handful of test values.

So TRWTF is that the candidate refused to even try to think of an answer, then blamed the interviewer for asking him a question he should have been able to answer but wasn't.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:07 • by emaNrouY-Here (unregistered)
390086 in reply to 390065
TheRider:
Niels:
An iterative approximation for a square root shouldn't be hard to come up with.
<SNIP>
What if you can't use the multiplication operator to square a number?

And What if you can't use addition?

(It's a flipping adding machine!!!)

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:08 • by Spastic Weasel (unregistered)
390087 in reply to 390054
Newtons method of iterative approximation would be doable off the top of my head.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:10 • by Sebastian Buchannon (unregistered)
double Sqrt(double val)
{
double ret;
while (true)
{
ret = rand() * double.Max;
if (double.Equals(ret,val))
return ret;
}
}

He never said he wanted it quick

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:10 • by snoofle++ (unregistered)
When you give an amateur programmer a problem, their first impulse is to roll their own solution.

A pro goes to the language libraries first, the in-house code base second, the world of pre-written solutions third, then asks "has anyone else poured some thought into this problem" before inventing his own wheel.

Snoofle, I think you bailed 5 seconds early. Based on your answers I would have been offering you a job in the next breath.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:10 • by Helpfull (unregistered)
If you answer ARM and Intel have built in assembly squareroot instructions the next question will be what if you don't have a processor :)

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:10 • by QJo
390091 in reply to 390054
snoofle:
coder guy:
It seems to me that anyone who can't even come up with a lame attempt at successive approximation to figure out a square root without running to a reference isn't fit for a programming job.
Why? The guy wanted an exact value, not an approximation.

If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.



Fail. You can't get it exact because square roots are (in all cases except when all the prime factors are to an even power) irrational.

Granted that you may not be able to come up with: guess, divide your number by that guess, take mean of result with guess, and repeat, IMO it's something that you might be expected to be able to work out.

Depends on whether your expertise is borne of a lot of experience or a combination of that and the ability to figger things out from scratch. Fair enough, though, it certainly appears that you and your prospective employer would not have been a good match.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:11 • by foo (unregistered)
390092 in reply to 390077
John:
snoofle:
...
The guy wanted an exact value, not an approximation. If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.


Hey, where can I get a computer like yours, that can represent sqrt(2) exactly? I could really use a computer with infinite-precision reals.
Ever heard of computer algebra systems? Representing sqrt(2) exactly isn't hard, yet outputting it in decimal (or any other base) will take ... some time ...

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:13 • by foo (unregistered)
390093 in reply to 390086
emaNrouY-Here:
TheRider:
Niels:
An iterative approximation for a square root shouldn't be hard to come up with.
<SNIP>
What if you can't use the multiplication operator to square a number?

And What if you can't use addition?

(It's a flipping adding machine!!!)
If you need anything more than NAND gates, you're not qualified.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:16 • by Joe (unregistered)
390095 in reply to 390085
DES:
I'd probably also fail any candidate who didn't, at some point, suggest Math.exp(Math.log(x) / 2).
I've been programming for 30 years and I can guarantee you I've never had the slightest use for Math.exp or Math.log. Some programming jobs aren't about math, despite what your Computer Science teacher told you. And I'm talking real code, not drag-and-drop crap.

Hell, half the stuff I see CS grads crank out barely works. But I suppose it's mathematically sound, so there's that.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:17 • by foo (unregistered)
390096 in reply to 390088
Sebastian Buchannon:
double Sqrt(double val)
{
double ret;
while (true)
{
ret = rand() * double.Max;
if (double.Equals(ret,val))
return ret;
}
}

He never said he wanted it quick
I know you just forgot to square, but this way it's even more ridiculous. :)

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:17 • by Anonymous Coward (unregistered)
390097 in reply to 390089
snoofle++:
When you give an amateur programmer a problem, their first impulse is to roll their own solution.

A pro goes to the language libraries first, the in-house code base second, the world of pre-written solutions third, then asks "has anyone else poured some thought into this problem" before inventing his own wheel.

Snoofle, I think you bailed 5 seconds early. Based on your answers I would have been offering you a job in the next breath.

I think it was poorly posed, but it's a legitimate question. If I started off the way snoofle's interviewer did, after the "Google" response I would have said something like: "Of course, we would never want a programmer to try to implement their own square root. However, as an interview puzzle, I'd like to know how you'd calculate a square root without the library." Hopefully that would rule out answers like, "buy a book".

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:18 • by Zecc (unregistered)
390098 in reply to 390077
John:
snoofle:
...
The guy wanted an exact value, not an approximation. If I asked you to come up with a formula for something you honestly didn't know how to calculate, you might approximate, but you won't get it exact.


Hey, where can I get a computer like yours, that can represent sqrt(2) exactly? I could really use a computer with infinite-precision reals.
I'm no expert, but I believe Mathematica can probably represent the exact value of 2, even if "only" symbolically.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:19 • by robert (unregistered)
390099 in reply to 390070
[quote user="Anonymous Coward"]1. How do you know he wanted an exact value? You left without offering a non-exact solution.

2. Successive approximation WILL give you an exact value.

That's impossible.
Most square root functions return an irrational number, i.e.: their digits repeat endlessly without a recurring pattern. There is no representation for the number in a digit-based system.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:19 • by onitake (unregistered)
I remember our math teacher showing us what Wikipedia calls Digit-by-digit calculation, just for the fun of it.
But I totally forgot how it went, so I probably would have failed that interview too.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:21 • by Yaos
If you want a clever programmer that's exactly what you're going to get. Why use the built-in square root function when you can create your own version that somehow only works 50% of the time? Any way, I would just pre-compute trillions of square roots.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:22 • by Schmitter (unregistered)
The square root issue is easy. Just convert the whole system to HTML5, put it on network 3.0 (the cloud) where every number automatically shows it square root next to it. 9(3)


P.S. Why can't I copy/paste the CAPTCHA?

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:23 • by jonnyq
390103 in reply to 390051
Anyone who comes up with a lame attempt at approximation to figure out a square root without checking a reference, and puts that code in production with the obvious zombie apocolypse going on, isn't fit for a programming job.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:24 • by Jeff (unregistered)
Me: How does my ability to pontificate about unrealistic problems in an artificially constrained setting under unusual pressure relate to the projects for which you are hiring?

Interviewer: I want to see how you think.

Me: I think I want to work somewhere that is evaluating me for my technical skills, not my game show skills.

Re: Trouble With Founders, the Lost Candidate, and More

2012-09-18 09:26 • by Graham Dunn (unregistered)
also, you should really not suggest coding up one of the most advanced data analytics programs in a markup language.


Unless Apple is now shuffling their Siri searches off to Deep Blue, maybe you should not refer to a wrapper around a voice to text system + search engine as "one of the most advanced data analytics programs"
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7Next »

Add Comment