自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

龙之梦

Stay Hungry, Stay Foolish

  • 博客(80)
  • 收藏
  • 关注

原创 LeetCode 88 — Merge Sorted Array(C++ Java Python)

题目:http://oj.leetcode.com/problems/merge-sorted-array/Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is gr

2014-03-31 17:05:55 4125

原创 ZOJ 1879 — Jolly Jumpers(C++)

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1879分析:        计算相邻整数之间的差值,对结果进行排序,然后与1-(n-1)逐一比较,如有不同则返回Not jolly。C++实现:#include #include #include #include /* abs *

2014-03-22 15:06:43 1364

原创 ZOJ 2886 — Look and Say(C++)

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2886分析:        对于每一个字符串中的字符,判断是否与之前的字符相同,如相同则计数加1,否则输出计数和之前的字符,记录新字符并重新计数。注意for循环外要输出最后的计数及字符。C++实现:/*Sample Input31223441

2014-03-22 14:55:54 1026

原创 ZOJ 3758 — Singles' Day(C++)

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3758分析:        主要是转换成十进制以及素数的判断,要使用unsigned long long(或unsigned __int64),范围为[0, 2^64)。C++实现:/*Sample Input3 32 42 110

2014-03-22 14:44:49 895

原创 LeetCode 50 — Pow(x, n)(C++ Java Python)

题目:http://oj.leetcode.com/problems/powx-n/Implement pow(x, n).题目翻译:        实现pow(x,n)。分析:        二分。C++实现:class Solution {public: double pow(double x, int n) { if(n < 0)

2014-03-21 11:04:11 3701

原创 LeetCode 20 — Valid Parentheses(C++ Java Python)

题目:http://oj.leetcode.com/problems/valid-parentheses/Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close

2014-03-21 09:37:46 3821

原创 LeetCode 70 — Climbing Stairs(C++ Java Python)

题目:http://oj.leetcode.com/problems/climbing-stairs/You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways ca

2014-03-20 22:17:03 3775

原创 LeetCode 15 — 3Sum(C++ Java Python)

题目:http://oj.leetcode.com/problems/3sum/Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of ze

2014-03-20 21:22:02 5103 3

原创 LeetCode 144 — Binary Tree Preorder Traversal(C++ Java Python)

题目:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},   1    \

2014-03-02 22:13:14 3603 3

原创 LeetCode 148 — Sort List(C++ Java Python)

题目:http://oj.leetcode.com/problems/sort-list/Sort a linked list in O(n log n) time using constant space complexity.题目翻译:在O(nlogn)时间内,使用常数空间对链表进行排序。分析:        使用归并排序,复用Merge Two Sorted Lists代

2014-03-02 12:16:54 4517 1

原创 LeetCode 149 — Max Points on a Line(C++ Java Python)

题目:http://oj.leetcode.com/problems/max-points-on-a-line/Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题目翻译:给定二维平面上的n个点,找出位于同一直线上的点的最大数目。分析:

2014-03-02 10:50:24 4716 2

原创 LeetCode 150 — Evaluate Reverse Polish Notation(C++ Java Python)

题目:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be

2014-03-01 15:34:39 3432 2

原创 LeetCode 21 — Merge Two Sorted Lists(C++ Java Python)

题目:http://oj.leetcode.com/problems/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 first two lists

2014-02-27 22:06:33 4007

原创 LeetCode 142 — Linked List Cycle II(C++ Java Python)

题目:http://oj.leetcode.com/problems/linked-list-cycle-ii/Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using ex

2014-02-27 21:43:40 2935

原创 LeetCode 141 — Linked List Cycle(C++ Java Python)

题目:http://oj.leetcode.com/problems/linked-list-cycle/Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题目翻译:给定一个链表,确定它是否有环。进阶:你可

2014-02-27 21:26:32 3380

原创 LeetCode 147 — Insertion Sort List(C++ Java Python)

题目:http://oj.leetcode.com/problems/insertion-sort-list/Sort a linked list using insertion sort.题目翻译:使用插入排序对链表进行排序。分析:        注意细节。C++实现:/** * Definition for singly-linked list. * str

2014-02-27 21:03:49 5495 2

原创 LeetCode 64 — Minimum Path Sum(C++ Java Python)

题目:http://oj.leetcode.com/problems/minimum-path-sum/Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its

2014-02-26 22:09:52 3406

原创 LeetCode 69 — Sqrt(x)(C++ Java Python)

题目:http://oj.leetcode.com/problems/sqrtx/Implement int sqrt(int x).Compute and return the square root of x.题目翻译:实现int sqrt(int x)。计算并返回x的平方根。分析:        二分查找。注意结果不是整数时应返回整数部分。C++实现:

2014-02-26 21:39:03 3946

原创 LeetCode 67 — Add Binary(C++ Java Python)

题目:http://oj.leetcode.com/problems/add-binary/Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".题目翻译:给定两个二进制字符串,返回它们的和(也是一个二进制字符串)

2014-02-26 21:18:58 2907

原创 LeetCode 63 — Unique Paths II(C++ Java Python)

题目:http://oj.leetcode.com/problems/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 and empty

2014-02-25 22:19:29 3369

原创 LeetCode 61 — Rotate List(C++ Java Python)

题目:http://oj.leetcode.com/problems/rotate-list/Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5

2014-02-24 22:11:31 3285

原创 LeetCode 53 — Maximum Subarray(C++ Java Python)

题目:http://oj.leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1

2014-02-24 21:57:51 3806

原创 LeetCode 58 — Length of Last Word(C++ Java Python)

题目:http://oj.leetcode.com/problems/length-of-last-word/Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.

2014-02-24 21:09:18 3608

原创 LeetCode 62 — Unique Paths(C++ Java Python)

题目:http://oj.leetcode.com/problems/unique-paths/A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right a

2014-02-23 22:00:50 3347

原创 LeetCode 35 — Search Insert Position(C++ Java Python)

题目:http://oj.leetcode.com/problems/search-insert-position/Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were

2014-02-23 21:06:55 3227

原创 LeetCode 27 — Remove Element(C++ Java Python)

题目:http://oj.leetcode.com/problems/remove-element/Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It d

2014-02-23 15:54:54 5351

原创 LeetCode 26 — Remove Duplicates from Sorted Array(C++ Java Python)

题目:http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

2014-02-23 15:12:20 5324

原创 LeetCode 19 — Remove Nth Node From End of List(C++ Java Python)

题目:http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2

2014-02-23 12:00:32 2994

原创 LeetCode 8 — String to Integer (atoi)(C++ Java Python)

题目:http://oj.leetcode.com/problems/string-to-integer-atoi/Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please

2014-02-22 20:52:16 4713

原创 LeetCode 7 — Reverse Integer(C++ Java Python)

题目:http://oj.leetcode.com/problems/reverse-integer/Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some

2014-02-22 10:15:19 5995 1

原创 LeetCode 136 — Single Number(C++ Java Python)

题目:http://oj.leetcode.com/problems/single-number/Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime com

2014-02-20 15:43:27 4732

原创 LeetCode 2 — Add Two Numbers(C++ Java Python)

题目:http://oj.leetcode.com/problems/add-two-numbers/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 sing

2014-02-20 14:34:05 8179

原创 LeetCode 3 — Longest Substring Without Repeating Characters (C++ Java Python)

题目:http://oj.leetcode.com/problems/longest-substring-without-repeating-characters/]Given a string, find the length of the longest substring without repeating characters. For example, the longest sub

2014-02-18 22:22:49 5674 3

原创 LeetCode 4 — Median of Two Sorted Arrays (C++ Java Python)

题目:http://oj.leetcode.com/problems/median-of-two-sorted-arrays/There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time comple

2014-02-17 22:06:53 6347 2

原创 LeetCode 1 — Two Sum(C++ Java Python)

题目: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 two numbers such that they add up to the target,

2014-02-16 22:23:19 19108 9

翻译 链表(Java描述)

原文地址:http://www.cs.cmu.edu/~adamchik/15-121/lectures/Linked%20Lists/linked%20lists.html引言        使用数组来存储数据的一个缺点在于,数组是静态结构,因此不能很容易地扩展或缩小以适合数据集。对数组进行插入和删除的代价也比较高。本文考虑一种名为链表的数据结构,解决了数组的一些局限性。

2014-02-16 20:21:01 2710

原创 4种编程语言基本数据类型及其取值范围整理(C++,Java,Python,Go)

1 C++       C++定义的基本类型包括算术类型和void类型。算术类型分为整型(包括字符和布尔型)和浮点型,如下表所示:C++11新增了char16_t,char32_t(最小分别为16、32位的Unicode字符型),long long(最小为64位的长整形)3种内置类型。       对于32位平台,int类型和long类型通常字长是相同的,占32位。可以用以

2013-12-23 21:56:20 3929

原创 VirtualBox – Cannot register the hard disk 解决办法

由于电脑D盘空间不足,把ubuntu vdi文件移到了E盘,重新添加虚拟硬盘时出现以下错误:    经过google,知道错误的原因在于UUID(通用唯一识别码)重复了,需要重新设置UUID,方法如下:    找到VirtualBox所在目录,在地址栏输入cmd:    然后输入如下命令:(在命令窗口点鼠标右键可粘贴,"E:\Program Files\Ubuntu\ubunt

2013-12-22 21:20:58 13193 6

翻译 一份好的简历应该是这样的(This Is What A GOOD Resume Should Look Like)

原文地址:http://www.careercup.com/resume注:1 本文针对美国简历。印度和其他国家的简历有不同的期望,虽然很多点是相同的。2 虽然这里的例子是一个开发者的简历,几乎所有的点(除了9和11)也适用于其他职位。 1 一页简历        招聘官不仔细阅读你的简历,他们花15 - 30秒“快速浏览”你的简历。如果你的简历太长,它只是掩盖了你最好的东

2013-12-05 18:43:57 2434

原创 CentOS 常用命令及快捷键整理

最近开始学Linux,在VMware Player中安装了CentOS。为方便自己也方便他人,特整理了Linux常用命令及快捷键。1 基本命令获得root权限:su -2 参考资料:1 http://bbs.51cto.com/thread-1039909-1.html2 http://www.docin.com/p-691325948.html

2013-12-04 23:39:04 25714 2

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除