- 博客(22)
- 收藏
- 关注
原创 LeetCode 131. Palindrome Partitioning(dfs)
题目来源:https://leetcode.com/problems/palindrome-partitioning/问题描述131.Palindrome PartitioningMediumGiven a strings, partitionssuch that every substring of the partition is a palindrome.Retu...
2019-06-23 10:40:36 269
原创 LeetCode 130. Surrounded Regions(bfs)
题目来源:https://leetcode.com/problems/surrounded-regions/问题描述130.Surrounded RegionsMediumGiven a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'.A region i...
2019-06-22 14:57:58 224
原创 LeetCode 129. Sum Root to Leaf Numbers(二叉树)
题目来源:https://leetcode.com/problems/sum-root-to-leaf-numbers/问题描述129.Sum Root to Leaf NumbersMediumGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a...
2019-06-22 14:02:07 175
原创 LeetCode 108. Convert Sorted Array to Binary Search Tree(二叉树)
题目来源:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/问题描述108.Convert Sorted Array to Binary Search TreeEasyGiven an array where elements are sorted in ascending order...
2019-06-22 13:04:54 155
原创 LeetCode 107. Binary Tree Level Order Traversal II(二叉树bfs)
题目来源:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/问题描述107.Binary Tree Level Order Traversal IIEasyGiven a binary tree, return thebottom-up level ordertraversal of its ...
2019-06-22 11:40:58 117
原创 LeetCode 123. Best Time to Buy and Sell Stock III(动态规划)
题目来源:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/问题描述123.Best Time to Buy and Sell Stock IIIHardSay you have an array for which theithelement is the price of a given st...
2019-06-22 11:31:25 258
原创 LeetCode 122. Best Time to Buy and Sell Stock II
题目来源:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/问题描述122.Best Time to Buy and Sell Stock IIEasySay you have an array for which theithelement is the price of a given stoc...
2019-06-21 23:24:36 123
原创 LeetCode 121. Best Time to Buy and Sell Stock(贪心)
121. Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy o...
2019-06-21 00:20:31 107
原创 Linux下export命令和source命令与环境变量设置
Linux下export命令和source命令与环境变量设置环境变量广泛用于程序运行环境的设置。从Linux shell的角度来看,环境变量无非就是shell脚本的变量而已。从这个角度理解环境变量,就能理解设置环境变量的那些命令究竟在做什么。说明:笔者的系统为debian,shell为bash,以下例子均在笔者的Linux环境下测试,不保证其他环境能够通过。export命令和source命令...
2019-06-20 11:30:32 7416
原创 LeetCode 127. Word Ladder(bfs)
题目来源:https://leetcode.com/problems/word-ladder/127.Word LadderMediumGiven two words (beginWordandendWord), and a dictionary's word list, find the length of shortest transformation sequence fr...
2019-06-19 00:46:38 177
原创 LeetCode 128. Longest Consecutive Sequence(哈希)
题目来源:https://leetcode.com/problems/longest-consecutive-sequence/问题描述128.Longest Consecutive SequenceHardGiven an unsorted array of integers, find the length of the longest consecutive element...
2019-06-18 01:00:23 92
原创 Linux存放二进制文件各个目录简介
Linux存放二进制文件各个目录简介Linux下有很多目录都存放有二进制可执行文件,列举如下/bin/sbin/usr/bin/usr/sbin/usr/local/bin/usr/local/sbin/opt之前常常困惑于这些不同的目录存放的二进制文件有什么区别,直到看到StackExchange上的一篇文章/usr/bin vs /usr/local/bin on Linu...
2019-06-16 21:30:01 6013
原创 C++ vector::push_back和Java List.add的区别
C++ vector::push_back和Java List.add的区别对象赋值C++和Java在对象赋值方面区别较大,归根到底,还是因为C++和Java中对象存储和引用方式不同。C++中静态建立(即Obj obj)的对象的内容(类属性)是存储在栈上的,变量obj直接持有对象本身;Java中建立的对象(Obj obj = new Obj())的内容(类属性)是存储在堆上的,位于栈上的变量o...
2019-06-16 16:04:13 1320
原创 LeetCode 126. Word Ladder II(bfs回溯路径)
题目来源:https://leetcode.com/problems/word-ladder-ii/问题描述126.Word Ladder IIHardGiven two words (beginWordandendWord), and a dictionary's word list, find all shortest transformation sequence(s)...
2019-06-16 01:00:46 542
原创 LeetCode 124. Binary Tree Maximum Path Sum(递归)
Binary Tree Maximum Path SumGiven a non-empty binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree alon...
2019-06-11 11:10:07 167
原创 LeetCode 120. Triangle
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[[2],[3,4],[6,5,7],[...
2019-06-11 10:19:00 116
原创 LeetCode 117. Populating Next Right Pointers in Each Node II(二叉树)
Populating Next Right Pointers in Each Node IIGiven a binary treestruct Node {int val;Node *left;Node *right;Node *next;}Populate each next pointer to point to its next right node. If there is...
2019-06-10 19:43:56 222
原创 LeetCode 116. Populating Next Right Pointers in Each Node(二叉树)
Populating Next Right Pointers in Each NodeYou are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:...
2019-06-05 14:05:12 158
原创 LeetCode 115. Distinct Subsequences(动态规划)
Distinct SubsequencesGiven a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the original string...
2019-06-04 11:39:35 304
原创 LeetCode 113. Path Sum II(二叉树)
Path Sum IIGiven 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.Example:Given the below binary tree and sum...
2019-06-03 15:12:13 155
原创 LeetCode 112. Path Sum(二叉树)
Path SumGiven 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.Note: A leaf is a node with no children.E...
2019-06-03 10:39:02 102
原创 LeetCode 87. Scramble String(动态规划)
Scramble StringGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”:To scramble t...
2019-06-02 19:43:16 214
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人