Leetcode:在线编程网站-各大IT公司的笔试面试题

leetcode 是一个美国的在线编程网站,上面主要收集了各大IT公司的笔试面试题,对于应届毕业生找工作是一个不可多得的好帮手。

这个网站的的好处在于它会告诉你测试数据以及你的输出和正确的输出是什么,方便大家调试学习。目前,只支持C++和Java两种语言。

另外它是支持在线编辑,还提供了一个在线运行环境,可以直接看到运行结果。

另一个很好的地方在于提供了2个独立的代码窗口,分别编译运行。一个自己玩的开发窗口,一个提交代码的窗口,可以在第一个窗口里测试各种拿不准的功能点。

官方网站:http://leetcode.com/


https://github.com/soulmachine/leetcode

http://blog.csdn.net/column/details/leetcode-solution.html


LeetCode题解


PDF下载

LeetCode题解(C++版).pdf

C++ 文件夹下是C++版,内容一摸一样,代码是用C++写的,

Java 文件夹下是Java版,内容一摸一样,代码是用Java写的

LaTeX模板

本书使用的是陈硕开源的模板。这个模板制作精良,很有taste,感谢陈硕 :)

在Windows下编译

  1. 安装Tex Live 2013 http://www.tug.org/texlive/。把bin目录例如D:\texlive\2013\bin\win32加入PATH环境变量。
  2. 安装字体。这个LaTex模板总共使用了9个字体,下载地址 http://pan.baidu.com/s/1gdefYiJ ,有的字体Windows自带了,有的字体Ubuntu自带了,但都不全,还是一次性安装完所有字体比较方便。
  3. 安装TeXstudio http://texstudio.sourceforge.net/
  4. (可选)启动Tex Live Manager,更新所有已安装的软件包。
  5. 配置TeXstudio。

    启动Texstudio,选择 Options-->Configure Texstudio-->Commands,XeLaTex 设置为 xelatex -synctex=1 -interaction=nonstopmode %.tex

    选择 Options-->Configure Texstudio-->Build

    Build & View 由默认的 PDF Chain 改为 Compile & View;

    Default Compiler 由默认的PdfLaTex 修改为 XeLaTex ;

    PDF Viewer 改为 “Internal PDF Viewer(windowed)”,这样预览时会弹出一个独立的窗口,这样比较方便。

  6. 编译。用TeXstudio打开leetcode-cpp.tex,点击界面上的绿色箭头就可以开始编译了。

    在下方的窗口可以看到TeXstudio正在使用的编译命令是xelatex -synctex=1 -interaction=nonstopmode "leetcode-cpp".tex

在Ubuntu下编译

  1. 安装Tex Live 2013 http://www.tug.org/texlive/

    1.1. 下载TexLive 2013 的ISO 光盘,地址 http://www.tug.org/texlive/acquire-iso.html

    1.2 mount 光盘,sudo ./install-tl 开始安装

    1.3 加入环境变量

    sudo vi /etc/profile
    export PATH=$PATH:/usr/local/texlive/2013/bin/x86_64-linux
    export MANPATH=$MANPATH:/usr/local/texlive/2013/texmf-dist/doc/man
    export INFPATH=$INFPATH:/usr/local/texlive/2013/texmf-dist/doc/info
    
  2. 安装字体。这个LaTex模板总共使用了9个字体,下载地址 http://pan.baidu.com/s/1gdefYiJ ,有的字体Windows自带了,有的字体Ubuntu自带了,但都不全,还是一次性安装完所有字体比较方便。

  3. 安装TeXstudio http://texstudio.sourceforge.net/
  4. 配置TeXstudio。

    启动Texstudio,选择 Options-->Configure Texstudio-->Commands,XeLaTex 设置为 xelatex -synctex=1 -interaction=nonstopmode %.tex

    选择 Options-->Configure Texstudio-->Build

    Build & View 由默认的 PDF Chain 改为 Compile & View;

    Default Compiler 由默认的PdfLaTex 修改为 XeLaTex ;

    PDF Viewer 改为 “Internal PDF Viewer(windowed)”,这样预览时会弹出一个独立的窗口,这样比较方便。

  5. 编译。用TeXstudio打开leetcode-cpp.tex,点击界面上的绿色箭头就可以开始编译了。

    在下方的窗口可以看到TeXstudio正在使用的编译命令是xelatex -synctex=1 -interaction=nonstopmode "leetcode-cpp".tex

  6. 懒人版镜像。如果不想进行上面繁琐的安装过程,我做好了一个Ubuntu VMware虚拟机镜像,已经装好了TexLive 2013, TexStudio和字体(详细的安装日志见压缩包注释),开箱即用,下载地址 http://pan.baidu.com/s/1jGj5uQi

