Roblox - Senior Frontend Engineer - Technical Phone Screen
Role details
- Level: Senior
- Education: Bachelors
- Years of Experience: 8
Questions Asked:
topological sort similar to course schedule 2:
/*
Prompt:
You're given a list of character features (e.g., "Head", "Hair", "Hat", "Torso") for a Roblox-style game.
Goal:
Return one valid ordering of all components so that every dependency is added before its component.
If it's impossible (a cycle exists), return ["Error"].
🧠 Example 1 — Simple chain
input = [["Hair", "Head"], ["Hat", "Hair"], ["Head"]]
Explanation: Head → Hair → Hat
Output: ["Head", "Hair", "Hat"] ✅
----------------------------------------------------
🧠 Example 2 — Cycle (impossible)
input = [["Hair", "Head"], ["Head", "Hair"]]
Explanation: Hair ↔ Head forms a loop
Output: ["Error"] ❌ (cycle detected)
*/
function buildCharacter(items: string[]){
}
I hadn’t fully reviewed / grasped topological sort and was hoping i wasnt going to get this question for Frontend, but I did and could not finish solution on time.
Highly recommend these 2 leetcode problems which are similar
- course schedule 1 (like course schedule 2 but you dont need to return and reverse items
- course schedule 2 (almost same as roblox problem)