The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Gandalf’s secret mark on the door did its job. One by one, all the dwarves entered Bilbo’s house and Thorin and his band of dwarves took their places.
Bilbo, for one, was as confused as one could be as to what was going on. There were so many dwarves in his house, singing songs about reclaiming the lonely mountain and helping themselves with all the food in his house. Anyone else would probably have lost their cool and asked the uninvited guests to leave but not Bilbo. He had always been a brilliant host and it was going to stay that way.
He decided to help but he’d be smart about it. Bilbo figured that he’d have to clean up on his own afterwards, so he came up with a scheme that would allow him to use very few glasses. Since everyone could not fit at the table at once, they had supper in turns and the once a dwarf completed his supper and went out, his glass was available to be used by a new dwarf entering the room.
Bilbo marked the time at which each person sat down to eat and got up. Now, assuming that there’s no time lag between a person getting up from the table another taking his place and assuming that the glass can also be used by the other person right away, what is the minimum number of glasses that Bilbo should set at the table so that everyone can have their supper.
Let ‘n’ be the total number of uninvited dwarfs and let ‘s’ and ‘t’ be the starting and finishing time respectively for each one of them, then output the minimum number of glasses at the table that would do the job.
The first line of the input contains an integer t denoting the number of testcases.
Every testcase consists of the following lines:
The first line contains an integer n denoting the number of uninvited dwarfs.
The next n lines contain two space separated integers denoting the starting time s and finishing time f respectively.
NOTE: s will always be smaller than f
For every testcase output a single line containing an integer denoting the minimum number of glasses required.
1
1
1
Input: 1 7 1830 1925 1920 2000 1915 1950 1845 1930 1850 1855 1800 1900 1905 1945 Output: 5
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll