<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[IPOC_BUPT的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/IPOC_BUPT</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; IPOC_BUPT]]></copyright><item><title><![CDATA[1. Two Sum]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/89016473</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/89016473</guid><author>IPOC_BUPT</author><pubDate>Thu, 04 Apr 2019 11:06:57 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/two-sum/
方法思路
Approach1：
public int[] twoSum(int[] nums, int target) {
        for(int i = 0; i &lt; nums.length; i++){
            for(int j = nums.length - 1...]]></description><category></category></item><item><title><![CDATA[987. Vertical Order Traversal of a Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88991323</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88991323</guid><author>IPOC_BUPT</author><pubDate>Wed, 03 Apr 2019 11:28:01 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, return the vertical order traversal of its nodes values.
For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1, ...]]></description><category></category></item><item><title><![CDATA[863. All Nodes Distance K in Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88988657</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88988657</guid><author>IPOC_BUPT</author><pubDate>Wed, 03 Apr 2019 09:57:37 +0800</pubDate><description><![CDATA[题目描述
We are given a binary tree (with root node root), a target node, and an integer value K.
Return a list of the values of all nodes that have a distance K from the target node.  The answer can be r...]]></description><category></category></item><item><title><![CDATA[958. Check Completeness of a Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88982896</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88982896</guid><author>IPOC_BUPT</author><pubDate>Tue, 02 Apr 2019 22:15:45 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely...]]></description><category></category></item><item><title><![CDATA[662. Maximum Width of Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88981790</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88981790</guid><author>IPOC_BUPT</author><pubDate>Tue, 02 Apr 2019 21:24:56 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a full binar...]]></description><category></category></item><item><title><![CDATA[968. Binary Tree Cameras]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88959158</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88959158</guid><author>IPOC_BUPT</author><pubDate>Mon, 01 Apr 2019 22:30:33 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, we install cameras on the nodes of the tree.
Each camera at a node can monitor its parent, itself, and its immediate children.
Calculate the minimum number of cameras needed ...]]></description><category></category></item><item><title><![CDATA[297. Serialize and Deserialize Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88956713</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88956713</guid><author>IPOC_BUPT</author><pubDate>Mon, 01 Apr 2019 20:36:59 +0800</pubDate><description><![CDATA[题目描述
题目链接
方法思路
Approach1:
The idea is simple: print the tree in pre-order traversal and use “X” to denote null node and split node with “,”. We can use a StringBuilder for building the string on the f...]]></description><category></category></item><item><title><![CDATA[99. Recover Binary Search Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88952690</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88952690</guid><author>IPOC_BUPT</author><pubDate>Mon, 01 Apr 2019 17:23:11 +0800</pubDate><description><![CDATA[题目描述
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.

题目链接
https://leetcode.com/problems/recover-binary-search-tree/
方法思路
public cla...]]></description><category></category></item><item><title><![CDATA[501. Find Mode in Binary Search Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88934878</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88934878</guid><author>IPOC_BUPT</author><pubDate>Sun, 31 Mar 2019 20:34:14 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/find-mode-in-binary-search-tree/
方法思路
Approach1： based on HashMap
class Solution {
    //Runtime: 6 ms, faster than 51.99%
    //Memory Usage: 40.3 MB, less th...]]></description><category></category></item><item><title><![CDATA[449. Serialize and Deserialize BST]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88928450</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88928450</guid><author>IPOC_BUPT</author><pubDate>Sun, 31 Mar 2019 14:22:46 +0800</pubDate><description><![CDATA[题目描述
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link ...]]></description><category></category></item><item><title><![CDATA[337. House Robber III]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88918199</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88918199</guid><author>IPOC_BUPT</author><pubDate>Sat, 30 Mar 2019 20:12:47 +0800</pubDate><description><![CDATA[题目描述
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. After a...]]></description><category></category></item><item><title><![CDATA[213. House Robber II]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88895323</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88895323</guid><author>IPOC_BUPT</author><pubDate>Fri, 29 Mar 2019 15:59:01 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/house-robber-ii/
方法思路
class Solution {
    //Runtime: 0 ms, faster than 100.00%
    //Memory Usage: 35.5 MB, less than 94.44%
    public int rob(int[] nums) {
...]]></description><category></category></item><item><title><![CDATA[198. House Robber     关于动态规划问题（Dynamic programming）的学习、思考与记录]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88880265</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88880265</guid><author>IPOC_BUPT</author><pubDate>Thu, 28 Mar 2019 22:37:15 +0800</pubDate><description><![CDATA[动态规划（Dynamic programming）
定义
任何数学递推公式都可以直接转换为递归算法，但是基本现实是编译器常常不能正确对待递归算法，结果导致低效的程序。当怀疑出现这样的情况时，我们必须再给编译器提供一些帮助，即将递归算法转换为非递归算法，让后者把那些子问题的答案系统的记录在一个表内。利用这种方法的一种技巧叫做动态规划。
以LeetCode.198. House Robber为例进行一...]]></description><category></category></item><item><title><![CDATA[652. Find Duplicate Subtrees（寻找重复的子树）]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88877105</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88877105</guid><author>IPOC_BUPT</author><pubDate>Thu, 28 Mar 2019 20:14:06 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them.
Two trees are duplicate if they have the same st...]]></description><category></category></item><item><title><![CDATA[236. Lowest Common Ancestor of a Binary Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88855798</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88855798</guid><author>IPOC_BUPT</author><pubDate>Wed, 27 Mar 2019 21:19:58 +0800</pubDate><description><![CDATA[题目描述
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node...]]></description><category></category></item><item><title><![CDATA[235. Lowest Common Ancestor of a Binary Search Tree]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88855116</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88855116</guid><author>IPOC_BUPT</author><pubDate>Wed, 27 Mar 2019 20:51:24 +0800</pubDate><description><![CDATA[题目描述
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: “The lowest common ancestor is defined betw...]]></description><category></category></item><item><title><![CDATA[222. Count Complete Tree Nodes（求完美二叉树的节点数）]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88846025</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88846025</guid><author>IPOC_BUPT</author><pubDate>Wed, 27 Mar 2019 15:25:07 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/count-complete-tree-nodes/
方法思路
Approach1:recursive dfs 很常规的方法
class Solution {
    //Runtime: 0 ms, faster than 100.00%
    //Memory Usage: 41.1 MB, less than...]]></description><category></category></item><item><title><![CDATA[199. Binary Tree Right Side View（二叉树的右视图）]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88844819</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88844819</guid><author>IPOC_BUPT</author><pubDate>Wed, 27 Mar 2019 14:52:15 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/binary-tree-right-side-view/
方法思路
Apprach1:
基于层序遍历，只添加每层的最后一个节点的值。
class Solution {
    //Runtime: 1 ms, faster than 72.32%
    //Memory Usage: 37.1 MB, less t...]]></description><category></category></item><item><title><![CDATA[284. Peeking Iterator]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88829777</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88829777</guid><author>IPOC_BUPT</author><pubDate>Tue, 26 Mar 2019 20:47:05 +0800</pubDate><description><![CDATA[题目描述

题目链接
https://leetcode.com/problems/peeking-iterator/
方法思路
Approach1:
class PeekingIterator implements Iterator&lt;Integer&gt; {
    //Runtime: 47 ms, faster than 99.35%
    //Memory Usage: 37 MB...]]></description><category></category></item><item><title><![CDATA[173. Binary Search Tree Iterator]]></title><link>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88829272</link><guid>https://blog.youkuaiyun.com/IPOC_BUPT/article/details/88829272</guid><author>IPOC_BUPT</author><pubDate>Tue, 26 Mar 2019 20:25:23 +0800</pubDate><description><![CDATA[题目描述


题目链接
https://leetcode.com/problems/binary-search-tree-iterator/
方法思路
Approach:using Queue
class BSTIterator {
    //Runtime: 59 ms, faster than 91.88% 
    //Memory Usage: 52.7 MB, less than 9....]]></description><category></category></item></channel></rss>