Having interfaced with Apple in a different way (apart from owning a new MBP and an iPhone X) I'd say the issue is, and continues to be, growing pains. They're certainly losing the lead in software engineer talent (giving it away to whom, I'm not sure). But the single most horrible experience I've had with Apple in the last year was trying to get software published on the App Store. That's a department that's so larg…
I'd say the issue is, and continues to be, growing pains. They're certainly losing the lead in software engineer talent (giving it away to whom, I'm not sure). I keep on interviewing recent Comp Sci graduates who have a 3.75 or a 4.0 and who can't tell me how to implement cycle detection -- to the extent that they could write a pseudocode function signature or some kind of concretely implementable design. Many of the…
I had someone in an interview in Berlin ask me to write a garbage collector. In CSC 202, our professor talked about using reference counts. Reference counts can get leaks if you have two objects referencing each other with to path to either, but what I didn't realize is that Java hasn't used reference counts in a really long time. It does a search from each root (typically a thread) down the object tree; and it breaks things into young/old (eden space and .. something else) so long lived objects don't get searched as often.
I learned all of that during the interview lunch break when I looked it up on my phone. One of my good friends wrote a compile time GC for GO and did this PhD dissertation on it, and he probably would have got this question right. But if it's not in your field, well the problem space for problems is pretty fucking large.
Cycle detection? Man I could probably tell you back when I studied minimum spanning trees and wrote this thing to implement Dijkstra's shortest path:
https://penguindreams.org/projects/graphmapper/
Off the top of my head, I'd hope each node had a unique identifier and I guess I'd mark them/store the keys in a hash table. I'd move breath first and error out if I discovered the same hash/unique key .. which of course would give me a hash the size of the tree. Unless there's a way to mark the data structure, you now have a second structure the size of your key space.
I'm sure there are better solutions, but I wouldn't expect a senior program to know them off the top of their head, unless you're hiring really specifically for a position writing routing algorithms or looking for a senior airport transit architect.