Tuesday, September 12, 2017

Trending Interview Question Puzzle | Pirates and Gems

Trending Interview Question Puzzle | Pirates and Gems

Question:

Seven pirates attacked the British ship and looted some rare gems from them. They decided to rest for some time and then divide the gems later. While everyone was resting, two pirates wake up and planned to divide gems equally between the two. When they divided gems equally, one gem was left. So, they decided to wake up the third pirate and divide among three, but alas again one gem was left. They decide to wake up the fourth pirate to divide the gems and again one gem was left. The same happened again with the fifth and sixth. Finally, they woke up the 7th pirate and this time the gems were divided equally.

How many minimum gems did they stole in total ?


Solution:

301

Explanation:

1. When there are two pirates, 301/2 = 1 (Remainder)
2. When there are three pirates, 301/3 = 1 (Remainder)
3. When there are four pirates, 301/4 = 1 (Remainder)
4. When there are five pirates, 301/5 = 1 (Remainder)
5. When there are six pirates, 301/6 = 1 (Remainder)
6. When there are seven pirates, 301/7 = 0 (Remainder)


No comments: