菱纱梦

导航

2014年8月31日 #

Merge Two Sorted Lists <LeetCode>

摘要: ---恢复内容开始---Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lis... 阅读全文

posted @ 2014-08-31 15:46 菱纱梦 阅读(152) 评论(0) 推荐(0) 编辑

Maximum Subarray <LeetCode>

摘要: 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,... 阅读全文

posted @ 2014-08-31 15:04 菱纱梦 阅读(129) 评论(0) 推荐(0) 编辑

Single Number II <LeetCode>

摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp... 阅读全文

posted @ 2014-08-31 13:52 菱纱梦 阅读(127) 评论(0) 推荐(0) 编辑

Climbing Stairs <LeetCode>

摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文

posted @ 2014-08-31 13:14 菱纱梦 阅读(115) 评论(0) 推荐(0) 编辑

Median of Two Sorted Arrays

摘要: 1 class Solution { 2 public: 3 double findMedianSortedArrays(int A[], int m, int B[], int n) { 4 vector v(m+n); 5 for(int i=0;i<m... 阅读全文

posted @ 2014-08-31 09:40 菱纱梦 阅读(143) 评论(0) 推荐(0) 编辑