212. Magic Sorting Hat — Assign Houses
Easy · Array
Given a list of student bravery scores (0-10), assign each to a house: score ≥ 8 → 'Gryffindor', score ≥ 6 → 'Ravenclaw', score ≥ 4 → 'Hufflepuff', else → 'Slytherin'. Return the list of house names.
Examples
Example 1 Input: scores = [9, 5, 7, 3] Output: ["Gryffindor","Hufflepuff","Ravenclaw","Slytherin"] Explanation: Each score maps to a house
Constraints
- 1 ≤ len(scores) ≤ 50, 0 ≤ score ≤ 10