随笔分类 -  LeetCode

摘要: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 @ 2019-06-19 18:50 ChuckLu 阅读(310) 评论(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 @ 2019-06-18 19:30 ChuckLu 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2019-06-04 13:05 ChuckLu 阅读(238) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at 阅读全文
posted @ 2019-06-01 21:03 ChuckLu 阅读(298) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2019-06-01 15:28 ChuckLu 阅读(184) 评论(0) 推荐(0) 编辑
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2019-05-26 13:12 ChuckLu 阅读(201) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文
posted @ 2019-05-26 11:41 ChuckLu 阅读(144) 评论(0) 推荐(0) 编辑
摘要:Find the sum of all left leaves in a given binary tree. Example: Runtime: 92 ms, faster than 98.11% of C# online submissions for Sum of Left Leaves. M 阅读全文
posted @ 2019-05-25 15:41 ChuckLu 阅读(130) 评论(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 @ 2019-04-22 13:09 ChuckLu 阅读(146) 评论(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 @ 2019-04-19 13:14 ChuckLu 阅读(251) 评论(0) 推荐(0) 编辑
摘要:Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original t 阅读全文
posted @ 2019-04-18 13:09 ChuckLu 阅读(137) 评论(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 @ 2019-04-12 13:00 ChuckLu 阅读(158) 评论(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 dep 阅读全文
posted @ 2019-04-11 13:18 ChuckLu 阅读(125) 评论(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 @ 2019-04-10 23:43 ChuckLu 阅读(143) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Given an array where elements are sorted in ascending order, convert it to a 阅读全文
posted @ 2019-04-04 13:51 ChuckLu 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree [ 阅读全文
posted @ 2019-04-02 12:54 ChuckLu 阅读(261) 评论(0) 推荐(0) 编辑
摘要:104. Maximum Depth of Binary Tree Easy Easy Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest pa 阅读全文
posted @ 2019-03-18 13:16 ChuckLu 阅读(98) 评论(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 @ 2019-03-18 13:10 ChuckLu 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2019-03-14 13:21 ChuckLu 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middl 阅读全文
posted @ 2019-03-13 20:14 ChuckLu 阅读(149) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示