FastPrepIn-Memory File System
Problems/In-Memory File System

In-Memory File System

Airbnb logoAirbnb● HardFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report gives the file operations, which build on each other. It leaves out several rules about results, ordering, capacity and how compression works over time.

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

Special thanks: 🌷 A special thank you to a lovely, amazing fren who shared that this question appeared again on November 22, 2026! (˶˃ ᵕ ˂˶) .ᐟ.ᐟ 🧡

Build a file system that lives in memory. It processes a list of operations, one after another. Each file has a unique path, a current stored size, an owner, and a compression state.

Each non-admin user has a storage capacity. It is the largest total that the current stored sizes of their files may reach. The built-in user "admin" exists from the start and has no capacity limit. A path is free when no current file has it.

The input operations holds one string array per operation. Return one string for each operation, in the same order.

Supported operations
Operation rowBehaviorReturned string
["ADD_USER", userId, capacity]Add a new non-admin user with the given nonnegative capacity. It fails if the ID is empty, is "admin", or is already taken."true" on success. Otherwise "false".
["ADD_FILE", userId, path, size]Add an uncompressed file owned by an existing user. The path must be free and must not end in ".COMPRESSED". The size must be positive. A non-admin owner must have enough capacity left."true" on success. Otherwise "false".
["COPY_FILE", sourcePath, destinationPath]Copy an existing file to a free path. The copy keeps the source file's owner, current size, compression state, and original size. The owner must have enough capacity left. The destination ends in ".COMPRESSED" exactly when the source is compressed."true" on success. Otherwise "false".
["FIND_FILES", prefix, suffix]Find every current file path that starts with prefix and ends with suffix. List larger files first by current size. Break ties by path, in ascending lexicographic order. Write each match as path(size) and join the matches with ", ".The joined matches, or the empty string when nothing matches.
["COMPRESS_FILE", userId, path]Compress an existing uncompressed file owned by userId. Rename it to path + ".COMPRESSED", which must be free. Its stored size changes from s to ceil(s / 2). Remember s as its original size."true" on success. Otherwise "false".
["DECOMPRESS_FILE", userId, compressedPath]Decompress an existing compressed file owned by userId. Its path must end in ".COMPRESSED". Rename it by removing that final suffix, and restore its original size. The restored path must be free. A non-admin owner must have enough capacity left for the size increase."true" on success. Otherwise "false".

An operation that fails changes nothing. So repeating an operation that already succeeded fails, unless later operations bring back the source and destination state it needs.

Function

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

Examples

Example 1

operations = [["ADD_USER","alice","10"],["ADD_FILE","alice","/docs/a.txt","7"],["COPY_FILE","/docs/a.txt","/docs/b.txt"],["COMPRESS_FILE","alice","/docs/a.txt"],["COPY_FILE","/docs/a.txt.COMPRESSED","/docs/b.txt.COMPRESSED"],["FIND_FILES","/docs/",".COMPRESSED"],["DECOMPRESS_FILE","alice","/docs/a.txt.COMPRESSED"]]return = ["true","true","false","true","true","/docs/a.txt.COMPRESSED(4), /docs/b.txt.COMPRESSED(4)","false"]

Adding alice with a capacity of ten succeeds. Adding her 7-unit file also succeeds. Copying that file would push her total above ten, so the first copy fails. Compressing the file shrinks it to 4 units and succeeds. Its compressed copy now fits, so that copy succeeds. The search finds both compressed files. They have the same size, so they are listed in path order. Decompressing either copy would raise her total from 8 to 11, which is above ten. So the last operation fails and changes nothing. The answer is true, true, false, true, true, the two matches, and then false.

Example 2

operations = [["ADD_FILE","admin","/odd.txt","5"],["COMPRESS_FILE","admin","/odd.txt"],["FIND_FILES","/",".COMPRESSED"],["DECOMPRESS_FILE","admin","/odd.txt.COMPRESSED"],["FIND_FILES","/",".txt"]]return = ["true","true","/odd.txt.COMPRESSED(3)","true","/odd.txt(5)"]

The admin adds a file of size 5 and compresses it. Half of five, rounded up, is 3, so the first search lists the compressed file with that size. The admin has no capacity limit, so decompressing succeeds. It brings back the original path and size, so the second search lists /odd.txt with size five. The answer is true, true, the compressed match, true, and the restored match.

Example 3

operations = [["ADD_USER","dev","30"],["ADD_FILE","dev","/src/z.log","3"],["ADD_FILE","dev","/src/b.log","8"],["ADD_FILE","dev","/src/a.log","8"],["FIND_FILES","/src/",".log"],["FIND_FILES","/tmp/",".log"]]return = ["true","true","true","true","/src/a.log(8), /src/b.log(8), /src/z.log(3)",""]

The user and all three files are added, so the first four results are true. The first search lists larger files first, so the smallest file, z.log, comes last. The two files of equal size are ordered by path, so a.log comes before b.log. No path starts with /tmp/, so the last search returns the empty string.

Constraints

  • 1 <= operations.length <= 100000.
  • Every row is one of the six operations listed above. Where a row needs a number, it holds a valid decimal integer as text.
  • User IDs and file paths contain between 1 and 100 characters.
  • 0 <= capacity <= 10^18.
  • 1 <= size <= 10^9.
  • The sum of all stored sizes fits in a signed 64-bit integer.

More Airbnb Online Assessment questions

  • Task Management SystemOA · Seen Nov 2026
  • Recipe Management SystemOA · Seen Nov 2026
  • Progressive Banking SystemOA · Seen Nov 2026
  • Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026
  • Parcel Event TrackingOA · Seen Oct 2026
  • Median Home Price by CityOA · Seen Sep 2026
  • Worker Management (Promotion Track), Part 4: Full-Shift Double PayOA · Seen Sep 2026
  • Worker Management (Promotion Track), Part 3: Promotions and SalaryOA · Seen Sep 2026
  • Workspace Credit LedgerOA · Seen Aug 2026

Similar questions at other companies

  • Power Cell BankOptiver · OAOptiver interview questions
  • Four-Level Banking System with Scheduled PaymentsZipRecruiter · OAZipRecruiter interview questions
  • Task Management SystemCoinbase · OACoinbase interview questions
  • Task Management SystemAnthropic · OAAnthropic interview questions
  • Progressive Parcel Tracking OperationsKlaviyo · OAKlaviyo interview questions
  • Versioned Recipe SystemThe Trade Desk · OA
  • Recipe Management SystemRamp · OARamp interview questions
  • Document and Layer OperationsFigma · OAFigma interview questions
  • Worker Management with Promotions and Double-Paid TimeInstacart · ONSITE INTERVIEWInstacart interview questions
  • Document Enrichment Stream AggregatorBloomberg LP · PHONE SCREENBloomberg LP interview questions

Interview reports that mention this question

  • Airbnb SWE CodeSignal OA: 19 Experiences

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public String[] processFileSystem(String[][] operations) {
        // Write your code here.
    }
}
Checking account…