Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Essentially, you are given a complete list of directories and files in the file system, and then a subset of files. Return an augmented

. Essentially, you are given a complete list of directories and files in the file system, and then a subset of files. Return an augmented list of the subset, where if all files in a directory are listed in the subset, replace those file names with the directory name.
Example input & output:
allFiles =[
"a/b/c/d.txt",
"a/b/c/e.txt",
"a/b/b.txt",
"a/b/e.txt",
"b/c/d.txt"
"d/ab/somefile.txt""da/b/somefile.txt"
]
subsetFiles =[
"a/b/c/d.txt",
"a/b/c/e.txt",
"a/b/b.txt",
"b/c/d.txt",
"d/ab/somefile.txt ","da/b/somefile.txt"
]
output=[
"a/b/c",
"a/b/b.txt",
"b",
"d/ab/"
"da/b/"
]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions