Wednesday, August 26, 2015

MJ [27] Find Alibaba

Question:
A thief steals from n houses denoted from 0 to n-1. To avoid to be caught, the thief cannot stay in the same house in two successive days and can only move to the left or right house on the next day. For example, if the thief steals house 5 on day 8, he must move to house 4 or 6 one day 9.

The police is trying to catch the thief with a strategy. strategy[i] (i=0,...,k-1) indicates the house to be searched on day i. The police catches the thief if they are in the same house on the same day. Write a program to determine whether the police can catch the thief by the strategy.

Ref
[1] http://www.mitbbs.com/article_t1/JobHunting/32978937_0_1.html

No comments:

Post a Comment