2016年6月2日

Subarray Sum

摘要: 给定一个整数数组,找到和为零的子数组。你的代码应该返回满足要求的子数组的起始位置和结束位置。比如给出 [-3, 1, 2, -3, 4],返回[0, 2] 或者 [1, 3]. Lintcode上的一道题目,这一题我开始想到的是brute force的方法,求出所有子数组,并判断和是否为0。子数组一 阅读全文

posted @ 2016-06-02 22:36 Sheryl Wang 阅读(379) 评论(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], return [2]. Note: Each element i 阅读全文

posted @ 2016-06-02 22:19 Sheryl Wang 阅读(145) 评论(0) 推荐(0) 编辑

导航