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

原创 LeetCode题解汇总(C++ Java Python,含题目翻译)
LeetCode题目(含AC Rates):http://oj.leetcode.com/problems/我的github:https://github.com/lilong-dream/1 Two Sumhttp://blog.youkuaiyun.com/lilong_dream/article/details/192983572 Median of Two Sorted Arrays
2014-02-23 17:49:09
47530
1
原创 KMP算法
KMP算法的介绍参见维基百科:https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm这篇文章的解释不错:http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html
2017-03-09 00:36:49
1052
原创 git常用操作
git缩写配置:在.gitconfig文件中添加:[alias] br = branch co = checkout ci = commit st = status last = log -1 HEADgit常用操作:git clone 克隆一个分支git br 查看分支,-a参数可列出所有分支git co -b
2017-02-28 23:44:58
773
原创 awk sed等常用命令
选取奇数行cat file |awk NR%2==1以":"分隔,打印第二列cat file |awk -F: '{print $2}'以":"分隔,按第二列排序cat file |sort -t ':' -k 2以":,"分隔,选取第二列和第4列相同的cat file |awk -F '[:,]' '$2 == $4'
2015-07-05 17:49:31
954
原创 LeetCode 160 — Intersection of Two Linked Lists(C++ Python)
题目:https://oj.leetcode.com/problems/intersection-of-two-linked-lists/Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two
2014-12-02 20:59:16
2992
原创 hihoCoder1051 - 补提交卡
代码:#include #include int main(){ int T; std::cin >> T; int N, M; for(int i = 0; i < T; ++i) { std::cin >> N >> M; std::vector nums(N + 1, 0); for(int j = 0; j < N; ++j) { std
2014-09-29 20:34:40
1910
原创 CodeChef - Small factorials
题目:You are asked to calculate factorials of some small positive integers.InputAn integer t, 1OutputFor each integer n given at input, display a line with the value of n!ExampleSamp
2014-09-29 15:25:22
823
原创 hihoCoder1039 - 字符消除
描述小Hi最近在玩一个字符消除游戏。给定一个只包含大写字母"ABC"的字符串s,消除过程是如下进行的:1)如果s包含长度超过1的由相同字母组成的子串,那么这些子串会被同时消除,余下的子串拼成新的字符串。例如"ABCCBCCCAA"中"CC","CCC"和"AA"会被同时消除,余下"AB"和"B"拼成新的字符串"ABB"。2)上述消除会反复一轮一轮进行,直到新的字符串不包含相邻的
2014-09-29 14:27:16
2410
原创 HackerRank - Stock Maximize
#include #include int main() { int T; std::cin >> T; int N; while(T--) { std::cin >> N; std::vector nums(N, 0); for(int i = 0; i < N; ++i)
2014-09-27 20:31:16
1826
原创 ZOJ Monthly - 135 A + G
A 题目:Abs ProblemTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeAlice and Bob is playing a game, and this time the game is all about the absolute value!Alice
2014-08-24 18:31:17
928
原创 LightOJ1337 - The Crystal Maze
题目:http://lightoj.com/volume_showproblem.php?problem=1337You are in a plane and you are about to be dropped with a parasuit in a crystal maze. As the name suggests, the maze is full of crystals. Y
2014-08-01 22:38:46
1238
原创 Codeforces - 327A - Flipping Game
题目:http://codeforces.com/problemset/problem/327/A
2014-08-01 21:23:55
3328
原创 Codeforces - 219A - k-String
题目:http://codeforces.com/problemset/problem/219/A
2014-08-01 20:56:34
1618
原创 LeetCode 97 — Interleaving String (C++ Python)
题目:https://oj.leetcode.com/problems/interleaving-string/Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",Whe
2014-07-31 22:44:18
1697
原创 LeetCode 72 — Edit Distance(C++ Python)
题目:https://oj.leetcode.com/problems/edit-distance/
2014-07-31 22:24:13
1793
原创 面试常备程序 — 字符串篇
1 strcmpint strcmp(const char* s1, const char* s2){ while(*s1 && (*s1==*s2)) s1++,s2++; return *(const unsigned char*)s1-*(const unsigned char*)s2;}
2014-05-09 15:59:39
1037
原创 九度剑指Offer面试题9:斐波那契数列(Java题解)
import java.util.Scanner;public class Main { public static void main(String args[]) { long[] fibo = new long[71]; fibo[0] = 0; fibo[1] = 1; for (int i = 2; i <= 70; ++i) { fibo[i] =
2014-04-22 18:47:54
1243
原创 LeetCode 22 — Generate Parentheses(C++ Java Python)
题目:http://oj.leetcode.com/problems/generate-parentheses/Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solut
2014-04-17 11:11:41
4560
原创 LeetCode 28 — Implement strStr()(C++ Java Python)
题目:题目翻译:分析:C++实现:Java实现:Python实现:感谢阅读,欢迎评论!
2014-04-14 09:26:12
3880
原创 Google Code Jam Qualification Round 2014 Problem D. Deceitful War 题解
ProblemNaomi and Ken sometimes play games together. Before they play, each of them gets Nidentical-looking blocks of wood with masses between 0.0kg and 1.0kg (exclusive). All of the blocks have
2014-04-13 10:53:19
1559
原创 Google Code Jam Qualification Round 2014 Problem B. Cookie Clicker Alpha 题解
IntroductionCookie Clicker is a Javascript game by Orteil, where players click on a picture of a giant cookie. Clicking on the giant cookie gives them cookies. They can spend those cookies to buy
2014-04-13 10:29:58
1877
5
原创 Google Code Jam Qualification Round 2014 Problem A. Magic Trick 题解
ProblemRecently you went to a magic show. You were very impressed by one of the tricks, so you decided to try to figure out the secret behind it!The magician starts by arranging 16 cards in a sq
2014-04-13 10:13:32
1371
转载 面试10大算法汇总+常见题目解答(Java)
原文地址:http://www.programcreek.com/2012/12/%E9%9D%A2%E8%AF%9510%E5%A4%A7%E7%AE%97%E6%B3%95%E6%B1%87%E6%80%BB%EF%BC%8B%E5%B8%B8%E8%A7%81%E9%A2%98%E7%9B%AE%E8%A7%A3%E7%AD%94/
2014-04-10 17:05:21
11700
原创 各种排序算法的稳定性和复杂度总结
算法Data StructureTime ComplexityWorst Case Auxiliary Space Complexity BestAverageWorstWorstQuicksortArrayO(n log(n))O(n log(n))O(n^2
2014-04-10 10:15:06
3072
转载 LeetCode题目难度分布(含面试频率及使用的数据结构与算法)
原文地址:LeetCode Question Difficulty Distribution(墙外)IDQuestionDiffFreqData StructureAlgorithms1Two Sum25arraysort
2014-04-08 16:25:06
18104
翻译 常用的Java库、框架和工具清单
原文地址:http://www.indiageeks.in/list-of-commonly-used-java-libraries-frameworks-and-tools/Java库和框架:1. 内核:Apache commonsGuava2. 日志:Log4jlogbackSLF4J3. 日期和时间:Joda-tim
2014-04-04 19:21:00
1840
原创 LeetCode 34 — Search for a Range(C++ Java Python)
题目:题目翻译:分析:C++实现:Java实现:Python实现:感谢阅读,欢迎评论!
2014-04-03 20:53:45
4325
原创 LeetCode 14 — Longest Common Prefix(C++ Java Python)
题目:http://oj.leetcode.com/problems/longest-common-prefix/Write a function to find the longest common prefix string amongst an array of strings.题目翻译:编写一个函数找出字符串数组的最长公共前缀子串。分析: 如果字符串数
2014-04-03 18:42:35
3693
原创 LeetCode 112 — Path Sum(C++ Java Python)
题目:题目翻译:分析:C++实现:Java实现:Python实现:感谢阅读,欢迎评论!
2014-04-03 16:01:19
3527
原创 LeetCode 12 — Integer to Roman(C++ Java Python)
题目:http://oj.leetcode.com/problems/integer-to-roman/Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题目翻译:给定一个整数,将其转换成罗马数字。输入在1到3
2014-04-03 14:55:44
2505
原创 LeetCode 33 — Search in Rotated Sorted Array(C++ Java Python)
题目:http://oj.leetcode.com/problems/search-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
2014-04-03 14:20:40
2423
原创 LeetCode 98 — Validate Binary Search Tree(C++ Java Python)
题目:http://oj.leetcode.com/problems/validate-binary-search-tree/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre
2014-04-02 09:51:35
3067
原创 LeetCode 66 — Plus One(C++ Java Python)
题目:http://oj.leetcode.com/problems/plus-one/Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant d
2014-04-02 08:53:48
4460
3
原创 LeetCode 96 — Unique Binary Search Trees(C++ Java Python)
题目:http://oj.leetcode.com/problems/unique-binary-search-trees/Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a t
2014-04-01 21:07:32
3249
原创 LeetCode 100 — Same Tree(C++ Java Python)
题目:http://oj.leetcode.com/problems/same-tree/Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identic
2014-04-01 20:22:21
2795
原创 LeetCode 83 — Remove Duplicates from Sorted List(C++ Java Python)
题目:http://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, ret
2014-04-01 19:43:21
3464
原创 LeetCode 73 — Set Matrix Zeroes(C++ Java Python)
题目:http://oj.leetcode.com/problems/set-matrix-zeroes/Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straig
2014-04-01 18:27:43
3063
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人