自定义博客皮肤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

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

原创 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 4046

原创 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 1297

原创 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 968

原创 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 876

原创 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 3582

原创 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 3759

原创 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 3705

原创 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 5068 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 3486 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 4456 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 4695 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 3368 2

空空如也

空空如也

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

TA关注的人

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