Persona OA Interview | Codesignal 90 mins 4 Questions Explanation

922 Views
No Comment

Recently had it done. Persona OA, the overall experience and the traditional leetcode algorithm questions are completely different, more like OOD + system design simplified version of the realization of a large amount of code, but clear thinking can be stable over. The whole OA in Codesignal platform, the length of 90 minutes 4 questions, and to note: must complete a level to unlock the next level, can not skip questions.

I've brushed through Meta, Circle, and Coinbase's OA before, and these are all similar in question type, more biased towards scenario design and object oriented, which is completely different from purely brushing leetcode.

Persona OA

Persona OA Topic Recall

This set of Persona's OA is unlocked in levels, 4 levels in total, with each level expanding on the previous one.

Level 1 - Basic File Operations
Implement a simple in-memory cloud storage system with support for basic file operations.

add_file(name: str, size: int) -> bool
Add a new file with the given name and size. return True if the file was added successfully, or False if a file with the same name already exists.

copy_file(name_from: str, name_to: str) -> bool
Copy an existing file to a new file. The operation should fail if the source file does not exist, or if the target file already exists. The operation should fail if the source file does not exist, or if the target file already exists.

get_file_size(name: str) -> Optional[int]
Return the size of the given file if it exists, otherwise return None.

The core is to implement a file dictionary that supports adding, copying, and querying the size, while ensuring that the boundary conditions are correct.

Level 2 - File Search by Prefix and Suffix
Extend the storage system with search functionality.

find_by_prefix(prefix: str) -> List[str]
Return a list of all files whose names start with the given prefix.

find_by_suffix(suffix: str) -> List[str]
Return a list of all files whose names end with the given suffix.

The point of the test is mainly string matching, can use simple traversal over the line, do not require the most efficient, but to consider the case of multiple files, null results, and so on.

Level 3 - User Management and Quotas
Introduce user accounts with storage capacity limits. All users share the same file system, but each has an individual quota.

add_user(user_id: str, capacity: int) -> bool
Add a new user with the given capacity (bytes). Return False if the user already exists.

add_file_by(user_id: str, name: str, size: int) -> Optional[int]
Add a new file owned by the given user. The operation fails if the user does not exist, if the file name already exists, or if adding the file would exceed the user's quota. On success, return the remaining capacity for that user.

update_capacity(user_id: str, capacity: int) -> Optional[int]
Update the quota for the user. If the user's total storage exceeds the new quota, remove files until usage fits the quota. Removal policy. Removal policy: delete the largest files first, and if sizes are equal, remove files with lexicographically larger names first. Return the number of files removed, or None if the user does not exist.

Here is the most complex level, you need to maintain file attribution, capacity calculations, and write clear sorting logic for deleted files.

Level 4 - Compression and Decompression
Finally, support compressing and decompressing files.

compress_file(name: str) -> bool
Compress the given file. Its size should be reduced (e.g., halved or encoded in some way). Return False if the file does not exist or is already compressed.

decompress_file(name: str) -> bool
Restore the file back to its original size. Return False if the file does not exist or is not currently compressed.

The implementation can be more flexible, do not really need to write compression algorithms, as long as the logical distinction between "compression" and "decompression", and ensure that the file size can be restored.

Summarize

Persona OA is not a purely algorithmic question, but an object-oriented + system design implementation. If you only brush leetcode, the first encounter may panic, but as long as you have read similar questions in advance (Meta, Coinbase kind of OOD OA), you will feel that the formula is almost the same.

This type of question is more of a test:

  • Demand dismantling capabilities
  • API Design Ideas
  • data structure organization
  • Treatment of border situations

Prepare by brushing up on a few sets of OOD-style OA's for the Codesignal platform, and once you're familiar with them, you'll be able to pass the 90-minute, 4-question exam with flying colors.

OA too difficult? Our team takes the whole thing flying, without getting stuck or dropping the ball!

For OA like Persona, which is an OOD + big project style, many students tend to panic when they encounter it for the first time, and the logic is not broken down clearly before they write it. Our team has been providing OA Total Assistance:

Remote on-line without traces to ensure that all test case 100% passes

Real-time voice alerts to help you clear your mind when you get stuck

Interview scenarios can also be supplemented with ideas and pointers to ensure that you don't get stuck

If you're also preparing for OOD style OA/interviews like Persona, Meta, Coinbase, feel free to come and talk to us. We'll help you break down the big, complex questions in place and not drop the ball when it counts.

author avatar
jor jor
END
 0
Comment(No Comment)