Amazon VO Interview Question: Design a String Compress/Decompress System with Normalization, Persistence, and Async Processing

15 Views
No Comments

Design a String Compress(string input) system.

The system should support compressing an input string and later decompressing it back to the original form.

Example 1

Input 1: "This is soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo good"
Output 1: "This is s12o g18od"

Example 2

Input 2: "this"

Discussion

What will be the output?

A: You need to define it so that Decompress can decode and decompress it back.

This question is about designing a reversible string compression workflow rather than just implementing a simple replacement. The diagram suggests a pipeline with authentication, validation, normalization, persistence, and asynchronous processing, with storage in S3 and PostgreSQL/Aurora. A good solution must define a deterministic encoding scheme, such as run-length compression for repeated characters, so that decompression can reconstruct the original string exactly. The key ideas are input normalization, an unambiguous compression format, and a clean separation between synchronous validation and asynchronous storage/processing.

END
 0