Retired

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:

  1. 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}

  2. 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"]

  3. 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

Fundamentals
Higher-order Functions
Functions
Control Flow
Basic Language Features

Stats:

CreatedJul 10, 2021
Warriors Trained12
Total Skips0
Total Code Submissions21
Total Times Completed8
JavaScript Completions8
Total Stars0
% of votes with a positive feedback rating0% of 4
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes4
Total Rank Assessments5
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • rajkarthik Avatar
Ad