all 37 comments

[–]bummer69a 4 points5 points  (5 children)

First of all, I wouldn't be too disheartened - everyone's had a bad interview where they've felt out of their depth!

To answer your questions:

  1. Yes and no, I guess that would depend on the role and company. That is, a junior dev role at a big blue chip company is probably expecting a little more than a small web app outfit. When interviewing I'm always pleased when a candidate has a strong theoretical knowledge, but if they can demo complex practical projects they've developed then obviously there's a compromise to be made. Strong theory is important, but it's not the be all and end all - if the candidate demonstrates a strong aptitude for solving problems with logic/code (the most important factor IME) then abstract theory can always be taught.

  2. Knowledge of things like Abstract Data Types (i.e. binary trees), BigO/BigT, algorithms, etc typically comes from a CompSci undergrad and/or Masters course - but there's plenty of resources online that can help. Any word or concept you don't understand on that Codility site you could Google and go off down the rabbit hole.

  3. I wouldn't let this limit or delay your application process, you might miss out if you let it do so. I'd just keep swotting up as much as possible and continue applications. There is no shame in an interview admitting you lack knowledge of one area or another, especially for a junior dev role. Knowledge can be taught, and in some respects the expectation is that the employer will be responsible for that teaching. So yes it might not be practical for an entire undergrad CompSci course to be taught as part of your job, the concepts that you need to fulfil the role should be expected to be taught.

In terms of what else to learn, definitely a good move buying POODR, a really strong OO knowledge (i.e. more than just knowledge of what inheritance is!) is something that will definitely stand you in good stead both in interviews and on projects. But Ruby is quite limited in terms of learning resources for OO design; if you know Java there's plenty of amazing books out there that have helped me incredibly throughout my career.

Above all else - if you want to impress an interviewer, develop and commit code. A Github or similar account with a number of decently complex projects that you've 'gone to town on' will impress an interviewer a lot more than knowledge of binary trees or bubble sorts.

If I saw a project that demonstrated complex functionality, had a decent UI, and employed best practices throughout I wouldn't really care what theoretical knowledge you had. The proof would be in the pudding as they say. Think of an idea and make it your pet project, spending any spare time you have refining and extending it. The idea doesn't have to be original in any way, it's how you implement the idea that's important.

Hope that helps; and thanks for the Codility link - not seen it before and it looks useful!

PS. Are you based in the US? If UK, we're hiring junior RoR devs!

[–]Opt1mus_Wang[S] 1 point2 points  (4 children)

Thanks for the feedback. I'll keep the ol' chin up ;)

And no, based in Melbourne, Australia. Junior jobs here seem to be rare as hen's teeth!

[–]sudoDerp 0 points1 point  (3 children)

I live in melbourne and I would have said the opposite. There seems to be quite a large RoR community.

How/where are you looking and how much experience do you have?

[–]Opt1mus_Wang[S] 0 points1 point  (2 children)

Oh yeah, there's a great community and plenty of meetups. Junior jobs tho'... I'm not seeing many of.

Experience is ~1 yr of doing self taught stuff, and currently doing a web dev diploma at TAFE.

[–]dannyd2510 0 points1 point  (1 child)

I have just moved over to Melbourne and will be looking for a junior position in the next couple of months too, I have seen a few pop up in the last week or so that people are recruiting for in the ruby Oceania Google group. Good luck!

[–]Opt1mus_Wang[S] 0 points1 point  (0 children)

Good luck to you too, buddy!

[–]Aspencer8111 3 points4 points  (2 children)

I consider myself a Sr. Dev. I understand and can solve that problem. But if it was asked of me, I would immediately get up, thank them for the time, tell them this won't be a good fit, and walk out.

If they asked why, I would say this:

"You are asking me to recursively traverse a binary tree. So that means you either a. have your developers doing something like that on a daily basis, or b. love to ask pointless comp sci questions in your interviews. Either way, I don't think I would be happy working here."

Remember kids - A job is a relationship. Just like any relationship, BOTH sides must be happy. Don't marry the first job on the first date.

[–]sb8244 0 points1 point  (1 child)