如何贡献代码

编译通过后,就具备了完整的LaTeX编译环境了。

本书模板已经写好了,基本上不需要很多LaTeX知识就可以动手了。

欢迎给本书添加内容或纠正错误,在自己本地编译成PDF,预览没问题后,就可以发pull request过来了。

北美求职微博群

我和我的小伙伴们在这里:http://q.weibo.com/1312378



题目算法数据结构注意事项
Clone GraphBFS哈希表
Word Ladder IIBFS哈希表
Surrounded RegionsBFS矩阵
Word LadderBFSN/A
Binary Tree Level Order TraversalBFS|前序遍历队列
Binary Tree Level Order Traversal IIBFS|前序遍历队列
Binary Tree Zigzag Level Order Traversal BFS|前序遍历队列每一层顺序分别对待
Implement strStr()KMP算法N/A
Copy List with Random PointerN/A哈希表
Remove Duplicates from Sorted ArrayN/A哈希表
Remove Duplicates from Sorted Array IIN/A哈希表
Set Matrix ZeroesN/A哈希表
AnagramsN/A哈希表
First Missing PositiveN/A哈希表
Two SumN/A哈希表
Evaluate Reverse Polish NotationN/A堆栈
Largest Rectangle in HistogramN/A堆栈记录重要位置
Minimum Window SubstringN/A堆栈
Simplify PathN/A堆栈
Longest Valid ParenthesesN/A堆栈
Valid ParenthesesN/A堆栈词法分析
Container With Most WaterN/A堆栈记录重要位置
Reverse Words in a StringN/A堆栈翻转字符串
Best Time to Buy and Sell StockN/A数组
Best Time to Buy and Sell Stock IIN/A数组
Best Time to Buy and Sell Stock IIIN/A数组
Length of Last WordN/A数组
Search Insert PositionN/A数组
Search for a RangeN/A数组
Spiral MatrixN/A矩阵简化为子问题
Spiral Matrix IIN/A矩阵简化为子问题
LRU CacheN/A链表
Reorder ListN/A链表快慢指针&链表倒序
Linked List CycleN/A链表快慢指针
Linked List Cycle IIN/A链表快慢指针
Reverse Linked List IIN/A链表
Partition ListN/A链表
Remove Duplicates from Sorted ListN/A链表
Remove Duplicates from Sorted List IIN/A链表
Merge Two Sorted ListsN/A链表
Rotate ListN/A链表快慢指针
Reverse Nodes in k-GroupN/A链表
Swap Nodes in PairsN/A链表
Remove Nth Node From End of ListN/A链表快慢指针
Text JustificationN/A队列
CandyN/AN/A简化为子问题
Valid PalindromeN/AN/A首尾指针
Plus OneN/AN/A模拟加法运算
Valid NumberN/AN/A词法分析
Add BinaryN/AN/A模拟加法运算
Insert IntervalN/AN/A
Merge IntervalsN/AN/A
Multiply StringsN/AN/A模拟乘法运算
Trapping Rain WaterN/AN/A
Valid SudokuN/AN/A
Roman to IntegerN/AN/A
Integer to RomanN/AN/A
Palindrome NumberN/AN/A
Reverse IntegerN/AN/A
ZigZag ConversionN/AN/A
Add Two NumbersN/AN/A模拟加法运算
Median of Two Sorted ArraysN/AN/A
String to Integer (atoi)STL函数N/A
Next PermutationSTL经典算法N/A
Recover Binary Search Tree中序遍历二叉树
3Sum二分查找N/A
3Sum Closest二分查找N/A
4Sum二分查找N/A
Single Number位运算N/A
Single Number II位运算N/A
Construct Binary Tree from Preorder and Inorder Traversal前序中序遍历N/A
Binary Tree Preorder Traversal前序遍历二叉树
Flatten Binary Tree to Linked List前序遍历二叉树
Interleaving String动态规划二叉树
Unique Binary Search Trees动态规划二叉树
Word Break动态规划N/A
Word Break II动态规划N/A
Palindrome Partitioning动态规划N/A
Palindrome Partitioning II动态规划N/A
Triangle动态规划N/A
Distinct Subsequences动态规划N/A
Decode Ways动态规划N/A
Scramble String动态规划N/A
Maximal Rectangle动态规划N/A
Edit Distance动态规划N/A
Climbing Stairs动态规划N/A
Minimum Path Sum动态规划N/A
Unique Paths动态规划N/A
Unique Paths II动态规划N/A
Jump Game动态规划N/A
Jump Game II动态规划N/A
Maximum Subarray动态规划N/A
Wildcard Matching动态规划N/A
Substring with Concatenation of All Words动态规划N/A
Sort List合并排序链表快慢指针
Merge Sorted Array合并排序N/A
Construct Binary Tree from Inorder and Postorder Traversal后序中序遍历N/A
Binary Tree Postorder Traversal后续遍历二叉树
Combinations回溯N/A
Permutation Sequence回溯N/A
N-Queens回溯N/A
N-Queens II回溯N/A
Permutations回溯N/A
Permutations II回溯N/A
Combination Sum回溯N/A
Combination Sum II回溯N/A
Sudoku Solver回溯N/A
Longest Substring Without Repeating Characters回溯N/A
Max Points on a Line循环遍历N/A排除相同的点
Longest Common Prefix循环遍历N/A
Longest Palindromic Substring循环遍历N/A
Insertion Sort List插入排序链表
Rotate Image矢量旋转与平移N/A
Longest Consecutive Sequence类BFS哈希表
Search in Rotated Sorted Array类二分查找N/A
Search in Rotated Sorted Array II类二分查找N/A特殊考虑相等数据
Sqrt(x)类二分查找N/A
Pow(x, n)类二进制N/A
Divide Two Integers类二进制N/A
Gas Station类合并排序N/A
Merge k Sorted Lists类外排序N/A
Sort Colors类快速排序N/A
Remove Element类快速排序N/A
Search a 2D Matrix类杨氏矩阵N/A
Restore IP Addresses背包问题N/A
Sum Root to Leaf Numbers递归二叉树
Binary Tree Maximum Path Sum递归二叉树
opulating Next Right Pointers in Each Node递归二叉树
Populating Next Right Pointers in Each Node II递归二叉树
Path Sum递归二叉树
Path Sum II递归二叉树
Maximum Depth of Binary Tree 递归二叉树
Minimum Depth of Binary Tree递归二叉树
Balanced Binary Tree递归二叉树
Symmetric Tree递归二叉树
Same Tree 递归二叉树
Validate Binary Search Tree递归二叉树
Unique Binary Search Trees II递归二叉树
Binary Tree Inorder Traversal递归二叉树
Pascal's Triangle递归N/A
Pascal's Triangle II递归N/A
Convert Sorted List to Binary Search Tree递归N/A快慢指针&反中序遍历
Convert Sorted Array to Binary Search Tree递归N/A反中序遍历
Subsets递归N/A
Subsets II递归N/A
Gray Code递归N/A
Word Search递归N/A
Count and Say递归N/A
Generate Parentheses递归N/A
Letter Combinations of a Phone Number递归N/A
Regular Expression Matching递归N/A

  • 3
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小新识图

你的鼓励是我最大的分享动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值