U.S. CitiesCity-Data Forum Index
Go Back   City-Data Forum > General Forums > Work and Employment > Job Search
 [Register]
Please register to participate in our discussions with 2 million other members - it's free and quick! Some forums can only be seen by registered members. After you create your account, you'll be able to customize options and access all our 15,000 new posts/day with fewer ads.
View detailed profile (Advanced) or search
site with Google Custom Search

Search Forums  (Advanced)
Reply Start New Thread
 
Old 07-13-2013, 02:11 PM
 
15,626 posts, read 13,599,726 times
Reputation: 21485

Advertisements

I had an interview once for a tech position, building upon my military experience; aced the written exam, the two interviewers had no clue what they were doing though they were the same job title I was applying for, made the interview rather difficult when trying to answer questions to people who do not know anything about the subject. No, did not get the job, was told right there after the interview. Matter of fact, when I asked about what part was the problem, the manager guy says he cannot coach, but stated because of my answer to blah blah question; in which i replied the interviewers never even asked me that question or close to it (not even a job related question). Ridiculous the whole thing was and a waste of my time and money as it was an eight hour trip and a hotel stay for the interview.
Reply With Quote Quick reply to this message

 
Old 07-13-2013, 04:20 PM
 
Location: Richmond, VA
2,709 posts, read 4,667,150 times
Reputation: 4394
Quote:
Originally Posted by ackmondual View Post
Hmm, my programming is a bit rusty, but AFAIK, if the arrays are sorted in ascending or descending order...
--if you know how many elements are in each array (say "max") and the first index is 0, then?:
max / 2;

* don't know if it's an even number. AFAIK, there is no median if the number of elements are even?
Whoops! my psuedocode sucked...back in a little while with a real answer.
Reply With Quote Quick reply to this message
 
Old 07-13-2013, 04:32 PM
 
75 posts, read 282,896 times
Reputation: 86
Quote:
Originally Posted by GlitteringPrizes View Post
lol I'd never seen this problem and I used a method which does work. I felt good about myself for coming up with it on the spot, even if there is a better way. The funny thing is that he sat there for 20 minutes watching me think aloud as my put together my method .... then I asked if it was sufficient and he said, "No, it's completely wrong."

My procedure, which I explained on the whiteboard:

Suppose we have two arrays,

A = {a(1), a(2), ..., a(m)},
B = {b(1), b(2), ..., b(n)},


with

a(1) ≤ a(2) ≤ ... ≤ a(m),
b(1) ≤ b(2) ≤ ... ≤ b(n)
.

