摘要: Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.For example,Givenboard=[ [&q 阅读全文
posted @ 2013-08-30 23:16 feiling 阅读(460) 评论(1) 推荐(0) 编辑
摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should return length =5, and A is now[1,1,2,2,3].[解题思路]双指针问题,还是使用count来保存结果数组的大小与Remove Duplicates from Sorted Array唯一区别在添加start, end标识duplicates区间如果当 阅读全文
posted @ 2013-08-30 14:57 feiling 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.For example,Given input array A =[1,1,2],Your function should return length =2, and A is 阅读全文
posted @ 2013-08-30 12:57 feiling 阅读(159) 评论(0) 推荐(0) 编辑