奇怪的面试题

V2EX上看到这倒面试题。

You must solve this puzzle to apply There're 7 red tiles, 8 blue titles and one white title in a 4 x 4 plane. We could only move the white tile. When moving it, the white tile swaps the position with the adjacent tile. L, R, U, D are corresponding to four directions which the tile could be moved to (Left, Right, Up, Down) For example, starting from configuration (S), by the move sequence RDRDLwe reach the configuration (E). Now, starting from configuration (S), find the shortest way to reach configuration (T).

img

What is the move sequence of the path ?

不动手试一试的话,一点思路都没有啊。

于是就自己写了一个当游戏玩http://jsbin.com/eZUKUPI/12

上下左右移动白方块,ESC重置。

顺带。。。还能自己跑答案,秘籍是runRunRun();参数可以加时间(ms),想停的话是stop();,答案会打印在console里。

就是。。。。貌似要跑好久。。。

Ruosen

Be a Geek, Do the right thing;