摘要:
package LeetCode_1443 import java.util.* import kotlin.collections.ArrayList /** * 1443. Minimum Time to Collect All Apples in a Tree * https://leetco 阅读全文
摘要:
package LeetCode_504 /** * 504. Base 7 (7进制) * https://leetcode.com/problems/base-7/description/ * Given an integer, return its base 7 string represen 阅读全文
摘要:
package LeetCode_298 /** * 298. Binary Tree Longest Consecutive Sequence (Locked by leetcode) * https://www.lintcode.com/problem/binary-tree-longest-c 阅读全文
摘要:
package LeetCode_655 /** * 655. Print Binary Tree * https://leetcode.com/problems/print-binary-tree/description/ * Example 1: Input: 1 / 2 Output: [[" 阅读全文
摘要:
package LeetCode_208 /** * 208. Implement Trie (Prefix Tree) * https://leetcode.com/problems/implement-trie-prefix-tree/description/ * */ class Trie() 阅读全文
摘要:
什么是TrieTree? Trie树,是一种非常重要的数据结构,又称字典树,查找单词树或者前缀树(Prefix Tree),是一种用于快速检索的多叉树结构,同时,它也是很多算法和复杂数据结构的基础,如后缀树,AC自动机等。 字典树(Tire)可以保存一些字符串->值的对应关系。基本上,跟Java的H 阅读全文
摘要:
我们先回顾一下,无论是栈还是队列,我们把元素进入的一端称作“尾部”,另一端称作“头部”。 对于栈,头部即是栈底,尾部即是栈顶。 对于队列,头部对应队首,尾部对应队尾。 单调栈 我们都已经非常熟悉栈了,它具有先入后出的性质。而单调栈为了满足单调的要求,增加了一下性质: 从栈顶到栈底的元素是严格递增 或 阅读全文
摘要:
package LeetCode_507 /** * 507. Perfect Number * https://leetcode.com/problems/perfect-number/description/ * We define the Perfect Number is a positiv 阅读全文
摘要:
package LeetCode_157 /** * 157. Read N Characters Given Read4 * Given a file and assume that you can only read the file using a given method read4, * 阅读全文
摘要:
/** * 161. One Edit Distance * https://www.lintcode.com/problem/one-edit-distance/description * Given two strings S and T, determine if they are both 阅读全文