My Experience With a Programmer Coding Test (Survey) (spreadsheets.google.com)
Prompted by RiderOfGiraffes, I decided to put my programmer interview question in a Google Form and gather responses that way. I am concerned that no applicants have aced these questions thus far, although my peers seem to do OK.
25 comments
[ 2.9 ms ] story [ 66.3 ms ] threadBesides, it's not an application, I'm sure you could write it in your favorite language of you wanted :)
5-10 min.
// --
its kind of a pain to do in a text box. variable width fonts make it harder to read. Would have also been nice to have an actual javascript repl. Was a bit shaky on tree traversal, but I think that's correct. Also not intimately familiar with javascript stdlib.
Chrome has it built in and Firefox has Firebug.
Was a bit shaky on tree traversal, but I think that's correct.
It's much simpler with recursion. Your contains method is "correct" but doesn't work in this case because objects with the same keys and values still aren't necessarily equal.
The problem definitely says that a leaf node will have an empty array as it's children property
- Well, I dont know JS, but in order to process a node, I have to apply the function to the value and recurse for each value in the array. This also handles leafes properly, because they have no children and thus no recursion occurs. Thus, I'd have to grab some web browser now and find some forach-loop and some functio-definition-syntax in JS now.
- In order to sum values up, I'd need some function which adds the value to an accumulator in place and destructively (such that the new value replaces the old value). Should be easy using closures or, in the worst case, a simple small object.
Overall, this took about 3 minutes. If I would search for javascript syntax now, I'd probably need around 10 - 20 additional minutes to get everything working.
Did it pass? Can you email it back to me ...
Can someone explain (or point to an explanation of) the scoping rules for me?
Thanks.