龙之梦

Stay Hungry, Stay Foolish

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 a...

2014-03-31 17:05:55

阅读数:3525

评论数:0

ZOJ 1879 — Jolly Jumpers(C++)

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

2014-03-22 15:06:43

阅读数:988

评论数:0

ZOJ 2886 — Look and Say(C++)

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

2014-03-22 14:55:54

阅读数:750

评论数:0

ZOJ 3758 — Singles' Day(C++)

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3758 分析:         主要是转换成十进制以及素数的判断,要使用unsigned long long(或unsigned __int64),范围为[0, 2...

2014-03-22 14:44:49

阅读数:712

评论数:0

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...

2014-03-21 11:04:11

阅读数:3152

评论数:0

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

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

2014-03-21 09:37:46

阅读数:3231

评论数:0

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 c...

2014-03-20 22:17:03

阅读数:3227

评论数:0

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 ...

2014-03-20 21:22:02

阅读数:4585

评论数: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 examp...

2014-03-02 22:13:14

阅读数:2874

评论数:2

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)时间内,使用常数空间对链表进行排序...

2014-03-02 12:16:54

阅读数:3842

评论数: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 straigh...

2014-03-02 10:50:24

阅读数:4237

评论数: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...

2014-03-01 15:34:39

阅读数:2732

评论数:2

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