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: | 431 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Chef buys a new restaurant. At his new restaurant, he calls his rival chef named 'Code'. Also he places all his dishes on N different tables in
such a order that, the
first table contains dish "a" and second one contains dish "b". From next table onwards dishes are arranged in such a way that, the dish on the given
table is the mixture of the
previous two table's dishes, i.e., the dishes on table 1, 2, 3, 4, 5, 6 will be "a", "b", "ba", "bab", "babba", "babbabab" respectively and so on.
Code goes to Kth table and performs m queries on the dish at that table to annoy chef.
On each query he picks up a different section si of the dish and asks chef, the number of occurrences of si in the given dish.
the section in the order in which they are given in the input.
Input: 6 5 a b ab ba aba Output: 3 5 3 3 1 Input: 10 10 bb ab ba aa bb ab ba aa bb ab Output: 12 21 21 0 12 21 21 0 12 21
Case 1 : Code goes to table number
6, which contain babbabab as the dish. Section 'ba' has occurred 3 times in the given dish. Similarly aba has occured once in the given dish.
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