上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 34 下一页

2015年3月13日

Merge k Sorted Lists

摘要: Merge k Sorted Lists问题:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路: 归并排序(二分问题)我的代码:public clas... 阅读全文

posted @ 2015-03-13 09:50 zhouzhou0615 阅读(142) 评论(0) 推荐(0) 编辑

2015年3月12日

Unique Paths II

摘要: Unique Paths II问题:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle... 阅读全文

posted @ 2015-03-12 16:52 zhouzhou0615 阅读(126) 评论(0) 推荐(0) 编辑

Trapping Rain Water

摘要: Trapping Rain Water问题:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to... 阅读全文

posted @ 2015-03-12 09:02 zhouzhou0615 阅读(171) 评论(0) 推荐(0) 编辑

Set Matrix Zeroes

摘要: Set Matrix Zeroes问题:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.思路: 用标记数组进行标记我的代码:public class Solution ... 阅读全文

posted @ 2015-03-12 08:43 zhouzhou0615 阅读(120) 评论(0) 推荐(0) 编辑

2015年3月11日

Search for a Range

摘要: Search for a Range问题:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexi... 阅读全文

posted @ 2015-03-11 21:42 zhouzhou0615 阅读(195) 评论(0) 推荐(0) 编辑

Sort List

摘要: Sort List问题:Sort a linked list inO(nlogn) time using constant space complexity.思路: 归并排序我的代码:public class Solution { public ListNode sortList(ListN... 阅读全文

posted @ 2015-03-11 20:31 zhouzhou0615 阅读(152) 评论(0) 推荐(0) 编辑

Intersection of Two Linked Lists

摘要: Intersection of Two Linked Lists问题:Write a program to find the node at which the intersection of two singly linked lists begins.思路: 追击问题我的代码:public c... 阅读全文

posted @ 2015-03-11 19:58 zhouzhou0615 阅读(125) 评论(0) 推荐(0) 编辑

Length of Last Word

摘要: Length of Last Word问题:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the strin... 阅读全文

posted @ 2015-03-11 19:39 zhouzhou0615 阅读(172) 评论(0) 推荐(0) 编辑

Longest Consecutive Sequence

摘要: Longest Consecutive Sequence问题:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.思路: HashSet进行存储我的代码:... 阅读全文

posted @ 2015-03-11 19:30 zhouzhou0615 阅读(119) 评论(0) 推荐(0) 编辑

Reorder List

摘要: Reorder List问题:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' ... 阅读全文

posted @ 2015-03-11 16:08 zhouzhou0615 阅读(145) 评论(0) 推荐(0) 编辑

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 34 下一页

导航