PDA

View Full Version : Programming job interview (again). Anyone have any unique questions or advice?




chrono1081
Mar 13, 2012, 08:53 PM
Hi guys,

I'm not sure if anyone remembers or not but I blew an interview back in September (mostly because I couldn't hear the interviewer, and partially because it caught me off guard and I wasn't prepared for the interview).

Well, I have since graduated college, have been working on my programming skill set, and managed to pass an initial interview for an application developer position.

I have a large pool of standard questions I have been practicing, I will be buying a suit this week (I do not have one), and will be doing practice interviews until the interview date.

My question is does anyone have any additional advice for an interview for a programming position? Perhaps a strange question you were asked?



GorillaPaws
Mar 13, 2012, 09:02 PM
I have never interviewed for a programming position, but I have interviewed candidates for other jobs in an unrelated field. I can say that interviewees that ask me good questions about our company get put in the good stack. I would be tempted to ask them about their coding philosophy, if they use pair coding, or agile practices etc. and why that approach works for them. I'm sure you'll get lots of other code-related answers here too, but I thought I'd chime in to share my (non-coding) perspective.

jtara
Mar 13, 2012, 10:43 PM
1. Start solving a real problem right in the interview. May not be applicable for an entry-level position, though. What I mean is, identify a problem or some future development that they have planned, and offer your solution or make suggestions as to how you would solve or implement it. I've done mostly contracting, so I am hired to do a particular job. I find the most effective interview technique is to act as if I've already been hired, and just dig into the solution. Particularly if the interviewer is a peer, they will at that point forget that they are conducting an interview. It's then just a matter of showing that you're being there is going to make their job easier, because you "get it".

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.

Sander
Mar 14, 2012, 03:12 AM
You should also be prepared for non-technical questions. Some interviewers like to ask you "Where do you see yourself five years from now" and "Name a situation where you solved a problem using persuasion".

If I'm the one interviewing you, you'd score extra points by just staring at me and saying "... dude." I'll apologize and say they make me ask this stuff, and quickly get back to nested templates and your knowledge of C++11.

WebMongol
Mar 14, 2012, 03:30 AM
My question is does anyone have any additional advice for an interview for a programming position? Perhaps a strange question you were asked?

Be ready to write code on a whiteboard. It's tough and requires some practice. You can find typical questions in list below. In general, you are expected to come up with optimal algorithm and implementation in 20 minutes. Quadratic run time is not good enough. Usually you need to come with O(N) or O(NlogN) solution.
Good luck!

General
Given two arrays, print all common elements. Small array size is M, and large array size is N (M << N)

Given a list, return the first pair of duplicates in the list

Given an array of N numbers, and a number T, find out whether there are two numbers from the N numbers sums up to the number T. Find out ALL solutions to the problem and analyze the run times.

Given 64K-1 numbers [0..64K-1] find one missing number.

You have unordered array X of N integers. Find the array M containing N elements where M[i] is the product of all integers in X except for X[i]. You may not use division. You can use extra memory. Solution faster than O(N^2)

For a given sequence of numbers print all increasing subsequences.

Given an array of integers (both positive and negative) divide the array into two parts (sub-arrays) such that the difference between the sum of elements in each array is minimum?

Linked Lists

Implement basic operations for singly linked list: push_front, push_back, delete, tail, size, pop_front, find

Implement following operations for singly linked list: count, at, insert_at, insert_after

Reverse linked list in place

Find loop in linked list. Find length of the cycle. (Floyd's cycle-finding algorithm)

Write a function to find the middle node of the a singly-linked list

Write a function to copy list to new list and return pointer to head of the new list

Probability

You have a stream of infinite queries (i.e: real time search queries that people are entering). Describe how you would go about finding a good estimate of 1000 samples from this never ending set of data and then write code for it.

Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.

Write function to select random sample of size M from a stream of numbers.

Write function to select random sample of size M from a set of numbers of size N.

Write function to random shuffle array a.

KnightWRX
Mar 14, 2012, 04:11 AM
1- Don't be nervous. The best way not to be nervous is to be in the "they need me more than I need them" or the "Why don't they convince me to work for them" mindset.

2- Over preparing, rehearsing and all that crap will make you nervous, thus fail at 1.

Everything else, just be yourself. Don't study, don't rehearse. Just sit down, let them ask their stuff, then ask a lot of questions about the positions, the working conditions and the salary and benefits.

chrono1081
Mar 15, 2012, 01:39 PM
Thanks guys for all the tips and advice :)

