摘要: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
posted @ 2016-12-23 15:10 lettuan 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 这个算法只是检查能不能找到符合要求的path,但是不保证找到的那一条path是最短的。注意把已经访问过的点设置成3,这样访问过的点就不会被重复访问了。 如果想要找出shortest path的长度,可以用如下的方法: 阅读全文
posted @ 2016-12-23 06:31 lettuan 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
posted @ 2016-12-23 05:51 lettuan 阅读(271) 评论(0) 推荐(0) 编辑
摘要: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th 阅读全文
posted @ 2016-12-23 00:56 lettuan 阅读(526) 评论(0) 推荐(0) 编辑