![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 86
he_world
这个作者很懒,什么都没留下…
展开
-
LeetCode:Array
Array原创 2017-01-06 15:14:45 · 245 阅读 · 0 评论 -
LeetCode:Graph,
19.Graph先来一点Graph的知识吧,参考资料:原创 2017-01-16 14:53:21 · 104 阅读 · 0 评论 -
LeetCode:Heap,Sort,Bit Manipulation,Backtracking
15.Heap先来复习一下stack,queue,heap的特点: 1.stack:FILO(先进后出) 2.queue:FIFO(先进先出) 3.heap:两个rules,1.the tree is complete,2.parent is always smaller than its two children.参考differences1.Design Twitter题意未实现显示前10原创 2017-01-06 16:05:21 · 930 阅读 · 0 评论 -
LeetCode:LinkedList,Two Pointers,Binary Search
12.Linked List1.Merge Two Sorted ListsMerge 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./** * Definition for原创 2017-01-06 16:04:00 · 728 阅读 · 0 评论 -
LeetCode:DFS,BFS
10.Depth-first Search1.Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le原创 2017-01-06 15:57:55 · 654 阅读 · 0 评论 -
LeetCode:Hash Table
9.Hash Table1.Valid Sudoku题目描述public class Solution { public boolean isValidSudoku(char[][] board) { for (int i = 0; i < 9; i++) { HashSet<Character> rows = new HashSet<>();原创 2017-01-06 15:52:42 · 296 阅读 · 0 评论 -
LeetCode:Tree
8.Tree1.Maximum Depth of Binary Tree求最大depth,很简单:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x)原创 2017-01-06 15:50:39 · 260 阅读 · 0 评论 -
LeetCode:DC,Greedy,Stack
5.Divide and Conquer1.Majority ElementGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-原创 2017-01-06 15:48:30 · 369 阅读 · 0 评论 -
LeetCode:Math
4.Math1.Integer BreakGiven a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example,原创 2017-01-06 15:41:41 · 296 阅读 · 0 评论 -
LeetCode:Dynamic Programming
3.Dynamic Programming在刷这个专题之前,有必要温习一下DP的思想,知乎上有人总结的不错,可以参考之:什么是动态规划?动态规划的意义是什么?中徐凯强 Andy和王勐同学的回答,他们的回答在于用浅显易懂的话来解释DP的思想,比复杂的数学推导更有意思更实际更让人不想睡觉,哈哈哈。另外怎么列动态规划递推方程?比较实际,可以参考之。以及它跟divide and conquer思想的不同:W原创 2017-01-06 15:38:31 · 468 阅读 · 0 评论 -
LeetCode:String
2.String1.Implement strStr()Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.思路一:直接两个指针,暴力法public class Solution { //success 1 public int原创 2017-01-06 15:35:33 · 215 阅读 · 0 评论