Just had the longest interview

Honestly, I think that the whole brain teaser thing has gotten way out of control. If you are going to ask a brain teaser, at least make it relevant to the position, i.e. if it is programmer position make it programming, if it is a fundamental analyst position make it related to fundamental analysis, etc.

I know a sales person that walked into an interview at a quant fund and the CIO was asking him questions like “how would you calculate the volume of the Hudson.” This has zero relevance to what this person, who doesn’t need a job and would only take this one so they can travel a bit less, is actually good at: building relationships and selling products and services.

Interview brainteasers might indicate intelligence, but they are not reliable tests. You cannot ask enough questions to average out the candidates score. Also, the time span is short and it’s in an environment that does not reflect work conditions. As bchad suggests, other indicators are generally available to show the candidates intellectual potential. If you have a 3.7 GPA from University X, that tells me more about your intelligence than some questions that are largely irrelevant to any job.

However, I agree that for non-entry level jobs, it is important to test knowledge of programming, financial products, or other topics. The person should already be familiar with these things, or you should become confident that they have the ability to learn those things quickly.

I also agree that the brainteasers serve to boost the ego of the interviewer. I doubt that most interviewers could even answer their own brainteaser questions under pressure.

Ohai, wrong. High GPA is good, but unfortunately, unless you have 3.8 GPA from MIT in Comp Sci, or in Princeton in Physcis, it really doesnt tell me much. Also a lot of smart people are inherinetly lazy, and dont care about GPA. On the other hand, winning Olympiads and scoring high in Putnam or ACM competitions is a great sign of your intellectual POTENTIAL.

Think of brainteasers is like a tiny Olympiad.

Don’t most places make you do some sort of psychometric testing now anyway? They usually involve some kind of quantative reasoning section, so they will already have a good handle on your IQ from that.

I think asking a brainteaser in an interview (where your answer is often evaluated on the fly by an unqualified interviewer) will be a much less reliable test of intelligence than a formalised multiple choice test evaluated by a specialist firm.

I’m not sure brainteasers asked during the interview process really add much value at all.

Well, I do have stats similar to what you’re describing, if that helps clarify anything. I just think there are too many noise factors during an interview to provide an accurate picture of intelligence. You get asked like 2 questions. I would not rely on answers to two short questions to influence my hiring decision. Sure, it is an indicator, but not a very useful one for many candidates.

Never had to take such test? Can some one opine? Is it really a practice finance related fields?

I only had one interview that was preceded by a psychological test. There were no math questions though. It was pure psychology - no wrong or right answer. However, I think I still managed to mess this up somehow. Initially, they were like “Yeah, ohai, your credentials look great. We are very happy to talk to you. yada yada… Oh, but please take this test first. It is part of our procedure.” After that - *crickets*.

Intelligence does not produce results as much as hard work and relevant experience (and people skills) do, in the corporate setting. I have seen this countless times, things that work in academia - for students and for professors - hardly work in “real life” i.e. industry.

Screw brain teasers. They tell me nothing about how good you will be at the job. I am not interested in a demonstration of how clever you are any more than I want to see how big a D you are swinging.

According to the author of an article I read somewhere, the best question to ask a candidate is, “Tell me about a project you worked on that you’re most proud of.” I don’t know if it’s the best question out there but it does seem to tackle a lot of different attributes of a candidate. Planning, creative thinking, use of resources, etc. If I were to hire someone, I would be much more interested on how the person generated results and his/her fit within the organization versus GPA/brainteasers/test scores.

I like asking that question. It tends to put the interviewee at ease, and you can get at what drives them (why are they proud of it). From there, there are usually lots of things that can lead to other questions.

Remember that the interview is really to “kick the tires” a bit and see if you can stand being in the same room with the person on a regular basis. You’re never going to have a complete view of someone from a 45-minute or one hour conversation, particularly when people are highly motivated to be on their best behavior.

The Fizz Buzz Test is pretty popular for programmers. It is easy but a lot of people can’t do it.

http://c2.com/cgi/wiki?FizzBuzzTest

In R:

for(i in 1:100){ if(i %% 3 ==0 && i %% 5 ==0){cat("Fizz Buzz ")}else{ if(i %% 3 ==0){cat("Fizz ")} if(i %% 5 ==0){cat("Buzz “)} if(i %% 3 !=0 && i %% 5 !=0){cat(i,” ")}}}

That’s kinda fun, and R is an especially nice language to do it in.

