Given a set of lockers that can be one of three sizes: s, m, l, and boxes that can be one of three sizes: s, m, l, implement the assignLockerToBox and getLockerForBox methods.
Assignment rule: prefer same-sized lockers/boxes. If there are no available same-sized lockers, smaller boxes can go in bigger lockers.
这道题考察的是三种尺寸资源的分配策略,核心是按规则优先匹配同尺寸,如果没有同尺寸则让更小的箱子进入更大的柜子。由于尺寸只有 <code>s</code>、<code>m</code>、<code>l</code> 三种,通常可以用三个队列或计数结构分别维护各尺寸的可用柜子,再在分配时按“同尺优先、向上兼容”的顺序选择,属于典型的贪心匹配问题。