Ramp OA real question sharing | CodeSignal 90min 4 Level OOD (2026.5.18 passed)

1,379 Views

Just finished it last week Ramp OA, this time is a 90-minute OOD version of the CodeSignal platform, with a total of 4 Levels. You must pass all test cases of the current level to unlock the next level. I finished writing the whole process in Python, and I finished it in more than 40 minutes. I will share with you the actual questions and solution ideas below.

Ramp OA real question sharing | CodeSignal 90min 4 Level OOD (2026.5.18 passed)

CodeSignal Platform Rules

Before doing this, make sure you know what kind of OA you are getting:

90 minute version (OOD version): The four questions have the same system design, and the levels are progressive. You must pass all the tests of the current level to unlock the next question. It is recommended to use Python, as the code size is small, and subsequent VO will not ask you what language you used.

70 minute version (General version): Four independent algorithm questions, the question bank is fixed, and there are only 100 questions back and forth. They are basically the original questions, and you can study them in advance.

Ramp went for the 90 minute OOD version.

Question background

Implement an in-memory cloud storage system to map files to corresponding metadata (name, size, etc.). There is no need to operate the real file system, everything is stored in memory.

The four levels are progressive, and you can only see the questions of the next level after passing the current level.

Level 1: Basic file operations

For the most basic addition, deletion and checking, just implement the interface clearly.

Interface:

  • Add_file(name, size) → The file already exists and returns False, otherwise it returns True if the file is added successfully.
  • Get_file_size(name) → Returns the size if the file exists, returns None if it does not exist
  • Delete_file(name) → If the deletion is successful, the file size will be returned. If it does not exist, None will be returned.

Accomplish:

Class CloudStorage:
    def __init__(self):
        self.files = {} # name -> size

    def add_file(self, name: str, size: int) -> bool:
        if name in self.files:
            return False
        self.files[name] = size
        return True

    def get_file_size(self, name: str):
        return self.files.get(name, None)

    def delete_file(self, name: str):
        if name not in self.files:
            return None
        size = self.files.pop(name)
        return size

There are no pitfalls in this level, the hash table can be solved directly, and it can be written within 5 minutes.

Level 2: Top N largest files

Filter files by prefix, returning the largest N.

Interface:

  • Get_n_largest(prefix, n) → Return the maximum N files starting with prefix, in the format ["/path/file(size)", ...]

Sorting rules:

  • Sort by size in descending order first
  • The same size is sorted in ascending dictionary order by file name.

Accomplish:

Def get_n_largest(self, prefix: str, n: int) -> list:
    matched = [
        (name, size)
        for name, size in self.files.items()
        if name.startswith(prefix)
    ]
    matched.sort(key=lambda x: (-x[1], x[0]))
    return [f"{name}({size})" for name, size in matched[:n]]

Pitfalls:

  • Sorting is biconditional, size descending + name ascending, size in lambda should be negative
  • When the number of files is less than N, all matching files will be returned directly without reporting an error.
  • No matching files return an empty list [], not None

Level 3: User Capacity and Consolidation

This level adds the user concept, each user has a storage limit, and supports storage merging of two users at the same time.

New interface:

  • Add_user(user_id, capacity) → Register a user and set a capacity limit. Return False if the user already exists.
  • Add_file_by(user_id, name, size) → Add a file for the specified user. If the capacity is exceeded or the file already exists, False is returned.
  • Merge_user(user_id_1, user_id_2) → Merge the files of user_id_2 to user_id_1 and delete user_id_2 after merging.

Accomplish:

Def add_user(self, user_id: str, capacity: int) -> bool:
    if user_id in self.users:
        return False
    self.users[user_id] = {
        "capacity": capacity,
        "used": 0,
        "files": {}
    }
    return True

def add_file_by(self, user_id: str, name: str, size: int) -> bool:
    if user_id not in self.users:
        return False
    user = self.users[user_id]
    if name in user["files"]:
        return False
    if user["used"] + size > user["capacity"]:
        return False
    user["files"][name] = size
    user["used"] += size
    self.files[name] = size # Synchronize to global
    return True

def merge_user(self, user_id_1: str, user_id_2: str) -> bool:
    if user_id_1 not in self.users or user_id_2 not in self.users:
        return False
    u1 = self.users[user_id_1]
    u2 = self.users[user_id_2]

    for name, size in u2["files"].items():
        # When file names conflict, user2’s files are directly discarded.
        If name not in u1["files"]:
            u1["files"][name] = size
            u1["used"] += size

    # Combined capacity
    u1["capacity"] += u2["capacity"]

    # Delete user2
    del self.users[user_id_2]
    return True

Pitfalls:

  • Handling of file name conflicts during merging: user_2’s files are directly discarded without overwriting user_1
  • After the merger, the capacity of user_2 will also be merged into user_1
  • The capacity calculation is maintained using the used field. Do not traverse the file and recalculate it every time.
  • The global files dictionary and user files are to be kept in sync

Level 4: Backup and recovery

This level adds a backup mechanism to support taking snapshots of user storage and restoring to the specified backup state when needed.

New interface:

  • backup_user(user_id, timestamp) → Take a snapshot of the user's current status and record the timestamp
  • Restore_user(user_id, timestamp) → Restore the user to the snapshot state of the specified timestamp. If the timestamp does not exist, return False

Accomplish:

Import copy

def backup_user(self, user_id: str, timestamp: int) -> bool:
    if user_id not in self.users:
        return False
    if user_id not in self.backups:
        self.backups[user_id] = {}
    # Deep copy current user status
    self.backups[user_id][timestamp] = copy.deepcopy(self.users[user_id])
    return True

def restore_user(self, user_id: str, timestamp: int) -> bool:
    if user_id not in self.backups:
        return False
    if timestamp not in self.backups[user_id]:
        return False

    # Delete the user's files from global files before restoring
    current_files = self.users[user_id]["files"]
    for name in current_files:
        if name in self.files:
            del self.files[name]

    # Restore snapshot
    self.users[user_id] = copy.deepcopy(self.backups[user_id][timestamp])

    # Synchronize global files
    for name, size in self.users[user_id]["files"].items():
        self.files[name] = size

    return True

Pitfalls:

After recovery, files of other users will not be affected. Global files will only update the parts related to this user.

Be sure to use it when backing up Deepcopy, if you make a shallow copy, subsequent modifications will affect the snapshot.

When restoring, you must first clear the user's files in the global files, and then rewrite the files in the backup.

The same timestamp may be overwritten. Just overwrite it directly without reporting an error.

The last hurdle before landing, don’t rely on luck

VO What I feared most that day was not the difficult questions, but the fact that my mind went blank when I encountered unexpected questions. I found this interview with Ramp. ProgramHelp Teams make real-time assists. They were online the whole time during the interview, and they directly gave me ideas when I encountered a problem, and the rhythm was not interrupted at all. It’s not an AI-generated template, it’s a real person, a North American CS expert, helping you think about it and knowing what the interviewer wants to hear behind the question. AI gives you a bunch of answers, but it doesn’t know your current context; real people can follow your pace and make up for whatever is missing.

OA ghostwriting, resume packaging,VO assistAll.

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END
 0