@KnightWRX I actually did that before and it worked wonders! I ended up negotiating a significant pay raise during my interview. They hired me on the spot even though I know at least one other candidate was "technically" more qualified (he had a degree and I didn't).

The other guy I mentioned at the interview was actually a coworker who told everyone at work he saw me at an interview. Good thing I got the job ;)

jenny2765
Nov 1, 2012, 09:01 PM
I have some questions. I hope it's useful for me.
1.what is the first thing that people notice about you?
2.What are your three BEST life skills?
3.What’s the most important thing you’re looking for in another person?
4.What are 5 things you “can’t live without?”

dynafrom
Nov 1, 2012, 09:22 PM
1. Start solving a real problem right in the interview. May not be applicable for an entry-level position, though. What I mean is, identify a problem or some future development that they have planned, and offer your solution or make suggestions as to how you would solve or implement it. I've done mostly contracting, so I am hired to do a particular job. I find the most effective interview technique is to act as if I've already been hired, and just dig into the solution. Particularly if the interviewer is a peer, they will at that point forget that they are conducting an interview. It's then just a matter of showing that you're being there is going to make their job easier, because you "get it".

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.


Is this a joke? Wear a suit to ALL professional interviews.

Kranchammer
Nov 2, 2012, 11:27 AM
Be ready to write code on a whiteboard. It's tough and requires some practice. You can find typical questions in list below. In general, you are expected to come up with optimal algorithm and implementation in 20 minutes. Quadratic run time is not good enough. Usually you need to come with O(N) or O(NlogN) solution.
Good luck!

General
Given two arrays, print all common elements. Small array size is M, and large array size is N (M << N)

Given a list, return the first pair of duplicates in the list

Given an array of N numbers, and a number T, find out whether there are two numbers from the N numbers sums up to the number T. Find out ALL solutions to the problem and analyze the run times.

Given 64K-1 numbers [0..64K-1] find one missing number.

You have unordered array X of N integers. Find the array M containing N elements where M[i] is the product of all integers in X except for X[i]. You may not use division. You can use extra memory. Solution faster than O(N^2)

For a given sequence of numbers print all increasing subsequences.

Given an array of integers (both positive and negative) divide the array into two parts (sub-arrays) such that the difference between the sum of elements in each array is minimum?

Linked Lists

Implement basic operations for singly linked list: push_front, push_back, delete, tail, size, pop_front, find

Implement following operations for singly linked list: count, at, insert_at, insert_after

Reverse linked list in place

