FastPrepEffective Access Control
Problems/Effective Access Control

Effective Access Control

Snowflake logoSnowflake● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Snowflake phone screen. The report asks for the effective permissions across nodes linked by inheritance edges, with both allow and deny lists. It does not say which way the edges point, what happens with a cycle, which rule wins, how to write the data, or in what order to print the output. We use a usual finite inheritance model. Our version is about 85% the same as the reported question.

You are given n access-control nodes numbered from 0 through n - 1. The arrays allowLists and denyLists have one row per node. Each row contains the permission names that the node directly allows or denies.

Each row [parent, child] in edges means that child inherits access-control entries from parent. The directed graph is acyclic, and a node inherits entries from every ancestor reachable through any parent.

For each node, combine all local and inherited allow entries and all local and inherited deny entries. A deny entry overrides every allow entry for the same permission, regardless of whether either entry is local or inherited. Therefore, a permission is effective exactly when it appears in the combined allow set and does not appear in the combined deny set.

Return one permission list per node in node-index order. Remove duplicates and sort each node's effective permission names lexicographically.

Function

getEffectiveAccess(allowLists: String[][], denyLists: String[][], edges: int[][]) → String[][]

Examples

Example 1

allowLists = [["READ"],["WRITE"],["DEPLOY"]]denyLists = [[],["READ"],[]]edges = [[0,1],[1,2]]return = [["READ"],["WRITE"],["DEPLOY","WRITE"]]

Node 1 inherits READ but directly denies it. Node 2 inherits both the allow and the deny, so READ remains excluded while WRITE and DEPLOY are effective.

Example 2

allowLists = [["READ"],["WRITE"],["AUDIT"],["DEPLOY"]]denyLists = [[],[],["WRITE"],["READ"]]edges = [[0,2],[1,2],[2,3]]return = [["READ"],["WRITE"],["AUDIT","READ"],["AUDIT","DEPLOY"]]

Node 2 inherits from two parents and denies inherited WRITE. Node 3 inherits that deny and directly denies READ, leaving AUDIT and DEPLOY.

Example 3

allowLists = [["A","B"],["B","C"],[],["D"]]denyLists = [["B"],[],["C"],[]]edges = [[0,2],[1,2],[2,3]]return = [["A"],["B","C"],["A"],["A","D"]]

At node 2, inherited deny B and local deny C override all matching allows. Both denies continue to node 3.

Constraints

  • 1 <= allowLists.length = denyLists.length <= 500.
  • 0 <= edges.length <= 5000.
  • Every edge is [parent, child] with valid, distinct node indices.
  • The inheritance graph is a directed acyclic graph.
  • Every permission name is a non-empty ASCII token of at most 30 characters and contains no whitespace.
  • The total number of local allow and deny entries is at most 20000.
  • There are at most 2000 distinct permission names, and the total number of returned permission entries is at most 200000.

More Snowflake Phone Screen questions

  • Minimum StackPHONE SCREEN · Seen Nov 2026
  • Design In-Memory File SystemPHONE SCREEN · Seen Nov 2026
  • Merge Two Binary TreesPHONE SCREEN · Seen Nov 2026
  • Connect Four from the Last MovePHONE SCREEN · Seen Nov 2026
  • Minimum Edits to a Perfect Binary TreePHONE SCREEN · Seen Nov 2026
  • Configurable Per-Client Token BucketsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
  • Minimum Index Distance Between Person and CakeOA · PHONE SCREEN · Seen Nov 2026
  • Minimum N-ary Tree Depth DeletionsOA · PHONE SCREEN · Seen Nov 2026
  • Sum of Binary Tree Boundary NodesOA · PHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Task Build Order and File-Change RerunsVanta · PHONE SCREEN
  • Course ScheduleByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Merge Event PreferencesAirbnb · PHONE SCREEN · ONSITE INTERVIEWAirbnb interview questions
  • Network Layer Execution OrderNVIDIA · PHONE SCREENNVIDIA interview questions
  • Task Scheduler with Prerequisites and Execution PathsBrex · PHONE SCREEN
  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Course Schedule Cycle DetectionGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Dependency-Aware Task SchedulerRippling · PHONE SCREENRippling interview questions
  • Build Packages as Dependencies Are DiscoveredMongoDB · PHONE SCREENMongoDB interview questions

Snowflake interview experiences

  • Snowflake AI Coding Interview, Experienced Hires: 3 Experiences
All Snowflake interview questionsSee Snowflake hiring insights
Saved
class Solution {
    public String[][] getEffectiveAccess(String[][] allowLists, String[][] denyLists, int[][] edges) {
        // write your code here
    }
}
Checking account…