4 ms·
There might be a really clever hash you could build, but it's actually a somewhat complex problem. Finding an overlapping range between two entities is easy...
by enjo 10y ago
There might be a really clever hash you could build, but it's actually a somewhat complex problem. Finding an overlapping range between two entities is easy... finding it for n-entities is a bit more difficult particularly if you want to do it efficiently. I can imagine a couple of answers.. you can build a lookup table (which makes sense if the time resolution is low enough) and then find gaps in it.
It's actually a pretty good interview question if your going to ask a whiteboard question. It has lots of answers depending on requirements. You can get into parallelizing it for speed. It's more of a practical problem than most and you can implement it basically any language.
- karussell 10y agoIt is still just a bitwise AND
- TorKlingberg 10y agoSure, if you store everyones calendars as bitmaps of free minutes, but that seems like a very inconvenient format for other operations.