Pizza Puzzle | Puzzles for Interview - Interview Preparation PDF Download

Introduction

At a restaurant, you can order pizzas in boxes of 6, 9, and 20. But what if you want to buy a certain number of pizzas that can't be achieved with any combination of these boxes? There are two types of solutions for this problem: mathematical and algorithmic.

Mathematical Solution

The combination of 6 and 9 can give you all the multiples of 3 (except for 3 pizzas). If a number is not a multiple of 3, then you can use one box of 20 and calculate the remaining value to see if it's a multiple of 3. 
For example, if you want to buy 35 pizzas, you can use 3 boxes of 9 and 1 box of 8. This adds up to 35, which is a multiple of 3. 
However, if you want to buy 28 pizzas, you can use 1 box of 20 and 8 boxes of 6. This only adds up to 28, which is not a multiple of 3. 
In this case, you can try adding another box of 20 and see if the remaining value is a multiple of 3. 
If not, you can repeat this process until you find a combination that works.

Algorithmic Solution

The smallest box size is 6, so if you can achieve 6 consecutive numbers, you can get all further numbers by simply adding one more box of 6. 
For example, if you can buy 6, 7, 8, 9, 10, and 11 pizzas, then you can get any number of pizzas greater than 11 by adding one more box of 6. 
To find these 6 consecutive numbers, you can make combinations in increasing order until you find a pattern. 
On observing the pattern, you can see that the 6 consecutive numbers are from 44 to 49. Therefore, any number of boxes greater than 49 can be achieved with the help of one more box of 6.

Finding the Highest Number of Pizzas You Can't Buy:

Using the mathematical solution, you can see that any number of pizzas greater than or equal to 40 can be bought with the given boxes. 
However, there is one number above 20 that cannot be achieved by any combination of 20, 9, and 6. 
After using a maximum of 2 boxes of 20, the remaining value must be divisible by 3. 
The number 3 cannot be achieved by any combination of these boxes, so the highest number of pizzas that cannot be bought is 20 x 20 x 3 = 43.
Using the algorithmic solution, you can see that the highest number of boxes that cannot be obtained by any combination of 20, 9, and 6 are present before 44, which is 43.

Conclusion

Whether you use the mathematical solution or the algorithmic solution, you can find the highest number of pizzas you can't buy with the given boxes. 
With this knowledge, you can plan your pizza orders accordingly and avoid any disappointment at the restaurant.

The document Pizza Puzzle | Puzzles for Interview - Interview Preparation is a part of the Interview Preparation Course Puzzles for Interview.
All you need of Interview Preparation at this link: Interview Preparation
109 docs

Top Courses for Interview Preparation

109 docs
Download as PDF
Explore Courses for Interview Preparation exam

Top Courses for Interview Preparation

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Sample Paper

,

practice quizzes

,

Pizza Puzzle | Puzzles for Interview - Interview Preparation

,

Extra Questions

,

Pizza Puzzle | Puzzles for Interview - Interview Preparation

,

MCQs

,

Previous Year Questions with Solutions

,

study material

,

Objective type Questions

,

Pizza Puzzle | Puzzles for Interview - Interview Preparation

,

Summary

,

mock tests for examination

,

shortcuts and tricks

,

Semester Notes

,

ppt

,

Free

,

Exam

,

Viva Questions

,

pdf

,

Important questions

,

video lectures

,

past year papers

;