摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ... 阅读全文
posted @ 2015-05-17 16:26 TonyLuis 阅读(147) 评论(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 fr... 阅读全文
posted @ 2015-05-17 12:01 TonyLuis 阅读(175) 评论(0) 推荐(0)
摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.解题思路:用两个boolean数组row col表示行列是否有零即可,JAVA实现如下: public void ... 阅读全文
posted @ 2015-05-17 10:18 TonyLuis 阅读(135) 评论(0) 推荐(0)
摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
posted @ 2015-05-17 09:53 TonyLuis 阅读(136) 评论(0) 推荐(0)