FastPrepCan All Files Compile?
Problems/Can All Files Compile?

Can All Files Compile?

Roblox logoRoblox● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Roblox new grad onsite interview. The candidate asks whether files can compile when all dependencies are met and there are no circular dependencies. We chose string identifiers, an interface with matching arrays, what to do with missing names, repeated references, the result for an empty list, and the limits. Our version is about 90% the same as the reported question.

You are given unique file identifiers in files. The parallel array dependencies describes the files that each file needs: dependencies[i] lists every direct dependency of files[i].

A file can compile after all its dependencies have compiled. Determine whether all supplied files can compile. A missing dependency or a circular dependency makes this impossible.

For this exercise, assume identifiers are case-sensitive and only files named in files are available. Repeating a dependency name adds no extra requirement. Return true when every file can compile and false otherwise. An empty file list returns true.

Function

canCompileFiles(files: String[], dependencies: String[][]) → boolean

Examples

Example 1

files = ["main","util","base"]dependencies = [["util"],["base"],[]]return = true

Compile base first, then util, then main.

Example 2

files = ["a","b"]dependencies = [["b"],["a"]]return = false

Each file waits for the other, so neither can compile first.

Example 3

files = ["app"]dependencies = [["lib"]]return = false

lib is not among the available files.

Constraints

  • 0 <= files.length <= 200, and dependencies.length = files.length.
  • File identifiers are distinct.
  • Every identifier contains 1 to 24 English letters, digits, underscores, hyphens or periods.
  • The total number of dependency entries is at most 2000.
  • Dependency identifiers may be absent from files, repeated within a row, or equal to the file itself.

More Roblox Onsite Interview questions

  • Most Frequent Call Path From Function Trace LogsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Search Autocomplete SystemPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Candy Crush Grid Matching and GravityPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Topological Sort with Secondary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Most Frequent Call Stack Per ThreadPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Count and Score Distinct Hat AssignmentsONSITE INTERVIEW · Seen Sep 2026
  • Rate Limiter Sliding Window With Per-Entity LimitsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Most Frequent Call Path in Interleaved LogsONSITE INTERVIEW · Seen Aug 2026
  • Grid Pathfinding with Obstacles (DFS)PHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2026
  • Maximize Distance to Closest Person — Return the SeatONSITE INTERVIEW · Seen Jun 2026

Similar questions at other companies

  • Merge Event PreferencesAirbnb · PHONE SCREEN · ONSITE INTERVIEWAirbnb interview questions
  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Course ScheduleOracle · ONSITE INTERVIEWOracle interview questions
  • Package Install OrderVerily · ONSITE INTERVIEW
  • Course SchedulePlaud · ONSITE INTERVIEW
  • Course Schedule Cycle DetectionGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Lexicographically Smallest Topological OrderByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Evaluate Formulas with Cycle DetectionInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions
  • Lexicographically Smallest Course OrderLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Audit Discounted Category AncestorsFaire · ONSITE INTERVIEW

Interview reports that mention this question

  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)

Roblox interview experiences

  • Roblox OA: What It Tests (2026)
  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
  • Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public boolean canCompileFiles(String[] files, String[][] dependencies) {
        // write your code here
    }

}
Checking account…