TATA Consultancy Services Interview Question for Software Engineer / Developers
- 0of 2 votes
A teacher wanted 100 gems distributed in 7 purses such that number of gems in 7 purses should always sum up to 100. But his condition was that he can demand any number of gems between 1 to 100 and Shiva must be able to satisfy his demand without needing to open any purse. Also once Shiva packs the purses, he will not get another chance to rearrange the number of Gems in those 7 purses. So consider that these purses are sealed the moment Shiva puts appropriate number of Gems in it.- chouhan.mayank August 14, 2013 in India
Out of affection, the teacher decided to step up the difficulty level so that Shiva can survive the turbulent world outside the Gurukul. The Guru added one more condition that out of 7 purses Guru will always fill one purse with any number of gems. Thus Shiva need to distribute remaining Gems in rest of the 6 purses.
As a new techie your task is to write a computer program to help Shiva in fulfilling his Guru's demand.
| Report Duplicate | Flag | PURGE
TATA Consultancy Services Software Engineer / Developer Algorithm
Interview Type: In-Person
Open Chat in New Window