2015年3月7日

Sort Colors

摘要: Sort Colors问题:Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the... 阅读全文

posted @ 2015-03-07 09:53 zhouzhou0615 阅读(135) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted List

摘要: Remove Duplicates from Sorted List问题:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2... 阅读全文

posted @ 2015-03-07 09:06 zhouzhou0615 阅读(121) 评论(0) 推荐(0) 编辑

2015年3月6日

Find Peak Element

摘要: Find Peak Element问题:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element a... 阅读全文

posted @ 2015-03-06 21:49 zhouzhou0615 阅读(176) 评论(0) 推荐(0) 编辑

Unique Paths

摘要: Unique Paths问题:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or righ... 阅读全文

posted @ 2015-03-06 20:22 zhouzhou0615 阅读(136) 评论(0) 推荐(0) 编辑

Merge Two Sorted Lists

摘要: Merge Two Sorted Lists问题: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 ... 阅读全文

posted @ 2015-03-06 16:58 zhouzhou0615 阅读(104) 评论(0) 推荐(0) 编辑

Convert Sorted Array to Binary Search Tree

摘要: Convert Sorted Array to Binary Search Tree问题:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路: 递归,... 阅读全文

posted @ 2015-03-06 16:45 zhouzhou0615 阅读(134) 评论(0) 推荐(0) 编辑

Climbing Stairs

摘要: Climbing Stairs问题: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 ... 阅读全文

posted @ 2015-03-06 16:18 zhouzhou0615 阅读(131) 评论(0) 推荐(0) 编辑

Majority Element

摘要: Majority Element 问题: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Yo 阅读全文

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

2015年3月5日

Single Number II

摘要: Single Number II 问题: Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should ha 阅读全文

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

Integer to Roman

摘要: Integer to Roman 问题: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 思路: 映射方法-->等长数组 我的代码: 阅读全文

posted @ 2015-03-05 15:16 zhouzhou0615 阅读(143) 评论(0) 推荐(0) 编辑

导航