Roblox Interview Question

Leetcode question from tagged bank