摘要: Maximum Subarray: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [... 阅读全文
posted @ 2016-02-19 14:30 Lewisr 阅读(111) 评论(0) 推荐(0)
摘要: Majority Element II:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. 题意:找出给定数组中出现次数多于数组长度三分之一的元素 思路:根... 阅读全文
posted @ 2016-02-19 14:15 Lewisr 阅读(150) 评论(0) 推荐(0)
摘要: Word Search: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, 阅读全文
posted @ 2016-02-19 14:07 Lewisr 阅读(147) 评论(0) 推荐(0)