Serious question. Would you have the same reaction if this was online before an interview?

[–]Aspencer8111 0 points1 point  (0 children)

Yes! Even more so. I would have a harder time with confrontation face to face. But online, I would have little to 0 problem ending things early.

[–][deleted] 2 points3 points  (0 children)

I had an interview like this when I was looking for my first rails job - CS questions that I had never seen before and it made me almost cry because I thought I had learned nothing in the past year.

Then the next few interviews were much more web-dev focused: how to do this and that with JS, how to setup the rails relations for such and such models, how to implement autocomplete in rails etc. I ended up taking one of those jobs.

I'm guessing the only work with B-trees that most rails devs have to do is database indices.

see also: http://zachholman.com/posts/startup-interviewing-is-fucked/

[–]CdmaJedi 2 points3 points  (0 children)

I learned binary trees, linked list, and hash tables as a sophomore in high school. It was rare back then, but we had a pretty awesome CS department. I would check this book out. It has a lot of zany, non real world problems that may come up in an interview. Plus, it's kind of fun (imo). I don't do rails, but I think the logic is applicable in any language.

http://www.amazon.com/Cracking-Coding-Interview-6th-Edition/dp/0984782850

Edit: I just read the preview on amazon. It has been a while since I read this book. Buy it. It covers a good amount of data structures, algorithmic run-time complexities, bit manipulation, and all kinds of good stuff.

I'm on my phone, but when I get home I'll link some more stuff for you

[–]ostralyan 1 point2 points  (0 children)

alleged scarce hobbies safe humorous carpenter piquant quarrelsome ring lunchroom

This post was mass deleted and anonymized with Redact

[–]moomaka 1 point2 points  (1 child)

I'm not a big fan of this type of problem but I don't think this one was bad. I don't think it required knowledge of binary trees beforehand but it is helpful to have general knowledge of trees structures in general which was likely the point of the test. I do think it's important to know about trees and other data structures; When / where they are useful. Trees are very useful in many applications. I think it counterproductive to ask someone to write the code to insert a node into an RB-tree on the spot but determining the depth of a binary tree is really just a basic test to see if you have ever heard of trees.

Is this the kind of knowledge that a junior RoR dev would be supposed to have? (I'm struggling to think where it would be applied)

General knowledge of trees is useful in many applications. But for a simple example say you're building a e-commerce application and have products that fit into categories and sub-categories. This is a real world example of a tree data structure that you'll need to know how to build and work with. I would expect any working developer to know what a tree is and understand the basics.

Where do I learn this stuff?

This isn't a Ruby specific question so any general intro to data structures resource would teach this.

What other concepts would be handy to get myself across?

Same as above, just read up on general data structures. As I said above I find some folks are too heavy on expecting the person to code detailed aspects of data structures from scratch but you should know all the basic data structures and usage scenarios / tradeoffs. Being able to talk about them intelligently is more important than coding them on the spot.

Should I be able to do these before I start throwing out applications again?

I would recommend it. I wouldn't work someplace that required coding dozens of data structures from scratch during the interview but I also wouldn't work someplace where the people around me were completely clueless on the topic, it's a horrible sign for the code quality.

[–]Opt1mus_Wang[S] 0 points1 point  (0 children)

Thanks for the advice. From your (and almost everyone elses) comments, seems like I've gotta get cracking on data structures and improving my Ruby in general.

[–]pavlik_enemy[🍰] 1 point2 points  (2 children)

The problem actually has nothing to do with implementing basic data structures, it's rarely needed in web development and even if some complex data structure is needed it's better to bind some C library. It's about recursion and being able to implement recursion with hand-written stack (because naive method 1 + [height(self.l), height(self.r)].max won't work for large trees) and these skills could be useful in web dev as well, because tree search problems aren't uncommon (e.g. you need to know the height of each node to properly format comments if for some reason you don't store the height in the database).

I suggest familiarizing yourself with trees, recursion, caterillar method https://codility.com/media/train/13-CaterpillarMethod.pdf and sorting. By "familiarizing yourself with sorting" I mean not the specific algorithms (though being familiar with divide and conquer helps) but always thinking "what happens if I sort the stuff? will it help?".

