Roblox software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
Is Function Complete You need to implement a function isFuncComplete that determines if a code string represents a "complete" input. This is a...
Building Height Management You are managing a row of building structures with varying heights. Your goal is to transform these structures into a...
Input: Number(s)Problem Statement Design a matchmaking system for a multiplayer game that pairs users with the best game instance to ensure users have the optimal...
Input: Graph (nodes and edges)flaggedTerms: a list of detected violation...Input: ListRequestRateDetector class. configure(limit: int, window: int) -...Input: Number(s)tasks of length n and an integer...Input: Arraytarget. Implement a function to find the index of the lowest rating that is greater than or equal to target. If no such rating exists, return -1.def find_best_game_index(ratings: List[int], target: int) -> int:ratings = [1, 3, 5, 7, 9], target = 6 3 6 is 7, which is at index 3.ratings = [1, 3, 5, 7, 9], target = 10 -1 10.0 <= len(ratings) <= 10^4 -10^4 <= ratings[i] <= 10^4 ratings will be sorted in ascending order.def maximize_revenue(revenue: List[int]) -> int: [3, 2, 5, 10, 7] 15 [1, 2, 3, 1] 4 1 <= len(revenue) <= 1000 0 <= revenue[i] <= 1000 def binary_tree_paths(root: Optional[TreeNode]) -> List[str]:root = [1,2,3,null,5] ['1->2->5', '1->3'] 1 to leaves 5 and 3 are valid. root = [1] ['1'] [1, 100].[-1000, 1000].s representing a sequence of characters in Roblox, full of various gameplay actions, find the length of the longest substring without repeating characters. This substring represents a period of unique gameplay actions without repetition. def length_of_longest_substring(s: str) -> int:"abcabcbb" 3 "abc", with length 3.Example 2: "bbbbb" 1 "b", with length 1.Constraints: 0 <= len(s) <= 50,000 s consists of English letters, digits, symbols, and spaces.startTime, endTime, and a priority level. Your goal is to maximize the number of high-priority tasks that can be scheduled without overlapping. Overlapping occurs when one task's startTime is less than another's endTime. def schedule_tasks(tasks: List[Tuple[int, int, int]]) -> List[Tuple[int, int, int]]: [(1, 3, 1), (2, 5, 2), (4, 6, 1), (6, 8, 2)] [(1, 3, 1), (4, 6, 1)] [(1, 4, 3), (3, 5, 2), (5, 7, 2), (8, 10, 3)] [(1, 4, 3), (5, 7, 2), (8, 10, 3)] Background
Requirements
disk_load and cdn_load. Each accepts an asset ID and returns immutable, nonempty bytes or None when unavailable. On a cache miss, consult disk first and consult the CDN only if disk returns None. Do not write CDN results back to disk.acquire(asset_id) returns the asset's bytes and adds one active reference. A cache hit does not invoke either callback and makes the asset most recently used. A successful cache insertion starts with one reference and is also most recently used. An entry with at least one reference is pinned and cannot be evicted.None without changing cache contents, reference counts, or order. Once disk returns bytes, do not try the CDN even if those bytes cannot be admitted.release(asset_id) removes exactly one active reference and returns True; return False if the asset is absent or already has zero references. Releasing an asset does not change its recency or immediately evict it. invalidate(asset_id) removes an unpinned cached asset and returns True; return False for an absent or pinned asset.None and is not negatively cached. Callback exceptions propagate, leaving the cache unchanged. snapshot() returns (asset_id, byte_size, reference_count) tuples in least-to-most-recently-acquired order, without changing state. All failure paths must preserve the same ordering as well as the same contents.Class API
AssetResourceLoader(capacity_bytes: int, disk_load: Callable[[str], bytes | None], cdn_load: Callable[[str], bytes | None]) — construct an empty loader; reject nonpositive capacity with ValueError.acquire(asset_id: str) -> bytes | None — acquire one reference to an available, admissible asset.release(asset_id: str) -> bool — release one reference without changing recency.invalidate(asset_id: str) -> bool — remove an entry only when it is unpinned.snapshot() -> list[tuple[str, int, int]] — return a detached view of cached entries in eviction order.Example 1
10 bytes. The disk fixture contains mesh:A = b"AAAA" and texture:B = b"BBBB". The CDN fixture contains audio:C = b"CCCCCC". Missing fixture keys return None.Input sequenceacquire("mesh:A")
acquire("texture:B")
release("mesh:A")
acquire("audio:C")
snapshot()
invalidate("texture:B")
release("texture:B")
invalidate("texture:B")
snapshot()Output, one result per callb"AAAA"
b"BBBB"
True
b"CCCCCC"
[("texture:B", 4, 1), ("audio:C", 6, 1)]
False
True
True
[("audio:C", 6, 1)]Explanation: Initially, the cache uses 4 + 4 = 8 bytes. Loading the six-byte audio asset requires reclaiming four bytes. mesh:A is unpinned and oldest, so evicting it leaves 4 + 6 = 10 bytes. texture:B cannot be invalidated until its active reference is released.Example 2
8 bytes. Disk contains mesh:A = b"AAAA" and texture:B = b"BBBB". CDN contains audio:C = b"CCCCCC".Input sequenceacquire("mesh:A")
acquire("texture:B")
release("mesh:A")
acquire("audio:C")
snapshot()
release("texture:B")
acquire("audio:C")
snapshot()Output, one result per callb"AAAA"
b"BBBB"
True
None
[("mesh:A", 4, 0), ("texture:B", 4, 1)]
True
b"CCCCCC"
[("audio:C", 6, 1)]Explanation: The first audio acquisition needs six bytes reclaimed because 8 + 6 - 8 = 6. Only four bytes are unpinned, so admission fails without evicting mesh:A. After releasing texture:B, both four-byte entries are eligible. The second attempt loads the audio again and evicts both entries, leaving six cached bytes.Constraints
1 <= capacity_bytes <= 10^9; at most 10^5 method calls and 10^5 distinct asset IDs.1 through 10^9.O(1) cache hits, releases, and invalidations; cache-miss admission may scan cached entries.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free