4 ms·
Yes. One candidate remembered to do it that way after some searching, the other never did. Both started out by looping over the items in the dict and stopping
by mohaine 8y ago
Yes. One candidate remembered to do it that way after some searching, the other never did.
Both started out by looping over the items in the dict and stopping at the correct one. Asking if there was a simpler way to get values out of dict didn't help.
The third candidate really didn't get far enough to get the dict wrong so I counted them as well but they may have known how to do a dict lookup.
Here is the exercise:
Given these dicts:
{"a":[1,2],"b":[3,4],"z":[5]}
{"a":[66],"b":[77]}
Write a program in language of your choice that sums the common keys.
a and b are common so result is:
{"a":1+2+66,"b":3+4+77}
so output should be:
{"a":69,"b":84}
This exercise is stupid simple. Note this is in an IDE/Editor, not a whiteboard.
- tombert 8y agoI remember how I didn't believe that Fizzbuzz eliminates some crazy-high percentage of candidates until I started interviewing. I think most of the people I have interviewed are relatively smart people, but a lot of them really haven't had a lot of need to practice their algorithms, so they don't. I've had people fail the "tell me if these two strings are anagrams" thing, with one person's response being to have 26 counters, one for each letter.