This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-19
Channels
- # arachne (1)
- # beginners (108)
- # boot (50)
- # cljs-dev (7)
- # clojure (76)
- # clojure-ireland (1)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (33)
- # clojure-taiwan (1)
- # clojure-uk (36)
- # clojurescript (46)
- # core-async (13)
- # datomic (146)
- # defnpodcast (1)
- # editors (1)
- # garden (2)
- # hoplon (1)
- # jobs (1)
- # lumo (7)
- # off-topic (21)
- # om (9)
- # pedestal (1)
- # re-frame (25)
- # reagent (5)
- # specter (2)
- # testing (3)
- # unrepl (3)
- # untangled (9)
- # vim (1)
Hey anybody want to help me with an interview problem?
I don't know the exact problem yet but I know what the nature of the problem is...
Basically there are cabins that you rent out by the night, and people want to make reservations
Say you have 4 cabins and 10 guest-groups that are going to stay in them over the course of a month
The task is to find a good packing of timeslots so that all the guests get their preferred days and we also minimize the number of "gap days" or one-day-span free slots, since it's hard to rent out a remote cabin for just a single night.
Well, it kind of leads that direction. profit will increase with more reservations, we just want to pack them efficiently so that when new reservations surface we don't have fragmented days that we can't rent out.
But you're saying that maybe the cabins are different prices, and therefore we would want to maximize cha-ching$$
I'm just focused on the leave-no-one-day-gaps issue at the moment. But you're right, that's probably a smart way to go ...
I have not received any details yet
But I was given a generous hint ^
So, I'm trying to do my mental prep beforehand ^^
but let's say instead of maximizing profit$ we are maximizing the number of contiguous stretches of free days...
Yeah, that's true! I was thinking ... np-complete, but then noticed there are quite a lot of "restraints" so-to-speak. It's 2D which is convenient, and it's possible to brute-force over all the solutions. It's certainly an interesting exercise
A lot of places do set quantities of days for rental (e.g. Fri to Mon, Fri to Fri, Mon to Fri, and Mon to Mon). You could possibly work that into the mix if they'd consider that route. It would negate the single day gap issue