|
JawnV6 posted:Wait, rather than let you handwave for your entire time, you were expected to write code and talk about it? Oh how dreadful. I don't understand what you are talking about. Let's say the interviewer asks me a basic question like "Given a sorted array and an int k, find two numbers whose sum is equal to k." This was asked of me in a real interview a few months ago, and I went "Okay, this problem can be solved by choosing every pair of ints checking if it's equal to k. This will solve the problem, but it runs in O(n^2), which is abysmal. "Another way to solve it is if I use a set of "Numbers that I'm looking for", and iterate over the array. Whenever I see a number i in the array I put k - i in the set, and if I ever iterate over an element that exists in the set I've found my numbers. This is O(n) runtime but I now also have to use O(n) space because of the set. "Can I use less space? Well I've still not used the sortedness of my array to my advantage. So if I use two "pointers", one at the start of the array, and one at the end, I can create a window that shrinks until it points to the numbers I want, or eventually disappears. If left + right == k, we're done. If left + right > k, then right--; if left + right < k, then left++. If left >= right, then we're done. "This uses no extra space, and I "look" at every element in the array at most once, so the runtime is O(n). Since I must look at every element at least once in a worst case scenario, I don't think I can do better than that." This is before I code a single thing on the board. If the interviewer stops me and forces me to write the first two answers before letting me to write the last one, I just think it's a waste of my time. Also if I can finish the problem quickly enough he can maybe ask a different version of the problem, for example a case where I can use a number multiple times and need to find the pair whose sum is closest to k instead of just equal.
|
# ? Jul 24, 2016 19:57 |
|
|
# ? May 11, 2024 15:03 |
|
Ok, when giving 2sum as a problem you generally start with the unsorted array being passed in since there's an O(n) solution after sorting, so it's kinda asinine to be given the simpler version to start off. But an interview is very limited time and for a lot of places establishing that someone has actually coded and can do it again is what they need to do. I've interviewed people who could say all the right things and couldn't emit a C function signature. If you've never given one of these interviews, count yourself lucky, but acting like you're above it is precisely what the fakers do. Specifically:UnfurledSails posted:"Can I use less space? Well I've still not used the sortedness of my array to my advantage. So if I use two "pointers", one at the start of the array, and one at the end, I can create a window that shrinks until it points to the numbers I want, or eventually disappears. If left + right == k, we're done. If left + right > k, then right--; if left + right < k, then left++. If left >= right, then we're done. UnfurledSails posted:I actually got rejected from a company because "This is a fast paced startup environment, and we prefer people who answer questions as quickly as possible and move on instead of trying to figure out if there is a better answer."
|
# ? Jul 24, 2016 20:21 |
|
"Indices." And the right answer to the question is to say that you've heard it before, if you have. And then if they want you to solve it anyway, just give them the best answer. Get it over with so you have more time with the next question. And if you fake reasoning through it I'll think you're a phony.
|
# ? Jul 24, 2016 21:36 |
|
Indexes is instant rejection.
|
# ? Jul 24, 2016 22:05 |
|
JawnV6 posted:Ok, when giving 2sum as a problem you generally start with the unsorted array being passed in since there's an O(n) solution after sorting, so it's kinda asinine to be given the simpler version to start off. But an interview is very limited time and for a lot of places establishing that someone has actually coded and can do it again is what they need to do. I've interviewed people who could say all the right things and couldn't emit a C function signature. If you've never given one of these interviews, count yourself lucky, but acting like you're above it is precisely what the fakers do. Specifically: I can't argue with anything you've said here, although I cannot fathom how the kind of people who can't even code up a C function signature got to the on-site stage to begin with. How do they pass the phone screens? I also remember getting called on mixing indexes (ahem, "indices") and pointers in that interview, and it led to a discussion about instances where actually having pointers would be justified, which was fun. I probably shouldn't have gotten the on-site for the startup in the first place; they were clearly not looking for someone who had so little work experience. sarehu posted:"Indices." I had two interviews where I was asked 2sum. First time I saw it, I told him I remember doing it before, but the interviewer wanted me to prove it and give him specifically 3 different ways to do it, so I went through what I said above. I guess he didn't have any other questions prepared? The second time was much more interesting and fun because the interviewer made some interesting alterations to the question and then kept altering and making it harder every time I told him how I would solve it, eventually telling me to code up the last one in the last 15 minutes.
|
# ? Jul 24, 2016 22:13 |
|
UnfurledSails posted:I can't argue with anything you've said here, although I cannot fathom how the kind of people who can't even code up a C function signature got to the on-site stage to begin with. How do they pass the phone screens? UnfurledSails posted:I also remember getting called on mixing indexes (ahem, "indices") and pointers in that interview, and it led to a discussion about instances where actually having pointers would be justified, which was fun. In general I'd trust that the interviewer is being honest with their line of questioning and starting to code at the point they ask won't be held against you.
|
# ? Jul 25, 2016 03:58 |
|
Am I wildly crazy to imagine that someone applying for a senior developer position with nearly 20 years of experience should probably be able to code, from scratch, on a whiteboard, a basic 'count the number of times each letter occurs in a string' method - that works and is functional?
|
# ? Aug 9, 2016 19:51 |
|
That sounds like a problem you'd pose to a junior developer. Perhaps the guy applying for senior dev had not worked with strings in a long time? That's no excuse for not getting the gist of an algorithm, though.
|
# ? Aug 9, 2016 19:58 |
|
Sounds easy to me
|
# ? Aug 9, 2016 19:58 |
|
I'd think an imperative solution would be acceptable.
|
# ? Aug 9, 2016 20:01 |
|
I didn't ask the question, one of the other team members had before I got there and it was already whiteboarded. It looked ROUGHLY like: code:
I wonder about the micro-optimization around the length. I asked him about why the Map uses a string as its key type, and he tries to school me about 'generics'. I'm like yes but why string and not char? He kind of trips up and when I offer "Does Java just treat individual letters as strings, so a string is just a collection of strings?" He jumps to agree. Weird, but...ok? I wonder why he uses the iterator directly to index the map - if I'm not mistaken it might be a compile-time error(or provide erroneous results) since at least with C#'s implementation of Dictionary, you get yelled at that int isn't string. I wonder how, even supposing that worked, this would ever not return an empty map, since each letter-key would not exist at first, and therefore wouldn't be incremented. Cuntpunch fucked around with this message at 20:30 on Aug 9, 2016 |
# ? Aug 9, 2016 20:25 |
|
Cuntpunch posted:Am I wildly crazy to imagine that someone applying for a senior developer position with nearly 20 years of experience should probably be able to code, from scratch, on a whiteboard, a basic 'count the number of times each letter occurs in a string' method - that works and is functional? Are you taking off for missing a semicolon or w/e? Because I'm prone to that on a whiteboard. Not that anyone shouldn't be able to come up with this in like 5 minutes.. code:
So no, you're not wildly crazy. The people that are applying for the position very well may be though.
|
# ? Aug 9, 2016 20:33 |
|
Cuntpunch posted:
|
# ? Aug 9, 2016 22:05 |
|
Klades posted:Even better, if you've represented this accurately all it does is make a new HashMap, then increment the first six elements of that map if they exist, which they don't because it's a fresh, empty map. I can't fathom that Java's HashMap supports lookup-by-index, since it seems like that would cause a conflict when, say, an int *is* your key but things have been added out-of-order? The only 'liberty' I took with this code is that the scribbling on the board had done some other method call(to an unimplemented method) to do the incrementing - and that I *think* the nullcheck was using a method call(probably similar to C#'s .ContainsKey()) - but the handwriting was bad enough and the intent, I think, clear(although wrong). While on the topic, when I tried to ask about the different types of References that Java supports, and when you might use them, he wasn't sure what I meant. So I referenced the new HashMap() in his code and noted it was a strong reference. TO which he began explaining Strong and Weak typing to me. (I think he probably meant to try and talk about explicit/implicit, even if that was on-topic). Cuntpunch fucked around with this message at 22:48 on Aug 9, 2016 |
# ? Aug 9, 2016 22:46 |
|
I interviewed somebody senior once and, being new, decided to overlook the use of a hashtable<int,T> where the ints were clearly contiguous in [0,n) and an array would be perfectly good. Now I know: It's not okay for code to have that old person smell. If you can't remember basic coding stuff then you don't have the memory capacity to take advantage of the experience that you have.
|
# ? Aug 9, 2016 22:48 |
|
sarehu posted:I interviewed somebody senior once and, being new, decided to overlook the use of a hashtable<int,T> where the ints were clearly contiguous in [0,n) and an array would be perfectly good. Now I know: It's not okay for code to have that old person smell. If you can't remember basic coding stuff then you don't have the memory capacity to take advantage of the experience that you have. Yeah this really just added up. Beyond the weirdness around Java's referencing(Strong/Weak/Soft/Phantom), he was also a little bit concerningly vague about IOC strategies - he was able to name 'Dependency Injection' but when pressed for some specifics, couldn't quite define Constructor/Property Injection, Service Location, not even just using a Factory(from a Java dev!) Along with other random bullet points on his resume, I tried to ask for a bit of a differential opinion with related tech. Why Angular over other things? Why would you use Mongo instead of traditional DBs? When is node appropriate rather than something like Apache? He just kind of...it was quick StackOverflow level quips rather than what I'd have liked/expected, which is at least one or two very serious "here is the razor used to decide when this tech is appropriate to the solution" points. I guess for a guy who talked up how much he was just fascinated by the tech - how he spent lots of his personal time working with and around it, it just felt very weird to not be able to get into a *technical discussion*.
|
# ? Aug 9, 2016 23:00 |
|
Cuntpunch posted:I guess for a guy who talked up how much he was just fascinated by the tech - how he spent lots of his personal time working with and around it, it just felt very weird to not be able to get into a *technical discussion*. In my experience this scenario isn't that unusual when it comes to interviewing. The "fascinated by tech" story is easy to fabricate when you're trying to show that you're not just another worker drone, you're really interested. Good for you for probing deeper into things and discovering that it was masking a lack of depth.
|
# ? Aug 10, 2016 13:44 |
|
Cuntpunch posted:I guess for a guy who talked up how much he was just fascinated by the tech - how he spent lots of his personal time working with and around it, it just felt very weird to not be able to get into a *technical discussion*. I work with a guy who is (honestly) fascinated by tech and enthusiastic about working with it and has been in the business for like 30 years and he's just hopeless. I draw him a diagram: "these 4 services are running on every one of our machines. We have 4 machines and they are configured exactly the same way." He spends the rest of the week SSHing to each machine and being puzzled that they all look the same. Then the next week he asks me where our services run. His supervisor is not concerned.
|
# ? Aug 11, 2016 01:40 |
|
Why node vs Apache though
|
# ? Aug 11, 2016 03:46 |
|
FamDav posted:Why node vs Apache though Because he wanted to talk about his personal projects which largely involved a MEAN stack(everything except Express was listed on his resume as a bulletpoint). Also because it was listed next to the usual HTML5/JavaScript/CSS bulletpoint. So we're specifically talking using it as an HTTP endpoint, at which point why not ask it - especially when he lists a bunch of other Apache projects like Camel and Ant on his tech. There's no right answer - I'm not a fan of factoid based interviewing, I'd prefer to have a discussion - but I'd expect some sort of answer other than "Well, Node is really fast because of the event, uh, uh, gosh what is it called, I can't think of the name right now"
|
# ? Aug 11, 2016 12:53 |
|
Cuntpunch posted:It looked ROUGHLY like: At least you got something almost resembling a (in)correct answer. I once asked a candidate to write a few basic statistical functions (mean, median) -- and I provided the formula -- with some unit tests. In 45+ minutes, there wasn't a program that would compile or even the basic start of a correct function. This was a guy who sounded pretty convincing and confident during the high-level-talking stage. Once keys hit keyboard, that confidence just completely evaporated.
|
# ? Aug 12, 2016 15:39 |
|
I'm looking at four on-site coding interviews in the coming week all in startups of various descriptions I've managed to go through three languages in one coderpad screen already because I didn't want to touch a nested array of arrays of arrays in <language-of-choice>. One of them is a second on-site but with different people, only 2 hours
|
# ? Aug 12, 2016 17:41 |
|
Now's the time to get ambitious with the salary requirements!
|
# ? Aug 12, 2016 17:55 |
|
Received a random call at 2pm which was an hour long tech screen before a planned one at 4:30. I do not understand how this code actually appears to produce the correct results, the calculation of maximum cost is weird. I am dangerous with algos.Java code:
|
# ? Aug 12, 2016 22:41 |
|
MrMoo posted:Received a random call at 2pm which was an hour long tech screen before a planned one at 4:30. I do not understand how this code actually appears to produce the correct results, the calculation of maximum cost is weird. I am dangerous with algos. You sure that call wasn't at 2AM? I refuse to believe this code actually works.
|
# ? Aug 13, 2016 02:02 |
|
Check it out: https://is.gd/OMjCsI
|
# ? Aug 13, 2016 02:23 |
|
MrMoo posted:Check it out: https://is.gd/OMjCsI Is it supposed to return the high-water-mark for total cost of running jobs at any time during the schedule? Because it doesn't do that. Try with two jobs: the first that starts at 1, ends at 2, and has cost 100; the second that starts at 3 and ends at 4, and has cost 1. The algorithm you posted will return 1.
|
# ? Aug 13, 2016 02:35 |
|
ShoulderDaemon posted:Is it supposed to return the high-water-mark for total cost of running jobs at any time during the schedule? Yes, I have three very bad options so far and they're not really getting better. The idea with this version is to walk through a (sorted) list of time events and increment the cost as each job starts and decrement as they end. MrMoo fucked around with this message at 02:39 on Aug 13, 2016 |
# ? Aug 13, 2016 02:36 |
|
MrMoo posted:Yes, I have three very bad options so far and they're not really getting better. The idea with this version is to walk through a sorted list of time events and increment the cost as each job starts and decrement as they end. Your "max_cost" variable should actually be called "current_total_cost", if that helps. Once you have that, maximizing should be easy.
|
# ? Aug 13, 2016 02:39 |
|
Ok, looks a bit better now. Still seems odd I never have to do much with the begin time but as they only have to overlap for at least one time unit it works.Java code:
|
# ? Aug 13, 2016 02:47 |
|
MrMoo posted:Ok, looks a bit better now. Still seems odd I never have to do much with the begin time but as they only have to overlap for at least one time unit it works. Java code:
|
# ? Aug 13, 2016 05:20 |
|
Ooh, yes that brings better clarity, thanks "Linus Torvalds". As a polyglot I start with the lowest common denominator and see a big warning about invalidating the iterator on the collection on the remove(). Per the documentation that should fail with an ArrayList instead of a synchronized Vector because the modification is outside the implicit iterator of the foreach loop.
MrMoo fucked around with this message at 16:51 on Aug 13, 2016 |
# ? Aug 13, 2016 16:01 |
|
MrMoo posted:Ooh, yes that brings better clarity, thanks "Linus Torvalds". As a polyglot I start with the lowest common denominator and see a big warning about invalidating the iterator on the collection on the remove(). Per the documentation that should fail with an ArrayList instead of a synchronized Vector because the modification is outside the implicit iterator of the foreach loop. Yeah, you should really be just using iterator.remove().
|
# ? Aug 13, 2016 19:41 |
|
I guess they liked it as they are lining up another interview Another company said I "crushed it", giving a JavaScript answer of all things. Today I had a pretty quick 30 minute interview which was a weird set of fast questions on C++11 including "what is the most misfortunate feature of C++11?" idk I was interviewed on C++11 by a vendor of the company I am actually applying to and which are a Java house and the interviewer in question is a networking engineer
|
# ? Aug 16, 2016 02:49 |
|
MrMoo posted:I guess they liked it as they are lining up another interview Another company said I "crushed it", giving a JavaScript answer of all things. Question is so easy if you're familiar with C++11. Just spitballing what you like or don't about it. I should read what's all in 17 now you mention it. Do you have C++ on your resume?
|
# ? Aug 16, 2016 13:31 |
|
Well I don't like the lack of make_unique and that was fixed in C++14, but the implication was on a mistake in the release, I know the bits I like as they make things better. I think the question was looking for acquire/release semantics around volatile I use C++14 but I'm no expert on templates, more critically I say I'm not a Java developer either but this is a Java developer role, ha. MrMoo fucked around with this message at 13:58 on Aug 16, 2016 |
# ? Aug 16, 2016 13:54 |
|
I know C++ pretty well, but would struggle with that question, assuming it means "features that are in C++11 and not in prior releases". Maybe I'd go for: - The introduction of std::bind, which was almost wholly useless even in C++11 and is entirely useless in C++14; - Personal taste - I don't like that std::thread begins executing on construction (edit: ah - apparently this might be a necessity on some platforms); - The standardisation of the clunkier e.g std::enable_if<T>::type rather than C++14's less clunky e.g. std::enable_if_t<T>; - Making constexpr methods implicitly const (rescinded in C++14). GeneralZod fucked around with this message at 14:14 on Aug 16, 2016 |
# ? Aug 16, 2016 14:00 |
|
Std::bind owns when used with objective c++
|
# ? Aug 16, 2016 14:29 |
|
MrMoo posted:"what is the most misfortunate feature of C++11?" idk Let me tell you about std::memory_order_consume and friends. It was underspecified, impractical and possibly unimplementable. IIRC it is being fixed in C++17 (or maybe it was already fixed in C++14, I prefer to keep myself to sequentially consistent atomic variables, unless absolutely necessary). Also, std::bind is actually from TR1, predating C++11 by quite a lot.
|
# ? Aug 16, 2016 16:56 |
|
|
# ? May 11, 2024 15:03 |
|
Oh yay I have a five round interview in Philly on Thursday and another five rounder in Manhattan on Friday, and these are supposed to be small startups. One of the rounds is a debugging session which admittedly sounds pretty cool, another one slightly concerning is called a "behavioral interview".
|
# ? Aug 17, 2016 01:40 |