摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.如果直接遍历链表数组,时间复杂度为T(n)=T(n-1)+o(lenn);即合并前n-1个链表的时间+与第n... 阅读全文
posted @ 2015-11-28 09:36 zengzy 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 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 lists./** * Def... 阅读全文
posted @ 2015-11-28 01:56 zengzy 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great... 阅读全文
posted @ 2015-11-28 01:50 zengzy 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".class Solution {public: string addBinary(str... 阅读全文
posted @ 2015-11-28 01:37 zengzy 阅读(189) 评论(0) 推荐(0) 编辑
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-11-28 01:15 zengzy 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
posted @ 2015-11-28 00:15 zengzy 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2015-11-27 22:22 zengzy 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.要求空间复杂度为o(1)思路:把数组划分为两部分,第一部分是第一行和第一列;第二部分是除去第一行第一列的矩阵部分。1.先记... 阅读全文
posted @ 2015-11-27 21:50 zengzy 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].class Sol... 阅读全文
posted @ 2015-11-27 20:29 zengzy 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol... 阅读全文
posted @ 2015-11-23 22:04 zengzy 阅读(212) 评论(0) 推荐(0) 编辑
levels of contents