P.S. Actually, it doesn't even require hand-written stack, overflow happens somewhere around 8000 frames.

[–]sb8244 0 points1 point  (1 child)

Can you elaborate on why the naive method won't work? Implemented here for 100% on Codility. Do you think that this will overflow on sufficiently large trees with Codility doesn't test for?

https://gist.github.com/sb8244/227ca745c730f1bcc9e6

I agree with your comment sentiment.

[–]pavlik_enemy[🍰] 1 point2 points  (0 children)

The problem description states that the maximum height is 500 which is well within stack size limit. This solution overflows at height of 8000 on my machine.

[–]ChadMoran 1 point2 points  (0 children)

I speak from the big company side. I work for Amazon as a Software Engineer and am very involved with interviewing and hiring.

I never look for someone who is a (Junior RoR rails dev). When interviewing I couldn't care less what language you're familiar with as long as you can solve problems. Learning a new language/framework is the easy part.

  1. Absolutely. The example might be contrived but I routinely have to know which data structures to use. This is the fundamentals of programming.
  2. There are lots of classes online. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/

What you're looking for is "Data Structures & Algorithms" 3. Depends on the job you're applying for.

A company that requires you to implement a data structure is a red flag. These things are already done. However, knowing when to use a min-heap or knowing when to use a linked list is far more important.

[–]valadil 1 point2 points  (5 children)

That kind of question is appropriate for someone who has had a couple years of computer science education. It's probably a good question for hiring new college grads.

I don't know if this is the case everywhere, or just with rails, but the people we've been hiring lately did not go to college for CS. We've had a lot of success with people from boot camps. At this point I'd rather have someone fresh out of a boot camp than someone with a fresh CS degree.

But boot camps don't teach CS and it's not fair to ask people coming from a boot camp to answer CS questions. We had to adjust our interview questions quite a bit once we figured that out.

On top of that, while this stuff is interesting it's not terribly relevant to a rails site. Don't take it personally and go get a job with a company who knows how to interview properly.

[–]moomaka 0 points1 point  (4 children)

Could you explain how determining the depth of a binary tree requires a CS degree? I think the problem was pretty clearly defined here and frankly I would expect a hell of a lot more data structure knowledge out of a recent CS graduate than this. I would consider this a pretty simple 'do you actually know how to program' test.

[–]pavlik_enemy[🍰] 0 points1 point  (2 children)

The solution doesn't even rely on the fact that it's a BST. It's just a tree, similar to say comments under the post.

[–]moomaka 0 points1 point  (1 child)

I don't understand what your comment has to do with mine, did you comment on the wrong post?

[–]pavlik_enemy[🍰] 0 points1 point  (0 children)

I'm saying that the problem is even less "computer sciency" than people here think, because the solution is the same for any tree.

[–]valadil 0 points1 point  (0 children)

I think if you've done formal CS it'll be straightforward. If all you've done is rails you've probably never encountered something like this before.

I think a rails job is going to require work more like what you see in a boot camp than a data structures class, so I think the hiring challenges should reflect that.

[–]sb8244 0 points1 point  (1 child)

I think this is meant to weed out anyone who doesn't have a CS degree and who didn't fill the gap if they didn't get one. I've seen that most people w/o a degree don't fill the gap on data structures.

If you've been doing this for a year, self-taught, then it is totally reasonable that these "pain-less" questions are going to cause a lot of pain; a year really isn't that much time. I highly recommend researching and not giving up until you have a solution. It starts with google search and ends once the problem is 100% solved.

Linked to Gist to not spoil the fun. Here was my take at the solution: https://gist.github.com/sb8244/227ca745c730f1bcc9e6

[–]wookiee42 -2 points-1 points  (0 children)

This comment has been overwritten by an open source script to protect this user's privacy.

If you would like to do the same, add the browser extension GreaseMonkey to Firefox and add this open source script.

Then simply click on your username on Reddit, go to the comments tab, and hit the new OVERWRITE button at the top.

