There have been whole 4 rounds
- Machine coding
- DS/Algo
- Design Spherical
- Hiring supervisor Spherical
Machine Coding Spherical: Must implement the multilevel cache design.
Every degree will retailer Key-Worth pairs of information. Each KEY and VALUE are of sort String. L1 is the highest most degree and Ln is the final degree.
You might be given the next configuration and particulars in regards to the system:
Max variety of ranges of cache. The system begins with only one degree initially and grows to a max variety of ranges as per the config.
The capability of every degree, i.e. variety of components that may be saved. The scale is mounted for each degree, though every degree might have a distinct capability.
This Cache system ought to be capable of carry out following operations:
- READ KEY Operation
Learn will begin from L1 degree. If KEY is discovered at this degree, then this worth can be returned. If KEY will not be discovered at this degree, then attempt to learn from the following degree. Preserve doing this till the worth of KEY is discovered at some degree or the final degree has been reached. If the worth of KEY is discovered at some degree, then this VALUE must also be written into the primary degree and the anticipated write habits ought to comply with as specified within the subsequent part. - WRITE KEY Operation
Writes will begin from degree L1. If a degree is full, evict any key-value pair from this degree and write the evicted k-v pair into the following degree. If the following degree can be full, evict any k-v pair from that degree and insert within the subsequent degree and so forth. When you attain the final degree, add a brand new degree and insert the evicted Ok-V pair on this new degree. - DELETE KEY operation
Deletes the given key from all the degrees the bottom line is current in.
Eviction Technique: We’d like the technique to be pluggable. For this downside, implement LFU (Least Incessantly Used) i.e take away the important thing which has been used least regularly.
You may be evaluated based mostly on
DS Algo Spherical: There have been 2 issues it was carried out by interview vector:
- https://www.geeksforgeeks.org/build-lowest-number-by-removing-n-digits-from-a-given-number/
- Variation of prefix sum. Given person and a number of logtime want to search out person with max log time in final 1 hour
Design Spherical: Design flight aggregator system. Aggregator will get knowledge from completely different airways and person will be capable of search and guide flight from aggregator. Interviewee anticipating the excessive degree design. How the information can be fetched from airways concerning the flights and the way it will likely be saved in our database. Segregate the system in numerous microservices. Because the site visitors on search api is excessive so how it will likely be dealt with. Want to indicate connecting flight as effectively if no direct flight is out there. The right way to deal with reserving of various airways and api failures and all.
I informed interviewee that we will use mysql for this utility because it help ACID and our usecase are additionally happy. For looking we will use a number of slaves however he requested if site visitors will increase then how it will likely be dealt with as spawning a brand new slave and replicating the information will take time, which i couldn’t reply. And that was finish of my interview journey