I recently finished up with Roblox Interview and thought to share my experience so that it can help others.
Phone Interview:
Given an array of strings, we ideally would like to remove any strings that have a longer prefix.
Ex. ["ab", "abc", "abcd", "bc", "bcd", "bd"]
Here, "abc" can be removed as "ab" is there. "abcd" can be removed as "ab" as well as "abc" is there. Similarly, "bcd" can be removed as "bc" is there.
Output: ["ab", "bc", "bcd"]
Full Loop
Design Bump Allocator where you can pre-request for a huge chunk of memory and on-request give back a shorter memory that is requested. The API will always call our API whenever memory is needed. Return NULL if your pre-requested memory cannot fulfil memory requirements.
Given an array with some integer numbers and numSegments, the goal is to divide the array into numSegments by picking random elements from the original array. Each number should be equally probable to land up in subarray.
Ex. arr = [1,5,10,2,4,3]; numSegments = 3
So, we need to divide above array into 3 segments by choosing random elements. The output should be as left justified as follows i.e. each output subarray should have atleast one element and then more elements should be as left as possible.
Output:
[[1,10],[5,3],[4,2]] for numSegments = 3
[[1,10],[5,2],[4],[3]] for numSegments = 4; Note that "2" wasn't added with 4 or 3 as it needed to be as left as possible.
System Design:
Design ResourceLoader which loads some resource from either disk or CDN and keeps it in memory so that any clients can then use it.
The problem statement was above and no other information was given. I believe the expectation was to design a multithreaded solution with how the class and APIs may look like and who is calling whom etc etc. But I am not sure how the question needs to be approached or what the interviewer had in mind. If someone have of tips of what is expected out given above, feel free to provide helpful resources on how to approach such design questions.