Answered step by step
Verified Expert Solution
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 abcdtxt abcetxt abbtxt abetxt bcdtxt dabsomefiletxtdabsomefiletxt subsetFiles abcdtxt abcetxt abbtxt bcdtxt dabsomefiletxt dabsomefiletxt output abc abbtxt b dab dab
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
abcdtxt
abcetxt
abbtxt
abetxt
bcdtxt
dabsomefiletxtdabsomefiletxt
subsetFiles
abcdtxt
abcetxt
abbtxt
bcdtxt
dabsomefiletxt dabsomefiletxt
output
abc
abbtxt
b
dab
dab
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started