Down to chat about coding interviews and answer questions here!
Down to chat about coding interviews and answer questions here!
While it wasn't my only resource, it helped me a lot interviewing for Facebook and Google recently, and I got offers from both.
(throwaway account for obvious reasons)
I couldn't help but notice that Golang was conspicuously absent from the list of languages. Might you be adding that in the future?
Problem:
A tree of resources that you can get granted access rights to. When you get access to a node in the tree, you inherit rights to children transitivley. You can also have rights explicitly blocked. The ordering is important. An example, you start of as head of IT and have all the IT stuff granted, but explicitly no access to the IT security department. Then you make CEO and are granted right to everything, so that should overrule your previous restriction for the IT security department.
I think the correct answer is "IT Security should be a peer of IT, not a subdepartment."
For example: how do you store the explicit blocks? More specifically, how do you articulate that head of IT is blocked from this subtree, but the CEO isn't? Some options:
- store the block as pairwise (individual, subtree)
- same idea, but instead of blocks you store explicit /allowances/ (and allow a tree node to have a flag set of "ignore the tree-based permission system here, and just lock everyone out who doesn't have an explicit permission")
- instead of blocking individuals, you could add an abstraction layer, e.g. user_groups, and assign permissions to /groups/.. You could also add an abstraction layer on top of the treenodes themselves (object_permission_groups?). Different tradeoffs with these options.
Again, hard to know exactly where your interviewer was trying to steer the conversation. But that'd be my guess!
It seems like a trick question designed to see if the candidate is willing to question assumptions.
One potential that springs to mind is (say) governance or oversight considerations of the given situation?
Not sure how that'd apply directly either though. Feels like there's more info needed from the interviewer first, to give a hint as to the direction. :)
And, as an aside, I’ve found in practice that combining these lego blocks, allows you to build the sorts of specialized, efficient solutions you need.
Perhaps you could add an example of doing that, such as combining a queue with a binary search tree map to emit minimal values over a window. This would be a case where the sorted property of the tree is actually useful, as well.