- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Regardless of your talent or ability, I would have failed you based on your people skills. After reading your responses, it's increasingly apparent you're unable to get along with your peers.
You could be the 2nd coming of Sir Isaac Newton, but I would not recommend hiring you. You would only manage to piss off all our coworkers, clients, and customers. You would alienate our team within our company and make our work much more difficult to accomplish.
I think the only work environment suitable for you is a solitary office in Antarctica where your nearest coworker is several thousand miles away. Not to worry though. You'll receive drop shipments of supplies on the first day of every month. You can upload your completed work via file transfer over HAM radio.
Admin
Come on, the interviewer was trying to see how the candidate would react to difficult situations. Clearly the candidate on this occasion was a quitter.
Admin
[quote user="no laughing matter sqrt(x) is monotonic when x >= 1. However for non-monotonic functions a binary search will fail.[/quote]
I will fail you on two points.
Firstly sqrt is monotonic even for x < 1. It is strictly increasing as f(x) > f(y) whenver x > y. It doesn't matter that, below 1, sqrt(x) > x.
Incidentally, the derivative of sqrt(x) = 0.5/sqrt(x) which is always > 0 and therefore we know it is monotonic for x > 0.
The second point I will fail you on is that binary search will not work on a non-monotonic function. If you have two values a and b, and your function is continuous at all points between a and b, and f(a) < y and f(b) > y then there must be at least one point x between a and b such that f(x)=y. There might be more than one but there always must be at least one.
binary search won't work if you have two start points a and b such that f(a) and f(b) are both > y even if there happens to be a solution in between so if y is a (local) minima (or local maxima) there is no way to find it with binary search. Newton Raphson will possibly get you there, secant will also fail.
The point is that, when you take the halfway point between and b, you will either have hit a solution or you will still have a pair of values that wrap your target (a and (a+b)/2 or (a+b)/2 and b) even if your y-range is now bigger than it was before.
Admin
throw std::invalid_argument( ""Stupid"" is not valid input for square root );
Admin
@snoofle
They were probably waiting to hear "Newton-Raphson iteration, with d(sqrt)/dx = 2x". My guess is they were testing whether you went to high school. Looks like you failed...
Admin
They would like to hear things like this:
This is a complete procedure for the square root function in the real domain. Say stuff like this and they'll be impressed.
Admin
I would've gone back and forth with snoofle for a while, up until the point where it was obvious he wasn't interested in 1) writing a square root function (it's not rocket science), or 2) answering the question the interviewer was actually asking.
Admin
The correct answer would have been "I probably couldn't do it." r "I could come up with something but it wouldn't be pretty, brute force for example."
Admin
Leaving was definitely the right move. I don't know exactly what that interviewer's game was, But he struck me as highly manipulative. Especially that stupid "we're not through yet" crap at the end.
It seems like he was just trying to establish dominance by making you feel weak. With that kind of attitude what kind of programmers do you suppose he's able to retain? Certainly no one good. just a bunch of people who are trying to say "yes you're right, sir" all the time. And then that interviewer guy will wonder why they can't hire a good programmer and blame the programmers.
-- Furry cows moo and decompress.
Admin
Please tell me how to write sqrt(). And remember don't use Google. If you don't have the formula already memerized at the time that you read this, then I'm gonna have to count that as a fail.
-- Furry cows moo and decompress.
Admin
So I've interviewed countless people, managed various types in various settings, and the game game works the same EXCEPT when it comes to computer people.
If a non-tech person shows up for an interview, they do their best to impress. When a tech person shows up, they all have entitlement issues and think they are infallible.
The normal procedure goes along the lines of the candidate trying to impress the interviewer and making them feel like this person belongs on the team.
The normal procedure when hiring a tech guy is trying to impress them and convince them they belong on the team.
This stuff takes time to get used to. Tech people are dangerous, because they control you assess and your access to them. But because there is such demand for skilled PC guys, they have the upper hand. Most of them seem to think they are better than what they actually are however.
Admin
or the other option...
"I'd reach down, grab a pile of poop and throw it at the bear."
"What if there were no poop?"
"Oh, there would be by this point..."
Admin
"What if there were no one to ask?"
Ummm.... I appreciate the idea of seeing how someone thinks and can deconstruct a problem, but at some point, there has to be someone to ask - the client/manager/customer/user/someone.
If there's no one to ask, there's no one to verify if it's right or not, so I'll just return 0 or null and move on.
Admin
I agree. I would've calmed the submitter down and given him the problem again as finding the f^(-1)(x) where we had a black box for computing f(x). Then tell him that f(x) was in fact x^2 and he's solved my square root problem after all and watch his head explode. Then tell him to GTFO obviously.
Admin
How about this awesome code (written by a CFO):
public static double findTheGoddamnSqrt(double num) { int godamnAnswer = 0; while (++godamnAnswer * godamnAnswer != num); return godamnAnswer; }
Concise and to the point and wastes a lot of time like the stupid question
Admin
Ya, well - depending on how clever he wants this programmer to be , determines the appropriateness of the question. As for the Zombie apocolypse , that is a non-real event and a non-real 'number'... [Lolz]
Admin
(In response to the square root of stupid)
M: I'd approximate the number one digit at a time. I: What if you couldn't do that? M: I'd, uh... guess randomly? I: What if you had no random number generator? M: I'd weep and cry out. I: What if... you had no mouth?
Admin
If your story is true you were really really rude and stuck up for no reason. Every computer science freshman should have an idea of how to successively approximate a function to arbitrary precision, at least with methods as inefficient as binary search.
However your "you might approximate but you won't get it exact" thing shows you know nothing about what that means.
The problem is hardly unrealistic. It's a trivial function everyone knows about and the question tests very simple computing ability.
Admin
$eps = macheps() # calculate machine epsilon somehow
def sqrt(x) val = x
end
This is basically as exact as your computer can handle (accurate to a step maybe). It will take forever to calculate a single value, but will work nonetheless.
Admin
i keep thinking of a similar "square root of stupid" style interview in a much later story on this site...the interviewee finally snapped and said, "well, then i would ask YOU how to solve the problem, since YOU are obviously the only person who knows the answer!"
Admin
The square root guy (the interviewee) is a moron. Math isn't some arcane folk art requiring millennia of rote memorisation. Frankly he didn't deserve the job and thank God he didn't get it. The LAST thing the interviewer was looking for was a memorized formula.
The sqrt function is monotonically increasing and smooth. Square roots of even powers of two are trivial to calculate. Therefore, choose the nearest two even powers of two, then perform a binary search between these two bounds using the inverse function (x^2) until the desired level of accuracy is reached.
There. I've demonstrated that I can approach a problem logically and come up with a solution in a short space of time, and communicate it effectively. It doesn't have to be the perfect solution, it just has to demonstrate that you're not a stuck-up, temperamental moron, and he failed the test.
Fuck's sake people.
Admin
Willingly I accept. The theme is interesting, I will take part in discussion. I know, that together we can come to a right answer.
guardianship tied to sex machine
Admin
I shall afford will disagree with you
circumspection bondage machine porn
Admin
??? Solving complex captchas is possible only by people, and not by bots and programs. I use 2captcha services and am happy with their work.
Admin
https://ricardorizo60988.nizarblog.com/7498800/Бесплатный-чат вебка знакомства бесплатно https://alexiscawo77765.goabroadblog.com/8700287/Бесплатный-чат вебка онлайн бесплатно https://zanderfcxr89999.verybigblog.com/8716722/Онлайн-девушки-из-твоего-города вебки бесплатно http://jasperqnia11100.bleepblogs.com/10708233/Бесплатный-чат бесплатно девочки на вебках вебка эротика бесплатно бесплатные игры с вебкой [url=http://martinwitd09753.bloginder.com/10363558/Горяч&