0 day streak
Anonymous · shared experience1 Oct 2025 · 5 views

Roblox: Randomly split an array into non-empty segments

Interview question #Roblox DSA / coding

Problem. Split an integer array into a given number of subarrays by choosing elements at random, so that each element is equally likely to end up in any subarray. Every subarray must get at least one element, and elements are placed as far left as possible. The post gave worked examples for three and four segments.

What to think about. Pin down exactly what "equally likely" means with the interviewer before coding, make sure no subarray can end up empty, and say how you would test that the output is really uniform.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.