09 2014 档案

摘要:题目描述:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoint... 阅读全文
posted @ 2014-09-29 23:01 skycore 阅读(168) 评论(0) 推荐(0) 编辑
摘要:题目描述:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321解题方案:该题比较简单,直接贴代码: 1 class Solution { 2 public: 3 int ... 阅读全文
posted @ 2014-09-29 22:56 skycore 阅读(155) 评论(0) 推荐(0) 编辑
摘要:题目描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t... 阅读全文
posted @ 2014-09-29 22:53 skycore 阅读(196) 评论(0) 推荐(0) 编辑
摘要:题目描述:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime compl... 阅读全文
posted @ 2014-09-29 22:46 skycore 阅读(115) 评论(0) 推荐(0) 编辑
摘要:题目描述:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another ex... 阅读全文
posted @ 2014-09-28 09:07 skycore 阅读(159) 评论(0) 推荐(0) 编辑
摘要:题目描述:Sort a linked list inO(nlogn) time using constant space complexity.解题方案:题目要求的时间复杂度是O(nlogn),常数级空间复杂度。所以这里用了归并排序,归并排序在数组上操作比较方便,但是这里要排序的是链表。我们用到两个... 阅读全文
posted @ 2014-09-27 16:36 skycore 阅读(165) 评论(0) 推荐(0) 编辑
摘要:题目描述:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime... 阅读全文
posted @ 2014-09-27 16:26 skycore 阅读(122) 评论(0) 推荐(0) 编辑
摘要:题目描述:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".解决方案:该题目解决思路很简单,新建一个字符串,然... 阅读全文
posted @ 2014-09-24 21:03 skycore 阅读(159) 评论(0) 推荐(0) 编辑
摘要:shell是Unix/Linux中的重要工具,用来解析用户输入的命令。下面我们来实现一个简单的shell程序,来练习fork/exec/wait/exit的使用,顺便推荐一本书籍《Understanding Unix/Linux Programming - A Guide to Theory and... 阅读全文
posted @ 2014-09-24 20:51 skycore 阅读(764) 评论(0) 推荐(0) 编辑
摘要:题目描述:Sort a linked list using insertion sort.解决方案:该题目就是用插入排序来对链表进行排序,很简单,直接上代码。 1 class Solution { 2 public: 3 ListNode *insertionSortList(ListNod... 阅读全文
posted @ 2014-09-24 15:26 skycore 阅读(192) 评论(0) 推荐(0) 编辑
摘要:从今天起,我将写一些关于C/C++和Linux系统编程等方面的博客,希望能和大家一起交流学习! 阅读全文
posted @ 2014-09-24 14:53 skycore 阅读(114) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示