Anonymous · shared experience1 Oct 2025 · 5 views
Roblox: Randomly split an array into non-empty segments
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.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.