05 2020 档案
摘要:package LeetCode_131 /** * 131. Palindrome Partitioning * https://leetcode.com/problems/palindrome-partitioning/description/ * * Given a string s, par
阅读全文
摘要:package LeetCode_1428 /** * 1428. Leftmost Column with at Least a One * (locked by leetcode) (This problem is an interactive problem.) A binary matrix
阅读全文
摘要:package LeetCode_159 /** * 159. Longest Substring with At Most Two Distinct Characters * (Locked by leetcode) * https://www.lintcode.com/problem/longe
阅读全文
摘要:package _interview_question /** * Given a list/array of integers, return a boolean that states whether all numbers appear an even number of times. Exa
阅读全文
摘要:package LeetCode_332 import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashMap /** * 332. Reconstruct Itinerary * https
阅读全文
摘要:package _Sort.Algorithm.topological_sort /** * Topological Sort is for Directed Acyclic Graph(DAG,有向无环图) * A DAG Graph has least one vertex with in-de
阅读全文
摘要:package LeetCode_88 import java.util.* /** * 88. Merge Sorted Array * https://leetcode.com/problems/merge-sorted-array/description/ * * Given two sort
阅读全文
摘要:package LeetCode_377 /** * 377. Combination Sum IV * https://leetcode.com/problems/combination-sum-iv/description/ * * Given an integer array with all
阅读全文
摘要:package LeetCode_216 /** * 216. Combination Sum III * https://leetcode.com/problems/combination-sum-iii/description/ * * Find all possible combination
阅读全文
摘要:package LeetCode_39 /** * 39. Combination Sum * https://leetcode.com/problems/combination-sum/description/ * * Given a set of candidate numbers (candi
阅读全文
摘要:package LeetCode_496 import java.util.* import kotlin.collections.HashMap /** * 496. Next Greater Element I * https://leetcode.com/problems/next-great
阅读全文
摘要:package LeetCode_226 import java.util.* /** * 226. Invert Binary Tree * https://leetcode.com/problems/invert-binary-tree/description/ * * Invert a bin
阅读全文
摘要:package LeetCode_532 /** * 532. K-diff Pairs in an Array * https://leetcode.com/problems/k-diff-pairs-in-an-array/description/ * * Given an array of i
阅读全文
摘要:package _interview_question /** * https://leetcode.com/discuss/interview-question/275785/facebook-phone-screen-count-subsets * * Input: Given an array
阅读全文
摘要:dp是什么? dp是一种编程方法;将一个问题拆成几个子问题,分别求解这些子问题,即可推断出大问题的解。 无后效性 "未来与过去无关",这就是无后效性。如果给定某一阶段的状态,则在这一阶段以后过程的发展不受这阶段以前各段状态的影响; 有重复的子问题 子问题会被求解多次; 最优子结构 大问题的最优解可以
阅读全文
摘要:package LeetCode_236 /** * 236. Lowest Common Ancestor of a Binary Tree * https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/descri
阅读全文
摘要:package LeetCode_725 /** * 725. Split Linked List in Parts * https://leetcode.com/problems/split-linked-list-in-parts/description/ * * Given a (singly
阅读全文
摘要:package LeetCode_23 import java.util.* /** * 23. Merge k Sorted Lists * https://leetcode.com/problems/merge-k-sorted-lists/description/ * * Merge k so
阅读全文
摘要:package LeetCode_953 /** * 953. Verifying an Alien Dictionary * https://leetcode.com/problems/verifying-an-alien-dictionary/description/ * * In an ali
阅读全文
摘要:/** * Good morning! Here's your coding interview problem for today. This problem was asked by Amazon. Run-length encoding is a fast and simple method
阅读全文
摘要:package LeetCode_396 /** * 396. Rotate Function * https://leetcode.com/problems/rotate-function/description/ * * Given an array of integers A and let
阅读全文
摘要:package LeetCode_1232 /** * 1232. Check If It Is a Straight Line * https://leetcode.com/problems/check-if-it-is-a-straight-line/description/ * * You a
阅读全文
摘要:package LeetCode_81 /** * 81. Search in Rotated Sorted Array II * https://leetcode.com/problems/search-in-rotated-sorted-array-ii/description/ * * Sup
阅读全文
摘要:package LeetCode_33 /** * 33. Search in Rotated Sorted Array * https://leetcode.com/problems/search-in-rotated-sorted-array/description/ * * Suppose a
阅读全文
摘要:package LeetCode_64 /** * 64. Minimum Path Sum * https://leetcode.com/problems/minimum-path-sum/description/ * * Given a m x n grid filled with non-ne
阅读全文
摘要:package LeetCode_113 /** * 113. Path Sum II * https://leetcode.com/problems/path-sum-ii/description/ * Given a binary tree and a sum, find all root-to
阅读全文
摘要: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
阅读全文
摘要:package LeetCode_72 /** * 72. Edit Distance * https://leetcode.com/problems/edit-distance/description/ * * Given two words word1 and word2, find the m
阅读全文
摘要:package LeetCode_1426 import java.util.* /** * 1426. Counting Elements * Given an integer array arr, count element x such that x + 1 is also in arr. *
阅读全文
摘要:什么是霍夫曼编码 (Huffman Coding) 是一种用于无损数据压缩的权编码算法。由美国计算机科学家David Albert Huffman在1952年发明。 霍夫曼编码使用变长编码表泽源符号(如一个字母)进行编码,其中变长编码表是通过一种评估来源符号出现几率的方法得到的,出现几率高的字母使用
阅读全文
摘要:package LeetCode_136 /** * 136. Single Number * https://leetcode.com/problems/single-number/description/ * Given a non-empty array of integers, every
阅读全文
摘要:package _Sort.Algorithm /** * https://www.geeksforgeeks.org/heap-sort/ * https://www.cnblogs.com/chengxiao/p/6129630.html * * Heap Sort is an in-place
阅读全文