FastPrepFind the Unique User with Access to Every Camera
Problems/Find the Unique User with Access to Every Camera

Find the Unique User with Access to Every Camera

Verkada logoVerkada● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report defines the relationship types, transitive group inheritance, cycle handling, and unique-admin result. The finite triple-array adapter and empty-string sentinel are specified for practice; the judged task matches at about 98%.

An access-control graph is provided as relationship triples. Each triple is [source, relationship, destination].

  • camera_owner means that a user or group directly owns a camera.
  • group_member means that a user or group belongs to another group.

A user can access every camera owned directly by that user or by any group reachable through one or more membership relationships. Groups may contain other groups, and group membership may contain cycles.

Return the unique user_* identifier that can access every camera appearing in a camera_owner relationship. Return the empty string when there are no cameras or when zero or multiple users can access every camera.

Function

findAdminUser(permissions: String[][]) → String

Examples

Example 1

permissions = [["user_alice","group_member","group_ops"],["group_ops","camera_owner","camera_lobby"],["user_alice","camera_owner","camera_roof"],["user_bob","group_member","group_ops"]]return = "user_alice"

Both users inherit access to camera_lobby from group_ops, but only user_alice directly owns camera_roof.

Example 2

permissions = [["user_a","group_member","group_x"],["group_x","group_member","group_y"],["group_y","group_member","group_x"],["group_y","camera_owner","camera_1"],["user_b","camera_owner","camera_1"]]return = ""

The group cycle is traversed safely. Both user_a and user_b can access the only camera, so there is no unique result.

Constraints

  • 0 <= permissions.length <= 2000.
  • Every triple contains exactly three non-empty strings.
  • The relationship is either camera_owner or group_member.
  • Users, groups, and cameras begin with user_, group_, and camera_, respectively.
  • A group_member destination is a group; its source is a user or group.
  • A camera_owner destination is a camera; its source is a user or group.
  • Each identifier has length at most 80.

More Verkada problems

  • Host Log ParserPHONE SCREEN · Seen Sep 2026
  • Valid SudokuPHONE SCREEN · Seen Sep 2026
  • Common Camera Motion IntervalsPHONE SCREEN · Seen Sep 2026
All Verkada interview questionsSee Verkada hiring insights
Saved
class Solution {
    public String findAdminUser(String[][] permissions) {
        // Write your code here.
    }
}
Checking account…