FastPrepDesign File System
Problems/Design File System

Design File System

Google logoGoogle● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report says it was a well-known file system question. This one feels like a good match, so here it is for you to try!

Build an in-memory file system that stores an integer value for each path you create. Process the operations in queries in order, starting with no stored paths.

A valid path consists of one or more non-empty lowercase English names, each preceded by /. For example, /leetcode and /leetcode/problems are valid. Neither the empty string nor / is a valid operation path.

Supported operations

  • ["createPath", path, value]: the third entry is a positive integer written as a decimal string. Create the path with that value only if the path does not already exist and its immediate parent exists. A top-level path such as /a can be created without creating a parent. Return "true" when creation succeeds, otherwise return "false". Failed creation leaves the file system unchanged, including the value of any existing path.
  • ["get", path]: return the stored value as a decimal string, or "-1" when the exact path has not been created.

The immediate parent of /a/b/c is /a/b. Creating a child never creates missing ancestors automatically. Each created path has its own value and may also have children.

Operation sequence

Implement processFileSystem(queries) and return one string result per operation, in the same order. All operations use the same file system. The operation list represents calls to its createPath and get methods. Starting the file system does not add an entry to the result.

Function

processFileSystem(queries: String[][]) → String[]

Examples

Example 1

queries = [["createPath","/a","1"],["get","/a"]]return = ["true","1"]

/a is a new top-level path, so creation succeeds. Its stored value is 1.

Example 2

queries = [["createPath","/leet","1"],["createPath","/leet/code","2"],["get","/leet/code"],["createPath","/c/d","1"],["get","/c"]]return = ["true","true","2","false","-1"]

After /leet exists, its child /leet/code can be created with value 2. Creating /c/d fails because /c does not exist. The failed operation does not create /c, so its lookup returns "-1".

Constraints

  • 1 <= queries.length <= 10^4.
  • Every query has exactly one of the two supported shapes.
  • 2 <= path.length <= 100.
  • Each path is valid and contains only lowercase English letters and /, with no empty name, repeated slash, or trailing slash.
  • For every creation operation, 1 <= value <= 10^9.

More Google Phone Screen questions

  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Logger Rate Limiter with Every-Arrival HistoryPHONE SCREEN · Seen Nov 2026
  • Minimum Total Layover WaitPHONE SCREEN · Seen Nov 2026
  • Reach a Destination Through Scheduled FlightsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • In-Memory Directory and File OperationsSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
  • File System PathsCapital One · ONSITE INTERVIEWCapital One interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
  • Design a Food Rating SystemApple · PHONE SCREENApple interview questions
  • Hierarchical In-Memory File SystemClay · PHONE SCREEN
  • Numeric Poker OperationsRippling · PHONE SCREENRippling interview questions
  • Reference-Counted Deduplicating File SystemCitadel · PHONE SCREENCitadel interview questions
  • In-Memory Key-Value Store SerializationOpenAI · PHONE SCREENOpenAI interview questions

Google interview experiences

  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
  • Google AI Coding Interview and AI OA: 2 Experiences
  • Google SWE Intern Interview Results Timeline: 13 Experiences
  • Google L4 SWE Phone Screen and Kirkland Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] processFileSystem(String[][] queries) {
        // write your code here
    }
}
Checking account…