Find loop in linked list. Find length of the cycle. (Floyd's cycle-finding algorithm)

Write a function to find the middle node of the a singly-linked list

Write a function to copy list to new list and return pointer to head of the new list

Probability

You have a stream of infinite queries (i.e: real time search queries that people are entering). Describe how you would go about finding a good estimate of 1000 samples from this never ending set of data and then write code for it.

Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.

Write function to select random sample of size M from a stream of numbers.

Write function to select random sample of size M from a set of numbers of size N.

Write function to random shuffle array a.

Would not work for a company that interviewed like that; that tells you exactly nothing about the skills of the interviewee except that they are good at regurgitation.
They should know the CONCEPTS you described of course, but to expect someone to write optimized code on the spot? Dumb.

karlth
Nov 2, 2012, 11:42 AM
Would not work for a company that interviewed like that; that tells you exactly nothing about the skills of the interviewee except that they are good at regurgitation.
They should know the CONCEPTS you described of course, but to expect someone to write optimized code on the spot? Dumb.

Totally agree, unless you are applying for a company that develops algorithm libraries.

AzN1337c0d3r
Nov 2, 2012, 05:51 PM
Totally agree, unless you are applying for a company that develops algorithm libraries.

I also agree.

Unless you are applying for a position where optimization is one of your main duties, writing "clever" solutions like this makes for a maintenance nightmare.

As one of my bosses once said:

Code should be boring to read. The correctness should be immediately obvious to anyone who reads it.

jtara
Nov 7, 2012, 01:33 PM
Is this a joke? Wear a suit to ALL professional interviews.

Not a joke at all.

Find out who is going to be interviewing you. It is common to be interviewed by a manager, somebody from HR, and a group of your peers.

The HR guy is to enforce company rules on hiring.

In many cases, the manager is going to take his cue from his team.

A suit generally is not going to be seen as a plus by your future co-workers. The first thing you are going to get when you walk into the peer interview are going to be glances between them and a few snickers. You will be likely be viewed as inexperienced, naive', "trying too hard", and not a team player.

Wear what you would wear to work. And find out what that is first. And get a better description than "business casual". If you can, hang-out in the parking lot on a day prior to the interview and see what people wear. Wear what the other employees wear on a day when they are well-dressed. (Skip the sandals.)

Persifleur
Nov 7, 2012, 05:54 PM
A suit generally is not going to be seen as a plus by your future co-workers. The first thing you are going to get when you walk into the peer interview are going to be glances between them and a few snickers. You will be likely be viewed as inexperienced, naive', "trying too hard", and not a team player.

Whether this is true or not is very heavily dependent upon the type of company you apply for. I've worked for (and interviewed on behalf of) several companies that had a casual dress policy and I still interviewed in a suit, even though I knew the dress policy beforehand. From my experience, not showing up in a suit will backfire more often than it'll work in your favour.

lee1210
Nov 7, 2012, 07:36 PM
Just to add a data point:
I wore a suit to 4-5 interviews out of college, got 1 offer, and accepted it. Since then I've gone 1 notch higher than what I understand my potential colleagues wear. I've tried to find out from insiders or a recruiter what the folk interviewing will be wearing. If they're in a polo, go Oxford. If they're in an Oxford with unbuttoned collar, add a tie. Pants... I've gone "nice jeans" (odd, I know. Dark/fitted vs. Levi's) or slacks (I hate khakis).

It's always worked for me. I haven't worn a full suit since the first round out of college. If you're totally comfortable in a suit, that's fine, but if you're not comfortable wearing that every day I'd call it false advertising. I think as long as you're at or just above the attire of those interviewing you you're fine. If you're below or way above then they're going to notice, and you don't need that to be what stands out.

-Lee

Mac_Max
Nov 7, 2012, 08:39 PM
Pants and a nice shirt and you should be fine at most non mega-corp types. Slacks and a dress shirt for those.

Being bluntly honest, If a suit is not your normal thing and you're forced to work in one, you're probably at the wrong company... unless they're paying you a huge amount of money and you have kids (and are willing to make the sacrifice for them) or don't plan on staying long. You will not like it and there are tons of software dev jobs where everyone wears t shirts, shorts, and flip flops.

I'd suggest brushing up on basic SQL syntax and DB concepts. I've found that people in general/interviewers appreciate basic questions about databases being answered honestly and without too much fumbling.

If you're interviewing at a web company, understand posts v.s. gets and have at least a "10,000ft concept" of what REST & SOAP APIs are (you don't need to be an expert unless you're advertising yourself as one).

Know what pointers/references are in general. Even if you end up working in a language without raw pointers (i.e. Java, PHP, Perl) most people will expect that you know what those are.

Bring a pad of paper to the interview or have one ready if its a phone interview. I've never been presented a white board. Never. But, for the same reasons that whiteboards are handy to have (scrawl out concepts, work through products, keep your thoughts straight), a pad of paper and pen is good to have as well.

admanimal
Nov 7, 2012, 10:05 PM
I have had recruiters from big tech companies explicitly tell me before the interview NOT to wear a suit, since no one who works there would ever wear that anyway.

I highly recommend this book:

http://www.crackingthecodinginterview.com

milbournosphere
Nov 8, 2012, 12:05 AM
^ You're the second person to recommend that book to me in the past week. I'm going to be picking it up this weekend. I'm about two years out of college with my CS bachelor's degree, and am starting to think about stepping up my career a notch.

I haven't interviewed since my intern days (I was given a full-time position after I graduated), so all this advice is much appreciated. OP, I'm glad the interview went so well.

On the clothing subject...I think a suit would be over-doing it, personally. I would suggest a nice, neutral shirt with a matched tie (simple four-in-hand; a Windsor knot would be too much) and a nice pair of dark slacks. If the company has only 10 employees, you could probably get away with not wearing the tie. It's not a suit, but it's not jeans and a polo, either. To wear anything less would, IMO, show a lack of respect for yourself and the position you're going for. A suit would be going overboard, but I feel that by dressing down, one walks a thin line. I'd rather find myself over-dressed than under-dressed.

admanimal
Nov 8, 2012, 12:23 AM
I think the general rule is that you should dress the way you would expect the nicest dressed person at the position you are applying for at that company would dress.

In most cases for tech jobs, that is going to mean khaki pants and a nice polo shirt, which is exactly what I have heard most recruiters tell people to wear. A more casual buttoned shirt with a tie is certainly reasonable as well.

mslide
Nov 8, 2012, 09:21 AM
Oh geez. Please leave the suit at home. It doesn't belong in an engineering interview. When I see a candidate walk in in a suit, it's hard for me not to automatically dock points. They are usually inexperienced or trying to make themselves look better than they are.

Palad1
Nov 8, 2012, 09:55 AM
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.

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

notjustjay
Nov 8, 2012, 11:28 AM
Oh geez. Please leave the suit at home. It doesn't belong in an engineering interview. When I see a candidate walk in in a suit, it's hard for me not to automatically dock points. They are usually inexperienced or trying to make themselves look better than they are.

The last couple of engineering interviews I did, I wore the suit pants and a dress shirt with a nice tie, but no suit jacket. (I wore my university leather jacket). That seemed to dress down just enough while still looking professional.

mikegrad
Nov 8, 2012, 12:22 PM
You have no idea how many people fail the FizzBuzz test.

im very curious now! since any number can be divided by 3 or 5, im assuming you mean divided with no remainder?

Can you post the solution?

ramy1989
Nov 8, 2012, 01:03 PM
Ok in two minutes I wrote this:


int main(int argc, char** argv)
{
for(int i=1; i<=100;i++)
{
bool printNumber=true;
if(i%3==0)
{
printf("Fizz");
printNumber=false;
}
if(i%5==0)
{
printf("Buzz");
printNumber=false;
}
if(printNumber)
printf("%d",i);
puts("\n");
}
return 0;
}


I tried my best to simplify the code, but I need a bool otherwise I shall write a lot of if-else.
It's not hard, maybe they not choose real programmers.

lee1210
Nov 8, 2012, 01:26 PM
Ok in two minutes I wrote this:


int fizzBuzz(int maxNumber, bool inclusive)
{
int start = inclusive ? 0 : 1;
int end = inclusive ? maxNumber + 1 : maxNumber;
for(int i=start; i<end;i++)
{
printf("%d",i);
if(i%3==0)
{
printf("Fizz");
}
if(i%5==0)
{
printf("Buzz");
}
puts("\n");
}
return 0;
}


I tried my best to simplify the code, but I need a bool otherwise I shall write a lot of if-else.
It's not hard, maybe they not choose real programmers.

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.

ramy1989
Nov 8, 2012, 06:52 PM
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
Nov 8, 2012, 07:14 PM
"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

timhuerta
Nov 8, 2012, 10:58 PM
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
Nov 9, 2012, 08:40 AM
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
Nov 9, 2012, 10:46 AM
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
Nov 9, 2012, 08:37 PM
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
Nov 10, 2012, 12:26 PM
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.