请教两个面试题# JobHunting - 待字闺中
l*y
1 楼
都是glassdoor上看到的面经:
1. You have a number of meetings (with their start and end times). You need
to schedule them using the minimum number of rooms. Return the list of
meetings in every room.
似乎可以把会议按个插入各个房间中。只要某会议与现有所有已安排的会议室都有冲突
,就安排出新会议室。如果没有冲突,就任意插入现有会议室。但这样做似乎没办法保
证使用房间最小化。
2. Implement two functions that assign/release unique id's from a pool.
Memory usage should be minimized and the
assign/release should be fast, even under high contention.
似乎可以用一个hashset来维护所有可用id,但这样用的内存太多。还有别的什么办法
可以保证assign/release快速,但内存消耗少吗?
1. You have a number of meetings (with their start and end times). You need
to schedule them using the minimum number of rooms. Return the list of
meetings in every room.
似乎可以把会议按个插入各个房间中。只要某会议与现有所有已安排的会议室都有冲突
,就安排出新会议室。如果没有冲突,就任意插入现有会议室。但这样做似乎没办法保
证使用房间最小化。
2. Implement two functions that assign/release unique id's from a pool.
Memory usage should be minimized and the
assign/release should be fast, even under high contention.
似乎可以用一个hashset来维护所有可用id,但这样用的内存太多。还有别的什么办法
可以保证assign/release快速,但内存消耗少吗?