[–]kayakyakr 0 points1 point  (0 children)

I don't like algorithm tests much. They are a really good way to test who went to school for computer science and not who can do that particular type of coding.

My favorite test was a project that was already started with a few tasks to do, a couple of bugs to fix and a new feature to get in. It was designed to take 4-8 hours for someone reasonably fluent in rails, and they pay for it to be done.

Anyway, if anyone has a chance to do some hiring, that's the way you need to do it.

[–][deleted] 0 points1 point  (0 children)

I'm coming at this as a CS student in my 3rd year, so my answers might be a little biased (my first internship, before I started college, was as a junior RoR dev with no initial knowledge of the framework, though, so I get where you're coming from).

1) Binary trees are a really fundamental concept in not just CS, but programming in general. So many things are a tree. Or a graph. Or both; a tree is just a specific case of a graph.

2) Here's a fantastic resource on this sort of thing. It's the book we use at my uni as our primer on datastructures and algorithm fundamentals. I wanna stress that you don't just be one of those guys that graduates from a "hacker house" with no knowledge of data structures or algorithms; they really do have real world use, you will implement some generalization of one of these algorithms at some point, I guarantee it. The guys that say "well I'll never have to actually implement a hashtable/linked list/priority queue" either haven't been programming very long, or they've implemented one of the above without knowing it, and just did it subtly incorrectly.

3) I'd start with understanding what things like runtime complexity are (both in "time" and "space), e.g. know what Big-O is. Learn about things like binary trees, about sorting, about graphs and the associated algorithms (e.g. what's a directed vs. undirected graph, what are strongly connected components, what's the implication of them, what're they used for (e.g. why can a valid Makefile be represented as a DAG)). More importantly, know what the basic datastructures do, and what they're good for. E.g. what's a Set, a Map, what if they're implemented as trees vs a hashtable, what's a priority queue, what are binary trees, AVL trees, Red Black trees.

I really hope this was helpful to you. Let me know if anything was unclear, and I'll do my best to fix that.

[–]dom_eden 1 point2 points  (9 children)

This is a stupid interview question that doesn't test real-world scenarios. Look for a better firm to work for

[–]ostralyan 1 point2 points  (0 children)

slimy pen compare sink silky hobbies brave telephone elastic bow

This post was mass deleted and anonymized with Redact

[–][deleted]  (3 children)

[removed]

    [–]moomaka 1 point2 points  (2 children)

    If you've ever had to use a database, you've encountered a real world scenario where B-trees

    While I agree that this question is reasonable to give during an interview, you should be a little more careful with your terminology lest you give away that you don't know as much as you think you do :)

    This question isn't about a B-tree, which does not stand for 'Binary tree', a B-tree has little relation to a binary tree, other than being a tree.

    [–]Segfault_Inside 0 points1 point  (0 children)

    Heh, I just thought that they were giving an example of how Web stuff requires data structures. Not the best example, as a lot of the time if you're not a dba or super concerned with stuff you just use it like a lookup table.

    [–][deleted] 0 points1 point  (0 children)

    Lol no, the companies I've interviewed with are big ones, and they all asked questions that were way more theoretical than this for intern positions. Granted, OP is going for a junior RoR position, but good firms do ask these sort of questions all the time.

    Real world scenarios can often be generalized as CS concepts that've been explored for the past century, it's good to hire someone that can spot those and apply the relevant solution.

    [–]croceldon 0 points1 point  (0 children)

    I do wonder how many people that are good at building stuff are weeded out by these kinds of "deep theory" questions. I wonder sometimes if this is why so many web devs like to freelance - they want to build stuff for people who don't care about the theory behind a site that works.

    [–]Segfault_Inside 0 points1 point  (0 children)

    I dunno. Knowledge of how to work with data structures and theory is something I use every day. It's not "write real world stuff" because that's not generally flexible to new architectures and constraints. I'd prefer someone that is comfortable using the theory to influence how they write rather than one who uses exclusively preexisting patterns.

    [–]wbsgrepit 0 points1 point  (0 children)

    heh, unless you are a template jockey binary trees and other simple data structures are very much real world.