constraint-programming

Solving “Who owns the Zebra” programmatically?

此生再无相见时 提交于 2019-11-26 19:16:17
Edit: this puzzle is also known as "Einstein's Riddle" The Who owns the Zebra (you can try the online version here ) is an example of a classic set of puzzles and I bet that most people on Stack Overflow can solve it with pen and paper. But what would a programmatic solution look like? Based on the clues listed below... There are five houses. Each house has its own unique color. All house owners are of different nationalities. They all have different pets. They all drink different drinks. They all smoke different cigarettes. The English man lives in the red house. The Swede has a dog. The Dane

Appointment scheduling algorithm (N people with N free-busy slots, constraint-satisfaction)

血红的双手。 提交于 2019-11-26 19:04:51
问题 Problem statement We have one employer that wants to interview N people, and therefore makes N interview slots. Every person has a free-busy schedule for those slots. Give an algorithm that schedules the N people into N slots if possible, and return a flag / error / etc if it is impossible. What is the fastest possible runtime complexity? My approaches so far Naive: there are N! ways to schedule N people. Go through all of them, for each permutation, check if it's feasible. O( n! )

Solving “Who owns the Zebra” programmatically?

白昼怎懂夜的黑 提交于 2019-11-26 08:57:30
问题 Edit: this puzzle is also known as \"Einstein\'s Riddle\" The Who owns the Zebra (you can try the online version here) is an example of a classic set of puzzles and I bet that most people on Stack Overflow can solve it with pen and paper. But what would a programmatic solution look like? Based on the clues listed below... There are five houses. Each house has its own unique color. All house owners are of different nationalities. They all have different pets. They all drink different drinks.