← Back to experiences
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/experiences/…$
Level: Staff-Level
Round: Online Assessment · Type: System Design · Difficulty: 7/10 · Duration: 60 min · Interviewer: Neutral
Topics: System Design, Cloud Storage
Location: Mountain View, CA
Interview date: 2026-01-31
I was given a system design problem to design a cloud storage system.
The coding question I got was:
class CloudStorage {
/**
* Adds a new file with the given `name` and `size` (in bytes) to the storage.
* If a file with the same `name` already exists, the operation fails.
* Returns `true` if the file is successfully added, `false` otherwise.
*/
boolean addFile(String name, int size) {
// Implementation details
}
/**
* Creates a duplicate of the file at `sourceName` and saves it as `targetName`.
* Fails if `sourceName` does not exist.
* Fails if `targetName` already exists.
* Returns `true` if the copy succeeds, `false` otherwise.
*/
boolean copyFile(String sourceName, String targetName) {
// Implementation details
}
/**
* Returns the size of the file in bytes.
* If the file does not exist, return `-1`.
*/
int getFileSize(String name) {
// Implementation details
}
}
My approach:
addFile method by checking if the file exists, and then uploading it to the object storage.copyFile method involves retrieving the source file from object storage and writing it to a new location with the target name.getFileSize method retrieves metadata from the object storage.Key insights: