- 博客(27)
- 资源 (1)
- 收藏
- 关注
转载 Binary Tree - Divide Conquer & Traverse
902. Kth Smallest Element in a BSThttps://www.lintcode.com/problem/kth-smallest-element-in-a-bst/description?_from=ladder&&fromId=1public class Solution { /** * @param ro...
2019-05-25 08:58:00 134
转载 Breadth First Search
598. Zombie in Matrixhttps://www.lintcode.com/problem/zombie-in-matrix/description?_from=ladder&&fromId=1class Coordinate { int x, y; public Coordinate(int x, int y) { ...
2019-05-23 10:38:00 159
转载 My Light, My Soul
My Light, My SoulI am leaving this place, this place I've called home, a place I will look back on fondly with nostalgia. I can still see you again, so it's not a traditional departure. But ...
2019-05-20 01:03:00 152
转载 3 - Two Pointers Algorithm
380. Intersection of Two Linked Listshttps://www.lintcode.com/problem/intersection-of-two-linked-lists/description?_from=ladder&&fromId=1 public ListNode getIntersectionNode(List...
2019-05-19 00:34:00 90
转载 3 - Two Pointers Algorithm
380. Intersection of Two Linked Listshttps://www.lintcode.com/problem/intersection-of-two-linked-lists/description?_from=ladder&&fromId=1 public ListNode getIntersectionNode(List...
2019-05-18 12:26:00 96
转载 3 - Two Pointers Algorithm
625. Patition Array IIhttps://www.lintcode.com/problem/partition-array-ii/description?_from=ladder&&fromId=1类似快速排序排序的思路去分割即可,遇到不满足即交换。将一个没有经过排序的整数数组划分为 3 部分:1、第一部分中所有的值都 < low...
2019-05-17 07:53:00 71
转载 双指针算法
一、相向双指针1、一个典型的相向双指针问题就是翻转字符串的问题。三步翻转法:public void reverse(char[] s) { int left = 0, right = s.length - 1; while (left < right) { char temp = s[left]; s[left...
2019-05-15 03:04:00 134
转载 3 - Two Pointers Algorithm
382. Triangle Counthttps://www.lintcode.com/problem/triangle-count/description public int triangleCount(int[] S) { // write your code here //int left = 0, right = S.lengt...
2019-05-13 11:51:00 83
转载 3 - Two Pointers Algorithm
604. Window Sumhttps://www.lintcode.com/problem/window-sum/description?_from=ladder&&fromId=1自己写的方法:public int[] winSum(int[] nums, int k) { // write your code here ...
2019-05-10 11:47:00 89
转载 5 - Binary Tree & Tree-based DFS
93. Balanced Binary Treehttps://www.lintcode.com/problem/balanced-binary-tree/description?_from=ladder&&fromId=1分治法:方法一: with ResultTypeclass ResultType { boolean isBalance...
2019-05-10 09:31:00 76
转载 5 - Binary Tree & Tree-based DFS
900. Closest Binary Search Tree Valuehttps://www.lintcode.com/problem/closest-binary-search-tree-value/description?_from=ladder&&fromId=11. 非递归方法:求BST中跟target最近的数字。我们先设置一个min = root.v...
2019-05-03 08:20:00 85
转载 4 - BFS & Topological Algorithm
127. Topological Sortinghttps://www.lintcode.com/problem/topological-sorting/description?_from=ladder&&fromId=11. 用Map来存储入度。可以用数组来存吗?不可以。Map<DirectedGraphNode, Integer> map...
2019-05-02 04:34:00 96
转载 4 - BFS & Topological Algorithm
611. Knight Shortest Pathhttps://www.lintcode.com/problem/knight-shortest-path/description?_from=ladder&&fromId=1/** * Definition for a point. * class Point { * int x; *...
2019-04-30 07:11:00 74
转载 4 - BFS & Topological Algorithm
615. Course Schedulehttps://www.lintcode.com/problem/course-schedule/description?_from=ladder&&fromId=1为什么不可以用 for(int[] prerequisite: prerequisites) 呢 (使用Leetcode上的方法)?因为当 prerequis...
2019-04-29 06:59:00 90
转载 4 - BFS & Topological Algorithm
433. Number of Islandshttps://www.lintcode.com/problem/number-of-islands/description?_from=ladder&&fromId=1BFS: class Coordinate { int x; int y; C...
2019-04-28 03:47:00 73
转载 3 - Two Pointers Algorithm
5. Kth Largest Element (quick sort的变种)https://www.lintcode.com/problem/kth-largest-element/description?_from=ladder&&fromId=1public class Solution { /** * @param n: An in...
2019-04-28 01:25:00 73
转载 3 - Two Pointers Algorithm
143. Sort Colors II (quick sort 变种)https://www.lintcode.com/problem/sort-colors-ii/description?_from=ladder&&fromId=1public class Solution { /** * @param colors: A list o...
2019-04-27 08:23:00 82
转载 3 - Two Pointers Algorithm
521. Remove Duplicate Numbers in Arrayhttps://www.lintcode.com/problem/remove-duplicate-numbers-in-array/description?_from=ladder&&fromId=1总结:数组中比较 + 移除元素问题public class Solution {...
2019-04-23 02:38:00 94
转载 3 - Two Pointers Algorithm
607. Two Sum III - Data structure design(查找问题:从 map 中查找一个元素)双指针:用一个指针遍历 map 所有元素,用另一个指针在 map 中找 remainhttps://www.lintcode.com/problem/two-sum-iii-data-structure-design/description?_from=lad...
2019-04-21 09:00:00 86
转载 3 - Two Pointers Algorithm
228. Middle of Linked Listhttps://www.lintcode.com/problem/middle-of-linked-list/description?_from=ladder&&fromId=1快慢指针,快指针每次走两步,慢指针每次一步。快指针到尾的时候,慢指针就是中点,时间复杂度为O(n / 2)/** * Def...
2019-04-20 04:42:00 110
转载 2 - Binary Search & LogN Algorithm - Apr 18
38. Search a 2D Matrix IIhttps://www.lintcode.com/problem/search-a-2d-matrix-ii/description?_from=ladder&&fromId=1这道题与二分法有什么关系呢? -把整个二维数组从对角线分成两半,从左下角开始,往右上角逼近。 1 public class ...
2019-04-19 04:10:00 113
转载 2 - Binary Search & LogN Algorithm
254. Drop Eggshttps://www.lintcode.com/problem/drop-eggs/description?_from=ladder&&fromId=128. Search a 2D Matrixhttps://www.lintcode.com/problem/search-a-2d-matrix/description?_...
2019-04-19 00:45:00 145
转载 2 - Binary Search & LogN Algorithm
462. Total Occurence of Target (本质:查找 target 第一次出现的位置 + 查找 target 最后一次出现的位置)https://www.lintcode.com/problem/total-occurrence-of-target/description?_from=ladder&&fromId=1public clas...
2019-04-13 10:58:00 124
转载 2 - Binary Search & LogN Algorithm
159. Find Minimum in Rotate Sorted Array (本质:从一个排过序的数组中查找一个元素)https://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array/description?_from=ladder&&fromId=1public class So...
2019-04-11 11:26:00 83
转载 Speak Confident English
I hope you don'd mind me asking... I know I shouldn't ask, but.... - Well, before I answer that question you tell me .... - I am sorry, I really don't want to answer that. - Ummm, t...
2019-04-10 11:01:00 326
转载 Behavior Question - Most challenging project.
介绍项目,challenging的地方The most challenging project I have ever done was an online collaborative coding platform, it’s like LeetCode but with collaborative features. The most challenging pa...
2019-04-10 09:58:00 199
转载 2 - Binary Search & LogN Algorithm
使用二分的情况: 1.遍历时间复杂度太大 2.要从数组中找到一个元素460. Find K Closest Elements(找到最后一个 < target 的位置)https://www.lintcode.com/problem/find-k-closest-elements/description?_from=ladder&&from...
2019-04-10 09:46:00 69
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人