6 kyu
File Finder
Description:
Sometimes some annoying students decide to mess around by creating horrible amalgamations of nested folders in shared directories. Sometimes they'll even stick a file in there as a sort of tedious file explorer "treasure hunt". In this kata, you'll have to search through a virtual filesystem of sorts to find a file, then return the path to the file. For example:
let files = {
'New folder': {
'New folder': {}
},
'New folder (1)': {
'New folder': {
'funnyjoke.txt': 'lol i pranked you!!!'
}
},
'New folder (2)': {}
};
console.log(search(files)); // New folder (1)/New folder/funnyjoke.txt
Sometimes there might not be a file in the filesystem. In that case, just throw an error. You're always guaranteed to receive a filesystem with either one or zero files.
Good luck!
Recursion
Algorithms
Similar Kata:
Stats:
Created | Oct 11, 2017 |
Published | Oct 11, 2017 |
Warriors Trained | 517 |
Total Skips | 5 |
Total Code Submissions | 1728 |
Total Times Completed | 188 |
JavaScript Completions | 188 |
Total Stars | 19 |
% of votes with a positive feedback rating | 97% of 50 |
Total "Very Satisfied" Votes | 47 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |