摘要: Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. Example For A = [1, 2, 3], 阅读全文
posted @ 2016-07-01 11:05 北叶青藤 阅读(369) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array. Notice You may assume that A has enough space (size that is greater or eq 阅读全文
posted @ 2016-07-01 10:41 北叶青藤 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted Array I Given a sorted array, remove the duplicates in place such that each element appear only once and return the new 阅读全文
posted @ 2016-07-01 08:49 北叶青藤 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 560. Subarray Sum Equals K Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is 阅读全文
posted @ 2016-07-01 07:57 北叶青藤 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product. Example For example, given the array [2,3 阅读全文
posted @ 2016-07-01 05:44 北叶青藤 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Given a sorted (increasing order) array, Convert it to create a binary tree with minimal height. Example Given [1,2,3,4,5,6,7], return 4 / \ 2 6 / \ / 阅读全文
posted @ 2016-07-01 05:31 北叶青藤 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-07-01 05:23 北叶青藤 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that 阅读全文
posted @ 2016-07-01 04:55 北叶青藤 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them. The cos 阅读全文
posted @ 2016-07-01 03:11 北叶青藤 阅读(488) 评论(0) 推荐(0) 编辑
摘要: Flatten a binary tree to a fake "linked list" in pre-order traversal. Here we use the right pointer in TreeNode as the next pointer in ListNode. For e 阅读全文
posted @ 2016-07-01 02:31 北叶青藤 阅读(269) 评论(0) 推荐(0) 编辑