摘要: 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 北叶青藤 阅读(138) 评论(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) 编辑
摘要: Subarray Sum Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the i 阅读全文
posted @ 2016-07-01 07:57 北叶青藤 阅读(224) 评论(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 北叶青藤 阅读(194) 评论(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 北叶青藤 阅读(225) 评论(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 北叶青藤 阅读(139) 评论(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 北叶青藤 阅读(155) 评论(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 北叶青藤 阅读(486) 评论(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 北叶青藤 阅读(268) 评论(0) 推荐(0) 编辑
摘要: Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Example Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], retur 阅读全文
posted @ 2016-06-30 12:50 北叶青藤 阅读(216) 评论(0) 推荐(0) 编辑