===

nums

fizzNums

buzzNums

output

output[fizzNums]

output[buzzNums]

output[fizzNums & buzzNums]

print(output); # send the result

print(data.frame(output)); # alternate output style, looks nicer

===

I was trying to figure out how to do it so that one could just append Buzz to the terms that were already Fizzed to produce FIzzBuzz, but thought that the solution above was more readable (for those familiar with R) and probably more efficient, since it avoids looped if statements and remains vectorized.

^^^^ I see what you are trying to do but you have a minor error. You need double quotes instead of single quotes. Other than than nicely done. You are going in the direction of the pure R implementation. I learned C++ first and moved to R so I use the more structured approach.

I would pass you with flying colors.


nums

fizzNums

buzzNums

output

output[fizzNums]

output[buzzNums]

output[fizzNums & buzzNums]

print(output); # send the result

print(data.frame(output)); # alternate output style, looks nicer

I’ve run it and it works fine. The reason errors pop up if you copy and paste directly into the R interpreter is because the AF software automatically turns straight-quotes into curly quotes, which the R interpreter doesn’t recognize.

Like Python, R recognizes both single quotes and double quotes as string delimeters, but AF’s forum software does some modifications. If you cut and paste your corrections to my code from here into the interpreter, you’ll see that you get the exact same errors.

R’s vectorization stuff is really neat, and extremely useful for data analysis types of applications. I can write loops too, of course, but it always feels sloppy now, even when I do it in Java or C++, where you frequently don’t have any choice but to loop.

Two complaints.

One minor and one somewhat important.

Can you do that in less than 8 lines? AND

Can you rewrite so numbers are recognized as integers and words are recognized as characters? Everything in output is a character.

I still would have passed you though.

I like bchad’s approach, but it is also possible to make it more slightly more general:

nums_max

mod_nums

names_nums

n_mod_nums

nums

output

for (i in 1:n_mod_nums) {

bin_mod

output[bin_mod]

}

bin_na

output[bin_na]

print(output) # send the result

Well, that wasn’t listed as a requirement. The code as I delivered it has 9 lines in it.

One is completely redundant (two versions for printing output, one is prettier because it has line numbers);

Two lines are there solely for readability (line 2 and 3) and can be removed, with their expression equivalents directly integrated into (current) lines 5-7…

With some loss of generality, one can remove the first line as well.

So that brings the code down to 5 lines, at the cost of hardwiring in n=100 in multiple statements.

If you really wanted to economise on # of lines, then your looped if statements are shorter, but a vectorized solution will run faster as well as being easier to read.

EDIT: jmh made the code more general, which of course isn’t a bad idea, but does start to make it more complex. I do like how it solves the problem of appending Fizz Buzz and whatever else comes up.


As for the output being integers versus text. I’m not sure this makes much sense. Either you are going to return the output to a data object, which typically will expect an array or vector of a constant type, or you are going to output it to something like a printer or a text file, where strings and integers are going to look pretty much identical anyway. I suppose you could want to output to some kind of XML that says whether it is a number or a word, but that wasn’t in the requirements either.

In C, you could use pointers to write integers and characters directly to memory, I suppose, and then return an array of pointers to their location, but that sounds to me like an messy way of handling stuff that is almost guaranteed to blow up at some point if it’s mishandled. You’d want a class or structure that has a pointer and then a bool saying whether it’s a number or a string, and then some kind of array of all of them. Unless there is a compelling reason to organize memory that way, it sounds like a bad idea if done solely for the sake of saving a few lines of code.

I suppose could add a line like this:

for (i in 1:100) { ifelse( ((i %% 5) | (i %% 3)), print( output[i] ), print( format(i, digits=3) ) ) }

But if it’s important to know which are strings and which are not, I would probably just create a vector like "outputIsChar

output[outputIsChar] -> all the entries which are strings

output[!outputIsChar] -> all the entries which are not strings.

Python:

for i in xrange(1,101):

x = ‘Fizz’ if i % 3 == 0 else ‘’

x += ‘Buzz’ if i % 5 == 0 else ‘’

print i, ‘:’, x

Elegant as Hell if I say so myself.

If you set up everything as lists, then I think you would resolve the numbers and string issue. They usually can behave like cell arrays in Matlab.

Good point. I didn’t think of that. I’ve used lists to hold data frames for different securities while I’m downloading them, before merging. Lists do work pretty well for holding random kinds of stuff.