上一页 1 2 3 4 5 6 ··· 11 下一页

2014年4月16日

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 order red, wh... 阅读全文

posted @ 2014-04-16 22:17 pengyu2003 阅读(106) 评论(0) 推荐(0) 编辑

Palindrome Partitioning II

摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文

posted @ 2014-04-16 21:42 pengyu2003 阅读(107) 评论(0) 推荐(0) 编辑

2014年4月15日

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 complexity must be in the ord... 阅读全文

posted @ 2014-04-15 22:24 pengyu2003 阅读(103) 评论(0) 推荐(0) 编辑

Container With Most Water

摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文

posted @ 2014-04-15 16:57 pengyu2003 阅读(151) 评论(0) 推荐(0) 编辑

Palindrome Partitioning

摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv... 阅读全文

posted @ 2014-04-15 16:48 pengyu2003 阅读(111) 评论(0) 推荐(0) 编辑

Longest Consecutive Sequence

摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文

posted @ 2014-04-15 16:01 pengyu2003 阅读(171) 评论(0) 推荐(0) 编辑

2014年4月14日

简单写了一个堆排序

摘要: 随手写了一下,接口什么的肯定都不规范,先大概了解一下堆排序的过程。#includeusing namespace std;int a[100];void swap(int i ,int j){ int temp = a[i]; a[i] = a[j]; a[j] = temp;}void fix(i... 阅读全文

posted @ 2014-04-14 22:30 pengyu2003 阅读(152) 评论(0) 推荐(0) 编辑

2014年4月11日

Best Time to Buy and Sell Stock III

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at mosttwotransactions.Note:You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).可以买两次。如果只是两 阅读全文

posted @ 2014-04-11 20:10 pengyu2003 阅读(167) 评论(0) 推荐(0) 编辑

2014年4月7日

4-7

摘要: 自从过了阿里的三面,已经好长时间没有好好刷题了,前两天还小病一场……谢谢天龙的药~明天开始重归正轨,好好刷题好好看算法!你的今天曾是我的昨天,不能回到从前,唯有忘却。夕阳无限美,中将近黄昏。Winter is coming! 阅读全文

posted @ 2014-04-07 19:56 pengyu2003 阅读(97) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted List

摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val 阅读全文

posted @ 2014-04-07 14:52 pengyu2003 阅读(71) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 11 下一页

导航