- 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
What, like this?
Admin
As long as we're being silly...
Admin
I wouldn't hire you either, for deliberate and malicious over-engineering and willful under-use of ternary operators:
[/quote]It wasn't deliberate, it was entitely accidental....so can I have the job????
Admin
Since the fizbuzzing it getting stranger, here it is in Sieve of Eratosthenes style:
If you really dig loop unrolling, there's this (although it runs past the 100 mark):
Admin
The question isn't really specific enough though to expect such a direct answer. The expectation is that the interviewee will somehow figure that they're two points on the Cartesian plain, and two-dimensional as well. It's OK if you're interviewing people without exposure to upper-level undergraduate university math, but otherwise I'm not sure whether it's a valid way of telling whether someone is 'smart' enough to work for you. Maybe this type of thing is the reason why Microsoft doesn't ask silly questions along with their interviews anymore.
Admin
Impressive parameter stack abuse, but "buz" is being printed out every fifth number starting at 3 (3, 8, 13, 18, etc.) instead of every third number. I'd like to see what this looks like if you can further twist it to get correct output.
Admin
Argh... you are indeed right. Can't believe I made that mistake :(
Admin
Captcha VALIDUS
Admin
Here's a BF implementation, because I'm apparently trying to make myself insane. If it actually worked (I doubt it does and I don't want to try it) it would zero-pad all the numbers, but it's pretty good otherwise.
Admin
Why would you try and code this in BF in the firstplace. You think potential employers have ever even heard of it? (well, the fun places to work they would have, but that's somewhere you'ld want to work, not likely they'll be hiring, is it?)
Admin
Hmmmm.
It amazes me what kind of weird arguments spring up around here.
Admin
Here's a bf implementation that "should" work:
++++++++++[>+>+++++>+++++++>+++++++++++>++++++++++++<<<<<-]>>-.+<.>.<.>>.>----->++.--<<<<.>++.--<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<.>+++++.-----<.>++++++.------<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>-..+<.>>.>----->++.--<<<<.>-.++.-<.>-.+++.--<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>-.+++++.----<.>-.++++++.-----<.>>.>----->++.--<<<<.>-.++++++++.-------<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>..<.>.+.-<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>.++++.----<.>>.>----->++.--<<<<.>.++++++.------<.>.+++++++.-------<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>+.--.+<.>+.-.<.>>.>----->++.--<<<<.>+.+.--<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>+.-+++++.-----<.>+.+++++.------<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>++.---.+<.>>.>----->++.--<<<<.>++.-.-<.>++..--<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>++.++.----<.>++.+++.-----<.>>.>----->++.--<<<<.>++.+++++.-------<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>+++.---.<.>+++.---+.-<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>+++.+.----<.>>.>----->++.--<<<<.>+++.+++.------<.>+++.++++.-------<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>++++.-----.+<.>++++.----.<.>>.>----->++.--<<<<.>++++.--.--<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>++++.+.-----<.>++++.++.------<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>+++++.------.+<.>>.>----->++.--<<<<.>+++++.-----+.-<.>+++++.---.--<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>+++++.-.----<.>+++++..-----<.>>.>----->++.--<<<<.>+++++.++.-------<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>++++++.------.<.>++++++.-----.-<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.>++++++.+.-------<.>>.>----->++.--<<<<.>++++++..------<.>++++++.+.-------<.>>.>----->++.--<<----.++++>>---.+++++.--<<<<.>+++++++.--------.+<.>+++++++.-------.<.>>.>----->++.--<<<<.>+++++++.-----.--<.>>----.++++>>---.+++++.--<<<<.>>.>----->++.--<<<<.>+++++++.--.-----<.>+++++++.-.------<.>>.>----->++.--<<<<.>>----.++++>>---.+++++.--<<<<.
Admin
You, sir, are hired. Welcome aboard. Would you like 2 30-inch monitors, or 4 24-inch ones in your new office?
Admin
Because the guy in front of me did it in Befunge, and my Scheme loop and clever use of sprintf to do a real two-case version had slightly less geek cred than that.
In short, I did it because I can.
Admin
Who is going to do a malbolge version? ;) ;)
And as above: "Because I can" ;) <3 esoteric languages
Admin
Addendum (2008-05-07 05:55):
Technically, I make it four cases, but I'll give you that one of them is the default (i.e. none of the above). I can do it with 2 tests for the actual cases and one for the default, but I don't know if that counts as competence or not... ;^) For what it's worth: --- Addendum --- As an aside, I had an interview for a web developer on Friday, and at one point the tech interview started talking about web applications being stateless, and asked me how I would manage that state. I made a few nervous points about session variables / objects and data validation on the server side; he obviously wasn't getting what he wanted and prompted me about how to implement some state - so I suggested he was talking about AJAX and other asynchronous technologies. He stillw asn't getting the reply he wanted, so he started talking at a more and more basic level about how you transfer the information, and I suddenly realised that he was asking if I knew how to use GET and POST to send information requests to the server. I couldn't decide what the biggest WTF was - him talking about that in terms of managing state, or him actually asking a question to which the answer is "POST and GET" in an interview for the position of Web Application Developer. If you don't know what POST and GET are, you're really not Web Developer material. Still, I got the job after all that :)Admin
And I can't express how much this forum / commenting software sucks. Sorry about the massive post guys ;^)
Admin
Well I don't know if anyone's reading these any more, but here's my 2p worth: sql solution to FizzBuzz
declare @id int select @id = 1 while @id <= 100 begin select @id, substring(" Fizz Buzz FizzBuzz", ((1-sign(@id%3))+(1-sign(@id%5))* 2) * 8, 8)
select @id = @id +1 end
Admin
Please, please register. I'll even buy you a pint of Theakston's Old Peculier...
Admin
Then walk away. With dignity.
Admin
Admin
Writing an efficient O(N) algorithm is hard, but even the general start from the front and match against each sub string is O(N). The worst case number of compares is N*m where N is the size of the string and m the size fo the substring.
I think I would find a candidate interesting if they did even a subset of the more efficient algorithms.
Admin
Done. The promise of Old Peculier was too much to withstand.
Also, I did once do an interview question in Scheme on a whiteboard. Then I was asked to do the same problem without using conditionals, so I wrote it in assembly. I am not making this up.
But legacy Access databases? No sir, I still retain some ethics.
http://xkcd.com/55/
Admin
I'm a few days late replying, who cares?
I must either be missing something, or that guy truly is as stupid as he seems:
Admin
If not, be glad. London is a fetid dump. Avoid.
Admin
Care to name a pub?
Admin
I don't suppose that this will stop the madness, unfortunately.
Admin
Incredibly, that's what you have to do to print something out without an automatic newline.
Admin
Well we'll be delighted never to see you here then...
Admin
Actually, the most accurate response would be something along the lines of "The norm of the subtraction of the second point to the first point relative to the current inner product space". I believe it covers any sane problem involving distance between points/vector/functions/etc (And infinite-many insane ones too).
Admin
In the Perl communities I'm in (NGs and fora) when such questions get posted they're generally recognized as homework and the OP is promptly asked to show what he's tried that far.
Admin
If I had asked you that question you'd damn well better give an answer that would work in arbitrary geometries.
PS: x1 . g . x2
Admin
Answers on the back of a beer-mat to: Address anonymized.
Admin
Someone posted on this thread, linking to this website's article.
Admin
I don't even remember how I used to solve problems like this. Turn in code I've never even compiled? Shudder! These days I have to write a test, compile it, run it, and get a red bar before I can write any code at all.
These days, if I interview a developer, I have a computer handy with Eclipse running on it, and I have him solve one or two problems from http://www.betterprogrammer.org while I pair with him. If he can't handle me watching over his shoulder, I'm not interested in him. If the first thing he does isn't write a test, I'm probably not interested in him.
Admin
No, but it's a valid way of telling whether someone is 'dumb' enough not to work for you.
These questions look really easy to us but recall, the OPs said that their interviewers told them that many candidates failed.
Lots of dumb people failing ==> pretty good filter. (I guess it's a "high pass" filter!)
Admin
A very safe way to reply to this question that's insensitive to the confounding effects of "weird hyper-points" is to state it as:
"the square root of the sum of the deltae squared for all individual dimensions."
because, as you can understand by finding longest diagonals of any n-cube, it's all just the right-angle specialization of the pythagorean theorem.
~ dan ~
Admin
I dont get it, why are all the codes here hard to read compared to mine. :( is this considered noob code? btw, how do you put tabs on the comments lol
#include <iostream>
using namespace std;
int main() { char* input = "Polly sdf polly dfd polly dsssdsdspollya"; char* sub = "oll"; int i = 0, f = 0, newI = 0; bool isit = false; int inlength = strlen(input); int sublength = strlen(sub);
}
Admin
This 'distance between 2 points' thing - where the hell do you work that you have to think about sh!t like that?
Admin
Anyway, that code doesn't print the numbers that are not divisible by 3 or 5, which is required by the traditional FizzBuzz problem. Here's my solution... the easy way.
fizzbuzz.csv:
Oh, is using Excel cheating?
...fine...