Triplebyte Interview Question for Software Engineers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

It will be more robust if we store the meta information by the original key

memcache.get("_objectOne_")

should return the meta information = N parts. Than you request each part by _objectOne_Npart_Ntotal (actually Ntotal not neccessary if we store metainformation by the original key) and combine that and return from the wrapped implementation

- Arseny Kovalchuk October 13, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Convert the object into a byte array and split the array into multiple arrays each equal to 1 MB (size - 1024*1024). Store each of the subarrays in the cache using their hashcode. Create a list which contains all such hashcodes of the subarrays and store it against the original key in the cache.

- turukmakto1990 December 14, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Have a wrapper class (kind of) that accepts entire object and internally splits the object into 1MB chunks and uses memCached methods to actually cache.

In order to logically retrieve the 1MB chunks, the "key" can be chosen such that it helps in consolidating the retrieved chunks. Ex- Hypothetically, if the data is simply a text of say huge words. then if we break into 1mb, some words might be broken. So if key can be selected such that it indicates if its part of same word or a different word altogether, it will help in retrieving the data. Say keys can be "1a, 1b, 1c, 2,3,4,5a ...".

- Anonymous December 27, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

The first thing that comes into my mind, divide the object (actually an array of bytes) into the parts by 1MB modulo. You'll get say N parts. Than create the memcache keys like _objectKey_Npart_Ntotal_ and put to the memcache each part of the array with the appropriate key. Also you need to create another level of abstraction (get and set methods) around memcache and encapsulate the logic above inside it

- Arseny Kovalchuk October 13, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More