随笔分类 - leetCode hot 100
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l
阅读全文
摘要:Solution 1: class Solution { public List<List<Integer>> levelOrder(TreeNode root) { Queue<TreeNode> queue = new LinkedList<>(); List<List<Integer>> wr
阅读全文
摘要: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
阅读全文
摘要://Solution 1:递归 public List<Integer> inorderTraversal(TreeNode root) { List<Integer> list =new ArrayList<>(); addNode(list, root); return list;}privat
阅读全文
摘要:Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle
阅读全文
摘要:给你一个字符串 s 、一个字符串 t 。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 输入:s = "ADOBECODEBANC", t = "ABC"输出:"BANC"解释:最小覆盖子串 "BANC" 包含来自字符串 t 的 'A'、'B'
阅读全文
摘要:剑指offer 矩阵中的路径 https://www.cnblogs.com/MarkLeeBYR/p/9773357.html
阅读全文
摘要:样例输入{1,8,5,4} 输出 [[], [1], [1, 4], [1, 4, 5], [1, 4, 5, 8], [1, 4, 8], [1, 5], [1, 5, 8], [1, 8], [4], [4, 5], [4, 5, 8], [4, 8], [5], [5, 8], [8]] 注意
阅读全文
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red,
阅读全文
摘要:剑指offer 二维数组中的查找 https://www.cnblogs.com/MarkLeeBYR/p/9777341.html
阅读全文
摘要:iven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. //如果某个元素为0,则把该元素所在的行和列都设为0。本题用了o
阅读全文
摘要:Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations
阅读全文
摘要:剑指offer 跳台阶 https://www.cnblogs.com/MarkLeeBYR/p/9777214.html
阅读全文
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
阅读全文
摘要:There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-rig
阅读全文
摘要:Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals
阅读全文
摘要:剑指offer 顺时针打印矩阵 https://www.cnblogs.com/MarkLeeBYR/p/9776471.html
阅读全文
摘要:看剑指offer 连续子数组的最大和 https://www.cnblogs.com/MarkLeeBYR/p/9774387.html
阅读全文
摘要:The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return al
阅读全文