FastPrepRole-Based Network Access Control
Problems/Role-Based Network Access Control

Role-Based Network Access Control

Okta logoOkta● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Okta phone screen for a full-time role. The original report leaves out how conditions are matched, what happens with an invalid reference, and a batch interface you can run. We filled those in.

Our version is about 89% the same as the reported question.

Build a role-based network access-control system. You process a list of operations in order.

Entities

  • A user may have many roles.
  • A role may have many permissions.
  • A permission has an identifier, an effect of ALLOW or DENY, and zero or more required property pairs.
  • A permission is applicable to a check only when every required key-value pair exactly matches a property supplied by that check. A permission with no required properties is always applicable.

Operations

Each row of operations is one of the following forms:

  • ["CREATE_USER", userId]
  • ["CREATE_ROLE", roleId]
  • ["CREATE_PERMISSION", permissionId, effect, k, key1, value1, ..., keyk, valuek]
  • ["ASSIGN_PERMISSION", roleId, permissionId]
  • ["ASSIGN_ROLE", userId, roleId]
  • ["CHECK", userId, k, key1, value1, ..., keyk, valuek]

User, role, and permission identifiers are unique when created. Repeating a role assignment or a permission assignment that already exists does nothing.

An assignment or check that references an entity that has not been created is invalid: append ERROR to the result and do not mutate any state. All other non-check operations are valid and produce no result.

Access decision

For a valid CHECK, evaluate every applicable permission reachable through all roles assigned to the user:

  1. If any applicable permission has effect DENY, append DENY.
  2. Otherwise, if at least one applicable permission has effect ALLOW, append ALLOW.
  3. Otherwise, append DENY.

Return the emitted results in operation order. Treat the batch as one history of steps done one after another. Ignore concurrent updates and replication.

Function

evaluateAccess(operations: String[][]) → String[]

Examples

Example 1

operations = [["CREATE_USER","alice"],["CREATE_ROLE","engineer"],["CREATE_PERMISSION","prod-read","ALLOW","1","env","prod"],["ASSIGN_PERMISSION","engineer","prod-read"],["ASSIGN_ROLE","alice","engineer"],["CHECK","alice","1","env","prod"],["CHECK","alice","1","env","dev"]]return = ["ALLOW","DENY"]

The permission applies to the first check because env=prod matches, so access is allowed. It does not apply to the second check, so the default decision is DENY.

Example 2

operations = [["CREATE_USER","bob"],["CREATE_ROLE","member"],["CREATE_ROLE","security"],["CREATE_PERMISSION","read-docs","ALLOW","1","resource","docs"],["CREATE_PERMISSION","block-suspended","DENY","2","resource","docs","status","suspended"],["ASSIGN_PERMISSION","member","read-docs"],["ASSIGN_PERMISSION","security","block-suspended"],["ASSIGN_ROLE","bob","member"],["ASSIGN_ROLE","bob","security"],["CHECK","bob","2","resource","docs","status","active"],["CHECK","bob","2","resource","docs","status","suspended"],["CHECK","bob","1","resource","code"]]return = ["ALLOW","DENY","DENY"]

The allow applies to active document access. For suspended document access, both permissions apply and the deny wins. No permission applies to the code resource, so access defaults to DENY.

Example 3

operations = [["CREATE_USER","u"],["CREATE_ROLE","r"],["CREATE_PERMISSION","p","ALLOW","0"],["ASSIGN_PERMISSION","r","p"],["ASSIGN_PERMISSION","r","p"],["ASSIGN_ROLE","u","r"],["ASSIGN_ROLE","u","r"],["CHECK","u","0"],["ASSIGN_ROLE","u","missing"],["CHECK","missing","0"]]return = ["ALLOW","ERROR","ERROR"]

Duplicate assignments do not change the state. The unconditional allow makes the valid check succeed. The unknown role assignment and unknown user check each emit ERROR.

Constraints

  • 1 <= operations.length <= 10^5.
  • The total number of strings across all operation rows is at most 2 * 10^5.
  • Every row has exactly the length required by its operation, and every k is a valid non-negative integer.
  • User, role, and permission identifiers are non-empty and unique within their entity type when created.
  • Each permission effect is ALLOW or DENY.
  • Property keys are unique within one permission or check, and all identifiers, keys, and values are non-null strings.
  • Only references to entities that have not yet been created are invalid; operation names and row encodings are otherwise valid.

More Okta interview questions

  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • Lexicographically Smallest Dependency OrderPHONE SCREEN · Seen Aug 2026
  • Simple Bank OperationsONSITE INTERVIEW · Seen Oct 2026
  • Randomized Collection with Duplicate ValuesONSITE INTERVIEW · Seen Sep 2026
  • Top-Down Employee Reporting ForestONSITE INTERVIEW · Seen Sep 2026
  • Fair Multi-Tenant CacheONSITE INTERVIEW · Seen Aug 2026
  • CD Rental SystemONSITE INTERVIEW · Seen Jun 2026

Similar questions at other companies

  • Process On-Call Routing OperationsOpenAI · PHONE SCREENOpenAI interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
  • Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Track Package Receipt GapsAmazon · PHONE SCREEN
  • Transformer KV Cache OperationsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Rate Limiter with Hourly and Daily Effort QuotasZscaler · PHONE SCREENZscaler interview questions
  • Chatter Message WindowReddit · PHONE SCREENReddit interview questions
  • Versioned Recipe Shopping CartDecagon · PHONE SCREENDecagon interview questions
  • Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
All Okta interview questionsSee Okta hiring insights
Saved
class Solution {
    public String[] evaluateAccess(String[][] operations) {
      // write your code here
    }
}
Checking account…