Feature #5: Recover Files

Implementing the "Recover Files" feature for our "Operating System" project.

Description

A file contains a byte stream and some optional sections. These optional sections are identified by start and end delimiters. While downloading a file, some delimiters may get corrupted. This means that the starting delimiter may get replaced by an ending delimiter and vice versa. We cannot find which delimiter has been corrupted. Therefore, we need to remove the unmatched delimiters from the file to recover the file.

In this feature, we will make a tool to recover corrupted files by removing the minimum number of unmatched start or end delimiters.

Note: A file can contain nested delimiters.

We will be provided with a string that represents a file. Let’s look at a sample of this:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.