You have a very very big number 2123470299109372 and a given integer k [let's say k=6], you need to find largest k digit number which is a subsequence of the original number. ans=999372
Gave a very lame solution at first (digit dp), then while coding realized that better solution exists. But interviewer didn't listen may be or somewhat communication issue from my end, so ended up optimizing digit dp.
At last I explained what I was trying to do with the montotic stack approach (the better one) and interviwer also agreed yeah this would've been better. Anyways, Interviewer was very smart so he got this quickly and interview ended on a somewhat normal to good note.
Recruiter called after a week, and told You have Cleared, Prepare for Onsite. But I was like why and how I cleared this?
Anyways Let's move on....
Onsite : Guaranteed 4 rounds (also its not actually 'onsite', they should change the name)
Couldn't find any similar question link. Let me know if there is any.
| Name | Start Time | End Time |
|---|---|---|
| Harry Puttar | 10 | 100 |
| Tony Bhai Stark | 60 | 120 |
| Sherlock Bholmes | 30 | 70 |
| Katniss Devi | 150 | 300 |
| Start Time | End Time | Waiters on Duty |
|---|---|---|
| 10 | 30 | Harry Puttar |
| 30 | 60 | Harry Puttar, Sherlock Bholmes |
| 60 | 70 | Harry Puttar, Sherlock Bholmes, Tony Bhai Stark |
| 70 | 100 | Harry Puttar, Tony Bhai Stark |
| 100 | 120 | Tony Bhai Stark |
| 150 | 300 | Katniss Devi |
Design, Implement and Test a Tree, which is built on the following rules
You are given a list of strings: ["apple", "app", "bat", "batter", "battle", "cat"]
The root of the tree is an empty string.
For any string in the list, if there exists another string that is a prefix of it, then the shorter string becomes the parent node of the longer string. If there are multiple possible parents, choose the longest prefix as the parent.
For example, "app" is a prefix of "apple", so "app" becomes the parent of "apple".
Your task is to build and represent this tree structure.
""
/ | \
app bat cat
/ / \
apple batter battlemap so that string to Node mapping I can find quickly. The other one using TrieDesgin, Implement and Test.
[N rows and M cols], how many different patterns can be created. Rules -
left, right, top and bottomGive me an estimate of how big will this final answer be?. Gave a rough estimate by visualizing the recursive tree, but its very hard to give an answer. Branches can end at any length, but he seems satisfied with the approach I told to calculate to estimation.If I enable 8 directional movement, (means corners are now available), how will you change your code?. I changed the direction array. Also give estimation for this, gave similar way.If now user can move from any point in grid to any other point in grid (no need of neighbours), how much will be estimation?. This was easy. It can be easily calculated using PnC.STAR method is needed to answer these questions. This is a good resouce for this round.current_base >= highest_possible_base_of_google_L3They really declared it fast, I didn't expect this too.
Awaiting team match now
Those who thinks Google Interview is just about DSA, please share them this post. Yes there are questions from monotonic stack or Trie, but Pnc, answer estimation, design and test etc are also being asked. Go spam your influencer Bhaiyya's and Didi's to also teach about these.