Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ramy1989

macrumors newbie
Nov 7, 2012
21
0
FTFY =). The receptionist will validate your parking on your way out. =)
Question wasn't to omit the value when evenly divisible, just append. The question didn't say inclusive or exclusive, so I made this an option.

"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

It says instead of the number, I think that the instead is valid also for other cases, not sure, English is not my mother tongue :p
But "from 1 to 100", I think it's clear that is from 1 to 100, included.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

It says instead of the number, I think that the instead is valid also for other cases, not sure, English is not my mother tongue :p
But "from 1 to 100", I think it's clear that is from 1 to 100, included.

Odd, a few posts above you I read "Write a function that takes an int N, and prints all numbers x between 0 and N on the standard output. Append "Fizz" if the number can be divided by 3, and "Buzz" if the number can be divided by 5."

We all win!

-Lee
 
Last edited:

timhuerta

macrumors newbie
Nov 8, 2012
5
0
Columbus, OH
Back to the question at hand...

I've been a long-time lurker, but I decided to register to answer this question.

I have in fact interviewed and hired programmers. My first programming was in BASIC on a TRS-80 and I've programmed in COBOL on punchcards and used a screen that required that you demagnetize it by pushing a button to clean it. Kind of like a digital etch-a-sketch. I do not program now - I hire people to do it. But, I have expectations that people who program should be at least 80% as fast as me. All that to say, I have high expectations and I hire for projects. What kind of business are you interviewing for - because context matters. Larger places will be less concerned about your programming skills and more concerned about your people skills. Large projects require the knowledge of and efforts of lots of people, so if you aren't a good team player, you aren't getting the job. In those cases questions focus not only on your technical skill, but your people skills.

On the technical side... I want to know what the last program you wrote for fun. There is, in my opinion, different categories of programmers. Career programmers who are competent but not driven. Dabblers who think they know more than they do and like the idea of a career in programming. Finally, expert coders who like to do programming in their spare time. This latter category challenges themselves and are passionate about learning their craft. So, I ask about pet programming projects and (in part) judge them on the complexity of that project. If its online, I want to see it - are you concerned about UI and esthetics?

So, think about the job itself and put yourself in the hiring person's perspective. What skill sets do you want them to have? What people skills? If you can narrow those down, you'll have a clearer understanding of what they might ask.
 

trevorde

macrumors newbie
Mar 16, 2011
29
0
Trick Question!

You have no idea how many people fail the FizzBuzz test.

I was asked this question and pointed out that one solution would be to have a lookup table for the result since, in my case, the maximum number was 100 ie the problem domain is bounded.

The same comment applies to finding a prime number greater than x. The set of prime numbers is well known (for all practical purposes), so a simple lookup table is sufficient.

I didn't get the job.
 

RIRedinPA

macrumors newbie
May 18, 2011
5
0
2. Save the suit for weddings and funerals. Seriously, wearing a suit to a programming job interview will actually knock you down a bit. In most places, there will be some concern that you will not fit in, especially if (as is common) there will be peers among the interviewers. Strike some happy medium between a suit and shorts and sandals.

That's not particularly good advice. Do some due diligence on the company you are applying to, if it is a financial services firm, insurance or some other highly conservative field then the suit should not harm you at all and not wearing one might be a huge detraction. I have 3 options for interviews: Suit, Jacket no tie, business casual. Never make the assumption because the work environment is super casual you should come in for a interview in cutoffs and flip flops.

The poster is right though that fitting in to the environment is critical. Only 11% of people that get relieved of their position in the first 12 months are let go for lack of technical skills, the rest is because they did not fit it with the companies culture or play nice in the sand box.

However, I can tell you, from experience in being on both ends of the interview gun that those conducting the interview will be able to tell within a few minutes if you'll fit in. How someone dresses is less of a concern to me than how well they can do the job and get along with others.

Here's a few other tips: If this is the technical interview, where the head of the department and a few of his team members are there prepare for the team members to throw out obscure programming references which you will probably never heard of or use. This doesn't mean people will do it but my experience is that some people take this as an opportunity to show off in front of the boss. Just be expectant of that. When you get one of those questions don't panic and don't be afraid to say you don't know. It's how you handle not knowing something that is more revealing...one of the things I loved doing was throwing it back at Johnny Smartpants, something like, "I've never heard of that or worked with it but that sounds pretty interesting, could you explain it?" Half the time what they were talking of I had done but we called it something different.

Be enthusiastic. And know their company. If it is not a software development firm accept that you are a cost to the company and your clients are going to be all internal. Your not there to be some smart ass programmer with a God attitude but to help the folks in sales/marketing/some other business unit/ get their job done. (Yeah, we're smarter, just keep that attitude on the inside ; ) ).
 

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
I was asked this question and pointed out that one solution would be to have a lookup table for the result since, in my case, the maximum number was 100 ie the problem domain is bounded.

The same comment applies to finding a prime number greater than x. The set of prime numbers is well known (for all practical purposes), so a simple lookup table is sufficient.

I didn't get the job.

A lookup table isn't necessarily a good solution even if the set of numbers is bounded, because you still have to create the table. So if you only need to do the operation once, creating a table to do it is probably a waste. If it needs to happen many times, then a table can save you time (at the expense of memory).

Being able to reason about different solutions like this is probably an important skill to have for an interview.
 

robvas

macrumors 68040
Mar 29, 2009
3,240
629
USA
Is this a joke? Wear a suit to ALL professional interviews.

Not programming jobs - unless it's a position at a bank, consulting firm, or some place that will be formal. I probably wouldn't even want to work anywhere that requires their programmers to wear suits.

We tell our interviewees to just dress casual. We'd rather they come in ready to talk about programming and not worry if they are dressed up enough.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.