05 2020 档案

摘要:687. Longest Univalue Path Easy 1566430Add to ListShare Given a binary tree, find the length of the longest path where each node in the path has the s 阅读全文
posted @ 2020-05-31 10:14 苗妙苗 阅读(112) 评论(0) 推荐(0)
摘要:Given 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 l 阅读全文
posted @ 2020-05-30 23:20 苗妙苗 阅读(138) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. N 阅读全文
posted @ 2020-05-30 10:38 苗妙苗 阅读(117) 评论(0) 推荐(0)
摘要:还是一样的,在中序中找出那个众数存一下次数 主函数看谁的value最大 可以用map,是哦! https://leetcode.com/problems/find-mode-in-binary-search-tree/discuss/98103/Java-AC-Solution 阅读全文
posted @ 2020-05-30 09:31 苗妙苗 阅读(123) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the lef 阅读全文
posted @ 2020-05-30 08:42 苗妙苗 阅读(181) 评论(0) 推荐(0)
摘要:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2020-05-26 09:35 苗妙苗 阅读(107) 评论(0) 推荐(0)
摘要:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path betwe 阅读全文
posted @ 2020-05-26 05:50 苗妙苗 阅读(120) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2020-05-25 22:11 苗妙苗 阅读(104) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] 阅读全文
posted @ 2020-05-25 10:43 苗妙苗 阅读(115) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2020-05-24 22:07 苗妙苗 阅读(100) 评论(0) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1 阅读全文
posted @ 2020-05-24 10:48 苗妙苗 阅读(108) 评论(0) 推荐(0)
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 O 阅读全文
posted @ 2020-05-24 10:01 苗妙苗 阅读(160) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all 阅读全文
posted @ 2020-05-23 23:33 苗妙苗 阅读(131) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2020-05-23 10:21 苗妙苗 阅读(132) 评论(0) 推荐(0)
摘要:[抄题]: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You 阅读全文
posted @ 2020-05-23 06:45 苗妙苗 阅读(219) 评论(0) 推荐(0)
摘要:[抄题]: Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 复习时还不会的地方:没啥了,就加个null的判断条件就行了 [暴力解法]: 时间分析: 空间 阅读全文
posted @ 2020-05-23 04:58 苗妙苗 阅读(74) 评论(0) 推荐(0)
摘要:[抄题]: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for anot 阅读全文
posted @ 2020-05-22 11:05 苗妙苗 阅读(255) 评论(0) 推荐(0)
摘要:[抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: [英文数据结构或算法,为什么不用别的数据结构或算法]: [一句话思路]: [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异 阅读全文
posted @ 2020-05-22 10:04 苗妙苗 阅读(275) 评论(0) 推荐(0)
摘要:[抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: [英文数据结构或算法,为什么不用别的数据结构或算法]: [一句话思路]: [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异 阅读全文
posted @ 2020-05-21 10:11 苗妙苗 阅读(153) 评论(0) 推荐(0)
摘要:[抄题]: https://practice.geeksforgeeks.org/problems/delete-a-node-in-single-linked-list/1 从前往后,删除第N个 [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇 阅读全文
posted @ 2020-05-21 09:27 苗妙苗 阅读(173) 评论(0) 推荐(0)
摘要:[抄题]: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1, 阅读全文
posted @ 2020-05-20 23:13 苗妙苗 阅读(189) 评论(0) 推荐(0)
摘要:[抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: [英文数据结构或算法,为什么不用别的数据结构或算法]: [一句话思路]: 背诵的递归写法 [输入量]:空: 正常情况:特大:特小:程序里处理 阅读全文
posted @ 2020-05-20 11:08 苗妙苗 阅读(218) 评论(0) 推荐(0)
摘要:全部 [抄题]: Reverse a singly linked list. [思维问题]: 以为要用dummy node [一句话思路]: 直接全部转过来就行了,用dummy node反而多余 [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入): [画图 阅读全文
posted @ 2020-05-20 10:07 苗妙苗 阅读(192) 评论(0) 推荐(0)
摘要:[抄题]: Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return - 阅读全文
posted @ 2020-05-20 07:28 苗妙苗 阅读(292) 评论(0) 推荐(0)
摘要:[抄题]: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a cana 阅读全文
posted @ 2020-05-19 21:25 苗妙苗 阅读(136) 评论(0) 推荐(0)
摘要:[抄题]: [暴力解法]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 没想到while循环 [一句话思路]: 先要把字符串转成数组,再转回来,数据结构白学了? [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的 阅读全文
posted @ 2020-05-19 09:34 苗妙苗 阅读(138) 评论(0) 推荐(0)
摘要:[抄题]: 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 fart 阅读全文
posted @ 2020-05-14 09:04 苗妙苗 阅读(123) 评论(0) 推荐(0)
摘要:[抄题]: Given a string which contains only letters. Sort it by lower case first and upper case second. Example Example 1: Input: "abAcD" Output: "acbAD" 阅读全文
posted @ 2020-05-13 10:39 苗妙苗 阅读(183) 评论(0) 推荐(0)
摘要:引用:https://bbs.csdn.net/topics/90443881 https://zhuanlan.zhihu.com/p/50085206 树是图的子集树有一个根节点,图没有 树是没有环的图(在图里面,环的路线是开始和结束都是一样的点)数可以递归遍历,图要看情况数有层次划分,图没有树 阅读全文
posted @ 2020-05-12 08:24 苗妙苗 阅读(1627) 评论(0) 推荐(1)