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

Stats:

CreatedOct 11, 2017
PublishedOct 11, 2017
Warriors Trained517
Total Skips5
Total Code Submissions1728
Total Times Completed188
JavaScript Completions188
Total Stars19
% of votes with a positive feedback rating97% of 50
Total "Very Satisfied" Votes47
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes0
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • phantamanta44 Avatar
  • Voile Avatar
Ad