Set V = min{a(1), a(2)} and count = 1. We iterate until count = (n+m)/2 (where I'm using (n+m)/2 to mean what it means in code language ... the integer division with no remainder part).

If V = a(2) = a(1), then count++ and V = a(2).
If V = a(2) > a(1), then check whether b(1) .......... blah blah blah.
This is not a question that you should have had to think about for 20 minutes. I'd be pretty irritated with you after watching you think for 5 minutes. This is a seriously soft-ball question that a kid with one intro class under his belt should be able to tackle with little thought, though I guess I get the stress factor could clog your brain.

Last edited by Never Quit; 07-13-2013 at 04:53 PM..
Reply With Quote Quick reply to this message
 
Old 07-13-2013, 05:30 PM
 
218 posts, read 248,990 times
Reputation: 168
Quote:
Originally Posted by Never Quit View Post
This is not a question that you should have had to think about for 20 minutes. I'd be pretty irritated with you after watching you think for 5 minutes. This is a seriously soft-ball question that a kid with one intro class under his belt should be able to tackle with little thought, though I guess I get the stress factor could clog your brain.
I misinterpreted the problem, now that I think about it. I was assuming there could be repeated elements. And you really think that's a softball question? Guess I'm dumber than I thought.
Reply With Quote Quick reply to this message
 
Old 07-13-2013, 11:34 PM
 
262 posts, read 554,649 times
Reputation: 215
I'm sure Mcdonalds is hiring
Reply With Quote Quick reply to this message
 
Old 07-14-2013, 12:26 AM
FBJ
 
Location: Tall Building down by the river
39,615 posts, read 50,422,053 times
Reputation: 9451
Quote:
Originally Posted by GlitteringPrizes View Post
God ..... that was awful. I got completely drilled by two different technical interviewers, one after the other, and then the recruiter lady came in the room next and told me they were gonna cut the interview process short because I had failed.

I have no idea what I did wrong!!!!!!!!!!!!!

The second guy asked me how to find the median of two sorted arrays. I described two different procedures and he told me I was "completely wrong." He was like staring at me with embarrassment. What the ****? I don't think there's any way that the other interviewees had a better answer than I did. I have no idea what they were looking lol


Well all been there and the key is just to learn from it so you can do the opposite on the next interview.
Reply With Quote Quick reply to this message
 
Old 07-14-2013, 01:28 AM
 
75 posts, read 282,896 times
Reputation: 86
Quote:
Originally Posted by GlitteringPrizes View Post
I misinterpreted the problem, now that I think about it. I was assuming there could be repeated elements. And you really think that's a softball question? Guess I'm dumber than I thought.
Assuming you are talking about the general case, the fact that there are repeated elements or not is irrelevant when you are looking for the median, and repeating elements should have zero bearing on a correct solution. The median means specifically the number in the center of the ordered list, and turning this into a set could certainly find you a wrong answer.

You are also assuming, quite wrongly, that each list is equal in size and that a[1] <= b[1] and that all a[1] is less that all b[2:], which is also false. You may well have an empty list or one list with one element and another list with 100 elements.

Yes, I consider this a softball question. Struggling with this question when you are seeking a job as a programmer is unreasonable. If you can't see what algorithms this question resembles, what is going to happen when you are facing a very difficult problem or what is going to happen when you are facing a file that has 1000 LOC? How can you tie all of that together? Are you going to write

def median_without_repeating_elements(L = []): ...

def median_with_repeating_elements(L = []): .....

def median_of_two_lists_with_repeating_elements(L = []): ....

def median_of_two_elements_without_repeating_elements_ but_are_uneven_in_size(L = [], M = []): ....

and then keep on writing a new function for every case you encounter? What do you think your coworkers will say when your function blows up because you didn't take the time to write for the general use case?
Reply With Quote Quick reply to this message
 
Old 07-14-2013, 02:03 AM
 
36 posts, read 56,042 times
Reputation: 75
Quote:
Originally Posted by Never Quit View Post
Yes, I consider this a softball question. Struggling with this question when you are seeking a job as a programmer is unreasonable. If you can't see what algorithms this question resembles, what is going to happen when you are facing a very difficult problem or what is going to happen when you are facing a file that has 1000 LOC? How can you tie all of that together?
While I already posted earlier that the OP should probably brush up/learn algorithms and data structures, you do sound condescending and even wrong.
1) These type of questions test mostly formal education. And while I encourage people to learn cs fundamentals, I personally know people with math/physics background who didn't take cs courses in college and probably don't know how to implement heap sort and the like, but are kick ass developers. Likewise where are plenty of cs graduates who can do quicksort quickly on the white board, but cannot program at all.
2) I can guarantee that more than 90% development jobs do not involve algorithmic work at all. Yes, you'll still be solving hard problems, but most likely they won't involve discussion or consideration of algorithm complexity.
3) 1000 lines of code in one file? Sounds like someone needs to read the Fowler's book on refactoring one more time. Wow, I hope the OP will get a better job than the one you describe.
Reply With Quote Quick reply to this message
 
Old 07-14-2013, 02:56 AM
 
75 posts, read 282,896 times
Reputation: 86
What is surprising is the OP's insistence that there was no way he was wrong and his utter disbelief that there could have been a better answer, and then I told him how he was wrong and why he was wrong, and why there could be better answers. His response to me that he coded with the assumption that there were repeating elements revealed that he still hasn't really thought the problem through. I'm sort of mystified that he came here to complain before looking online and seeing where he may have gone wrong.

I've had one programming job and I thought I did pretty bad on the interview. The interview really tested my ability to think through problems, and that is what I would take these kinds of question to mean, not always a test of classical CS education. I would simply assume that the interviewer only wants to see how he thinks through the problem and how he approaches the problem. I would think the interviewer knew what kind of education the OP had. Whether you are doing algorithms at the job or not isn't relevant to your ability to think.

I'm not classically trained either.
Reply With Quote Quick reply to this message
 
Old 07-14-2013, 03:57 AM
 
Location: Washington State
18,770 posts, read 9,675,098 times
Reputation: 15981
My wife was interviewed and the interviewer comes in and says "well our company is known for long hours and low pay" to which she replied "well this interview is over then."
Reply With Quote Quick reply to this message
Please register to post and access all features of our very popular forum. It is free and quick. Over $68,000 in prizes has already been given out to active posters on our forum. Additional giveaways are planned.

Detailed information about all U.S. cities, counties, and zip codes on our site: City-data.com.


Reply
Please update this thread with any new information or opinions. This open thread is still read by thousands of people, so we encourage all additional points of view.

Quick Reply
Message:

Over $104,000 in prizes was already given out to active posters on our forum and additional giveaways are planned!

Go Back   City-Data Forum > General Forums > Work and Employment > Job Search
Follow City-Data.com founder on our Forum or

All times are GMT -6.

2005-2019, Advameg, Inc. · Please obey Forum Rules · Terms of Use and Privacy Policy · Bug Bounty

City-Data.com - Archive 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 - Top