InterviewDB Experience

Find View By Id: Implement a Custom View Lookup in an Android-Style View Hierarchy

Interview Experience

Problem In an Android-style view system, each view has an integer ID. Views can be nested in ViewGroups. Implement findViewByIdRecursive that searches the view tree and returns the first view matching the given ID. Example: Follow-ups DFS or BFS — which is better here, and does it matter for correctness? How would you optimize repeated lookups by caching ID-to-view mappings? How would you handle the case where duplicate IDs exist in the hierarchy? How would you add findAllViewsById that returns…

Full Details

🔒

Unlock all Nextdoor questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a candidate experience report from a nextdoor interview during the phone round.

It covers the following topics: Phone, Graph, Android, System Design, Coding .