自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

侠客小虎的博客

一直奔跑的小蜗牛

  • 博客(34)
  • 收藏
  • 关注

原创 LeetCode.181 Employees Earning More Than Their Managers

题目:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.+----+-------+--------+-----------+| Id | Name |

2018-01-30 22:44:11 155

转载 MySQL数据库应用从入门到精通

MySQL数据库应用 从入门到精通 学习笔记以下内容是学习《MySQL数据库应用 从入门到精通》过程中总结的一些内容提要,供以后自己复现使用。  一:数据库查看所有数据库: SHOW DATABASES创建数据库: CREATE DATABSE database_name切换数据库: USE database_name删除数据库: DROP DATABASE database_name二:存储引擎...

2018-01-30 21:52:58 889

原创 LeetCode.177 Nth Highest Salary

题目:Write a SQL query to get the nth highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+

2018-01-30 21:14:56 221

原创 LeetCode.687 Longest Univalue Path (经典的求相同节点最长路径)

题目:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.Note: The length of path between tw

2018-01-30 16:12:30 679

原创 LeetCode.662 Maximum Width of Binary Tree

题目: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 aful

2018-01-30 14:58:31 308

原创 LeetCode.669 Trim a Binary Search Tree

题目:Given a binary search tree and the lowest and highest boundaries as L andR, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so t

2018-01-29 17:17:37 111

原创 LeetCode.655 Print Binary Tree(对左右子树位置确定)

题目:Print a binary tree in an m*n 2D string array following these rules: The row number m should be equal to the height of the given binary tree.The column number n should always be an odd

2018-01-29 16:45:45 245

原创 LeetCode.652 Find Duplicate Subtrees (Tree和HashMap结合应用,经典必备)

题目:Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of anyone of them. Two trees are duplicate if they have the sa

2018-01-29 10:44:57 218

原创 LeetCode.654 Maximum Binary Tree

题目:Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array. The left subtree is the maximum tree const

2018-01-25 19:42:27 190

原创 LeetCode.653 Two Sum IV - Input is a BST

题目:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input: 5 / \ 3 6

2018-01-25 16:14:34 131

原创 LeetCode.623 Add One Row to Tree

题目:Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with valuev at the given depthd. The root node is at depth 1. The adding rule is: given a positive

2018-01-25 15:00:41 171

原创 LeetCode.606 Construct String from Binary Tree

题目:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be represented by empty parenthesis pair "()". A

2018-01-24 15:14:00 134

转载 U盘插入提示使用驱动器光盘之前需要格式化

1.进入“运行”(Windows键+X),然后输入chkdsk G:/f(其中G是你U盘的盘符,f是fix修复的意思)。2.程序运行后就OK了,U盘就又可以正常打开了。

2018-01-24 15:02:06 42482 4

原创 LeetCode.572 Subtree of Another Tree(树的序列化和子串的匹配)

题目:Given two non-empty binary trees s and t, check whether treet has exactly the same structure and node values with a subtree ofs. A subtree ofs is a tree consists of a node ins and all of this

2018-01-23 15:28:36 191

原创 LeetCode.100 Same Tree

题目: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 identical and the nodes have the same value.

2018-01-23 11:23:40 134

原创 LeetCode.563 Binary Tree Tilt

题目:Given a binary tree, return the tilt of the whole tree.The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right s

2018-01-22 20:09:13 164

原创 LeetCode.543 Diameter of Binary Tree

题目: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 thelongest path between any two nodes in a tree. This path ma

2018-01-22 16:17:12 150

原创 LeetCode.538 Convert BST to Greater Tree

题目: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 keys greater than the original key in BST.

2018-01-22 15:32:19 141

原创 LeetCode.515 Find Largest Value in Each Tree Row

题目:You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]分析:/** *

2018-01-21 22:10:03 133

原创 LeetCode.513 Find Bottom Left Tree Value

题目:Given a binary tree, find the leftmost value in the last row of the tree. Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2 3

2018-01-21 21:49:26 108

原创 LeetCode.449 Serialize and Deserialize BST

题目: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 to

2018-01-18 21:12:11 170

原创 LeetCode.501 Find Mode in Binary Search Tree

题目: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 defined as follows:The left subtree of a node contains

2018-01-18 17:48:24 144

原创 LeetCode.450 Delete Node in a BST(经典删除二叉树某个节点,必备题)

题目:Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be divided in

2018-01-18 16:17:21 651

原创 LeetCode.257 Binary Tree Paths (求二叉树所有路径)

题目:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]Credits:Special thanks to @j

2018-01-18 10:22:01 179

原创 LeetCode.235(236) Lowest Common Ancestor of a Binary Search Tree && II

题目235: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

2018-01-17 19:45:43 151

原创 LeetCode.73 Set Matrix Zeroes

题目:Given 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.分析:class Solution { public void setZeroes(int[][] matrix) {

2018-01-15 11:22:59 61

原创 LeetCode.230 Kth Smallest Element in a BST

题目:Given a binary search tree, write a function kthSmallest to find thekth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What

2018-01-15 11:22:06 127

原创 LeetCode.116(117) Populating Next Right Pointers in Each Node && II

题目116:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right no

2018-01-12 23:16:27 141

原创 LeetCode.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 keys less than the node's k

2018-01-11 10:38:10 106

原创 MySQL数量查询(Case When 应用)

1.单表查询员工表empinfo结构如下:create table empinfo( Fempno varchar(20) not null primary key, Fempname varchar(20) not null, Fage number not null, Fsalary number not null);假设该表有大于1000万条记录;写一个最高效的S

2018-01-10 17:09:24 3104

原创 LeetCode.287 Find the Duplicate Number

题目:Given an array nums containing n + 1 integers where each integer is between 1 andn (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate nu

2018-01-06 11:21:52 198

原创 Intellij IDEA设置忽略部分类编译错误

有些时候我们的项目中有些错误,但这些错误并不影响项目的整体运行(或许是没有使用到),默认情况下idea是无法通过编译的,因此也就无法部署运行,要达到正确运行项目的目的需要作一些设置才行。设置Intellij IDEA忽略部分类编译错误设置很简单,只需要两步即可。1、设置Java编译器如上图所示,Ctrl+Alt+S快捷键打开“Settings”对话框,找到设置中的“Java C

2018-01-03 17:45:41 1584

原创 LeetCode.96(95) Unique Binary Search Trees(fibonacci的经典改进算法)&& II

题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1

2018-01-02 11:38:22 124

原创 LeetCode.114 Flatten Binary Tree to LinkedList

题目:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like:

2018-01-01 15:27:13 109

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除