摘要:
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t 阅读全文
摘要:
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
摘要:
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 阅读全文
摘要:
public class Solution { public List> combinationSum3(int k, int n) { return combination(k, n, 1); } public List> combination(int k, int target, int start) { List> lis... 阅读全文
摘要:
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. Hi 阅读全文
摘要:
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John 阅读全文
摘要:
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a 阅读全文
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va 阅读全文
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
摘要:
Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must 阅读全文