LeetCode Java
クロネコ黒猫
这个作者很懒,什么都没留下…
展开
-
LeetCode in Java [15]*: 102. Binary Tree Level Order Traversal 二叉树层次遍历
102.Binary Tree Level Order Traversal Medium 215858Add to ListShare Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level). For exam...原创 2020-01-21 16:18:51 · 136 阅读 · 0 评论 -
LeetCode in Java [14]*: 98. 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 subtree of a node contains only nodes with keysless thanthe node's key. ...原创 2020-01-20 19:45:14 · 144 阅读 · 0 评论 -
LeetCode in Java [12]*: 91. Decode Ways
A message containing letters fromA-Zis being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given anon-emptystring containing only digits, determine ...原创 2020-01-08 14:02:25 · 85 阅读 · 0 评论 -
LeetCode in Java [11]: 90. Subsets II
Given a collection of integers that might contain duplicates,nums, return all possible subsets (the power set). Note:The solution set must not contain duplicate subsets. Example: Input: [1,2,2]...原创 2020-01-07 18:52:16 · 147 阅读 · 0 评论 -
LeetCode in Java [10]: 86. Partition List
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox. You should preserve the original relative order of the nodes in each of ...原创 2020-01-07 18:17:19 · 84 阅读 · 0 评论 -
LeetCode in Java [9]: 74. Search a 2D Matrix
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each ro...原创 2019-12-20 18:19:13 · 60 阅读 · 0 评论 -
LeetCode in Java [8]: 73. Set Matrix Zeroes*
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do itin-place. Example 1: Input: [ [1,1,1], [1,0,1], [1,1,1] ] Output: [ [1,0,1], [0,0,0], [1,0,1] ] ...原创 2019-12-17 20:24:09 · 76 阅读 · 0 评论 -
LeetCode in Java [7]: 64. Minimum Path Sum
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path. Note:You can only move either down or right at ...原创 2019-12-17 19:56:49 · 87 阅读 · 1 评论 -
LeetCode in Java [6]: 63. Unique Paths II
A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the b...原创 2019-12-17 19:45:01 · 70 阅读 · 0 评论 -
LeetCode in Java [5]: 62. Unique Paths
A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the b...原创 2019-12-17 19:34:21 · 64 阅读 · 0 评论 -
LeetCode in Java [4]: 61. Rotate List
Example 1: Input: 1->2->3->4->5->NULL, k = 2 Output: 4->5->1->2->3->NULL Explanation: rotate 1 steps to the right: 5->1->2->3->4->NULL rotate 2 steps to...原创 2019-12-17 19:07:57 · 52 阅读 · 0 评论 -
LeetCode in Java [3]: 60. Permutation Sequence
The set[1,2,3,...,n]contains a total ofn! unique permutations. By listing and labeling all of the permutations in order, we get the following sequence forn= 3: "123" "132" "213" "231" "312...原创 2019-12-17 18:41:48 · 77 阅读 · 0 评论 -
LeetCode in Java [2]: 59. Spiral Matrix II
Given a positive integern, generate a square matrix filled with elements from 1 ton2in spiral order. Example: Input: 3 Output: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] 设置上下左右四个限制器就行,结束标志是...原创 2019-12-16 19:47:25 · 57 阅读 · 0 评论 -
LeetCode in java [1]: 56. Merge Intervals
Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlap...原创 2019-12-16 19:29:14 · 66 阅读 · 0 评论