Cineplex Problem | Undercover Engineer Series (retired)
Description:
You are the manager of Cineplex, a famous cinema complex. You are secretly an undercover engineer, who loves solving complex problems. (Un)fortunately, all employees went on leave, you are supposed to make use of your engineering skills
As a manager you are provided with customer data containing their name, age, movie, meal option. Sample format as below:
list = [
{ name: 'Noah', age: 19, movie: 'Spider Man',
meal: 'Biryani' },
{ name: 'Amaran', age: 15, movie: 'Scooby Doo',
meal: 'Pasta' },
{ name: 'Silva', age: 44, movie: 'Sins',
meal: 'Kosher' }]
Your tasks with meals planning as below:
Your first task is to plan the meals, so you will be giving a list of items to be cooked to your Chef
planMeals(list)
should return list of meals like{Pasta:2,Kosher:1,Veg:2, Biryani:1}
Second task is to handle shortage, if an item is not available, then it should not be counted. Ex: If "Biryani" is not available then "Biryani" should not be counted
planMealsWithShortage(list,notAvailable)
should return list of meals like{Pasta:2,Kosher:1,Veg:2}
.notAvailable
will be an array of meals that are not available, ex:["Biryani"]
Pro task: If an item is not available then add an alternative meal (most preferred). Ex: If "Biryani" is not available and "Pasta" is most preferred, then add "Pasta" instead. Incase of equal preference, prefer alphabhetically first item.
planMealsWithAlternative(list,notAvailable)
should return list of meals like{Pasta:3,Kosher:1,Veg:2}
.notAvailable
will be an array of meals that are not available.
Bon Appetite
Similar Kata:
Stats:
Created | Jul 10, 2021 |
Warriors Trained | 12 |
Total Skips | 0 |
Total Code Submissions | 21 |
Total Times Completed | 8 |
JavaScript Completions | 8 |
Total Stars | 0 |
% of votes with a positive feedback rating | 0% of 4 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 5 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |