├── .gitignore ├── README.md ├── SUMMARY.md ├── ads.txt ├── book.json ├── g.sh ├── leetCode-1-Two-Sum.md ├── leetCode-10-Regular-Expression-Matching.md ├── leetCode-11-Container-With-Most-Water.md ├── leetCode-12-Integer-to-Roman.md ├── leetCode-126-Word-LadderII.md ├── leetCode-127-Word-Ladder.md ├── leetCode-13-Roman-to-Integer.md ├── leetCode-14-Longest-Common-Prefix.md ├── leetCode-15-3Sum.md ├── leetCode-16-3Sum-Closest.md ├── leetCode-17-Letter-Combinations-of-a-Phone-Number.md ├── leetCode-18-4Sum.md ├── leetCode-19-Remov-Nth-Node-From-End-of-List.md ├── leetCode-2-Add-Two-Numbers.md ├── leetCode-20-Valid Parentheses.md ├── leetCode-21-Merge-Two-Sorted-Lists.md ├── leetCode-22-Generate-Parentheses.md ├── leetCode-23-Merge-k-Sorted-Lists.md ├── leetCode-24-Swap-Nodes-in-Pairs.md ├── leetCode-25-Reverse-Nodes-in-k-Group.md ├── leetCode-26-Remove-Duplicates-from-Sorted-Array.md ├── leetCode-27-Remove-Element.md ├── leetCode-28-Implement-strStr.md ├── leetCode-29-Divide-Two-Integers.md ├── leetCode-3-Longest-Substring-Without-Repeating-Characters.md ├── leetCode-30-Substring-with-Concatenation-of-All-Words.md ├── leetCode-31-Next-Permutation.md ├── leetCode-32-Longest-Valid-Parentheses.md ├── leetCode-33-Search-in-Rotated-Sorted-Array.md ├── leetCode-34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.md ├── leetCode-35-Search-Insert-Position.md ├── leetCode-36-Valid-Sudoku.md ├── leetCode-37-Sudoku-Solver.md ├── leetCode-38-Count-and-Say.md ├── leetCode-39-Combination-Sum.md ├── leetCode-4-Median-of-Two-Sorted-Arrays.md ├── leetCode-40-Combination-Sum-II.md ├── leetCode-41-First-Missing-Positive.md ├── leetCode-42-Trapping-Rain-Water.md ├── leetCode-43-Multiply-Strings.md ├── leetCode-44-Wildcard-Matching.md ├── leetCode-45-Jump-Game-II.md ├── leetCode-46-Permutations.md ├── leetCode-47-Permutations-II.md ├── leetCode-48-Rotate-Image.md ├── leetCode-49-Group-Anagrams.md ├── leetCode-5-Longest-Palindromic-Substring.md ├── leetCode-50-Pow.md ├── leetCode-51-N-Queens.md ├── leetCode-52-N-QueensII.md ├── leetCode-53-Maximum-Subarray.md ├── leetCode-54-Spiral-Matrix.md ├── leetCode-55-Jump-Game.md ├── leetCode-56-Merge-Intervals.md ├── leetCode-57-Insert-Interval.md ├── leetCode-58-Length-of-Last-Word.md ├── leetCode-59-Spiral-MatrixII.md ├── leetCode-6-ZigZag-Conversion.md ├── leetCode-60-Permutation-Sequence.md ├── leetCode-61-Rotate-List.md ├── leetCode-62-Unique-Paths.md ├── leetCode-63-Unique-PathsII.md ├── leetCode-64-Minimum-PathSum.md ├── leetCode-65-Valid-Number.md ├── leetCode-66-Plus-One.md ├── leetCode-67-Add Binary.md ├── leetCode-68-Text-Justification.md ├── leetCode-69-Sqrtx.md ├── leetCode-7-Reverse-Integer.md ├── leetCode-70-Climbing-Stairs.md ├── leetCode-71-Simplify-Path.md ├── leetCode-72-Edit-Distance.md ├── leetCode-74-Search-a-2D-Matrix.md ├── leetCode-75-Sort-Colors.md ├── leetCode-76-Minimum-Window-Substring.md ├── leetCode-77-Combinations.md ├── leetCode-78-Subsets.md ├── leetCode-79-Word-Search.md ├── leetCode-8-String-to-Integer.md ├── leetCode-80-Remove-Duplicates-from-Sorted-ArrayII.md ├── leetCode-81-Search-in-Rotated-Sorted-ArrayII.md ├── leetCode-82-Remove-Duplicates-from-Sorted-ListII.md ├── leetCode-83-Remove-Duplicates-from-Sorted-List.md ├── leetCode-84-Largest-Rectangle-in-Histogram.md ├── leetCode-85-Maximal-Rectangle.md ├── leetCode-86-Partition-List.md ├── leetCode-87-Scramble-String.md ├── leetCode-88-Merge-Sorted-Array.md ├── leetCode-89-Gray-Code.md ├── leetCode-9-Palindrome-Number.md ├── leetCode-90-SubsetsII.md ├── leetCode-92-Reverse-Linked-ListII.md ├── leetCode-93-Restore-IP-Addresses.md ├── leetCode-94-Binary-Tree-Inorder-Traversal.md ├── leetCode-95-Unique-Binary-Search-TreesII.md ├── leetCode-96-Unique-Binary-Search-Trees.md ├── leetCode-97-Interleaving-String.md ├── leetCode-98-Validate-Binary-Search-Tree.md ├── leetcode-100-Same-Tree.md ├── leetcode-101-200.md ├── leetcode-101-Symmetric-Tree.md ├── leetcode-102-Binary-Tree-Level-Order-Traversal.md ├── leetcode-103-Binary-Tree-Zigzag-Level-Order-Traversal.md ├── leetcode-104-Maximum-Depth-of-Binary-Tree.md ├── leetcode-105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md ├── leetcode-106-Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md ├── leetcode-107-Binary-Tree-Level-Order-TraversalII.md ├── leetcode-108-Convert-Sorted-Array-to-Binary-Search-Tree.md ├── leetcode-109-Convert-Sorted-List-to-Binary-Search-Tree.md ├── leetcode-110-Balanced-Binary-Tree.md ├── leetcode-111-Minimum-Depth-of-Binary-Tree.md ├── leetcode-112-Path-Sum.md ├── leetcode-113-Path-SumII.md ├── leetcode-114-Flatten-Binary-Tree-to-Linked-List.md ├── leetcode-115-Distinct-Subsequences.md ├── leetcode-116-Populating-Next-Right-Pointers-in-Each-Node.md ├── leetcode-117-Populating-Next-Right-Pointers-in-Each-NodeII.md ├── leetcode-118-Pascal's-Triangle.md ├── leetcode-119-Pascal's-TriangleII.md ├── leetcode-120-Triangle.md ├── leetcode-121-Best-Time-to-Buy-and-Sell-Stock.md ├── leetcode-122-Best-Time-to-Buy-and-Sell-StockII.md ├── leetcode-123-Best-Time-to-Buy-and-Sell-StockIII.md ├── leetcode-124-Binary-Tree-Maximum-Path-Sum.md ├── leetcode-125-Valid-Palindrome.md ├── leetcode-128-Longest-Consecutive-Sequence.md ├── leetcode-129-Sum-Root-to-Leaf-Numbers.md ├── leetcode-130-Longest-Increasing-Subsequence.md ├── leetcode-130-Surrounded-Regions.md ├── leetcode-131-Palindrome-Partitioning.md ├── leetcode-132-Palindrome-PartitioningII.md ├── leetcode-133-Clone-Graph.md ├── leetcode-134-Gas-Station.md ├── leetcode-135-Candy.md ├── leetcode-136-Single-Number.md ├── leetcode-137-Single-NumberII.md ├── leetcode-138-Copy-List-with-Random-Pointer.md ├── leetcode-139-Word-Break.md ├── leetcode-140-Word-BreakII.md ├── leetcode-141-Linked-List-Cycle.md ├── leetcode-142-Linked-List-CycleII.md ├── leetcode-143-Reorder-List.md ├── leetcode-144-Binary-Tree-Preorder-Traversal.md ├── leetcode-145-Binary-Tree-Postorder-Traversal.md ├── leetcode-146-LRU-Cache.md ├── leetcode-147-Insertion-Sort-List.md ├── leetcode-148-Sort-List.md ├── leetcode-149-Max-Points-on-a-Line.md ├── leetcode-150-Evaluate-Reverse-Polish-Notation.md ├── leetcode-151-Reverse-Words-in-a-String.md ├── leetcode-152-Maximum-Product-Subarray.md ├── leetcode-153-Find-Minimum-in-Rotated-Sorted-Array.md ├── leetcode-154-Find-Minimum-in-Rotated-Sorted-ArrayII.md ├── leetcode-155-Min-Stack.md ├── leetcode-160-Intersection-of-Two-Linked-Lists.md ├── leetcode-162-Find-Peak-Element.md ├── leetcode-164-Maximum-Gap.md ├── leetcode-165-Compare-Version-Numbers.md ├── leetcode-166-Fraction-to-Recurring-Decimal.md ├── leetcode-167-Two-SumII-Input-array-is-sorted.md ├── leetcode-168-Excel-Sheet-Column-Title.md ├── leetcode-169-Majority-Element.md ├── leetcode-171-Excel-Sheet-Column-Number.md ├── leetcode-172-Factorial-Trailing-Zeroes.md ├── leetcode-173-Binary-Search-Tree-Iterator.md ├── leetcode-174-Dungeon-Game.md ├── leetcode-179-Largest-Number.md ├── leetcode-187-Repeated-DNA-Sequences.md ├── leetcode-188-Best-Time-to-Buy-and-Sell-StockIV.md ├── leetcode-189-Rotate-Array.md ├── leetcode-190-Reverse-Bits.md ├── leetcode-191-Number-of-1-Bits.md ├── leetcode-198-House-Robber.md ├── leetcode-199-Binary-Tree-Right-Side-View.md ├── leetcode-200-Number-of-Islands.md ├── leetcode-201-300.md ├── leetcode-201-Bitwise-AND-of-Numbers-Range.md ├── leetcode-202-Happy-Number.md ├── leetcode-203-Remove-Linked-List-Elements.md ├── leetcode-204-Count-Primes.md ├── leetcode-205-Isomorphic-Strings.md ├── leetcode-206-Reverse-Linked-List.md ├── leetcode-207-Course-Schedule.md ├── leetcode-208-Implement-Trie-Prefix-Tree.md ├── leetcode-209-Minimum-Size-Subarray-Sum.md ├── leetcode-210-Course-ScheduleII.md ├── leetcode-211-Add-And-Search-Word-Data-structure-design.md ├── leetcode-212-Word-SearchII.md ├── leetcode-213-House-RobberII.md ├── leetcode-214-Shortest-Palindrome.md ├── leetcode-215-Kth-Largest-Element-in-an-Array.md ├── leetcode-216-Combination-SumIII.md ├── leetcode-217-Contains-Duplicate.md ├── leetcode-218-The-Skyline-Problem.md ├── leetcode-219-ContainsDuplicateII.md ├── leetcode-220-Contains-DuplicateIII.md ├── leetcode-221-Maximal-Square.md ├── leetcode-222-Count-Complete-Tree-Nodes.md ├── leetcode-223-Rectangle-Area.md ├── leetcode-224-Basic-Calculator.md ├── leetcode-225-Implement-Stack-using-Queues.md ├── leetcode-226-Invert-Binary-Tree.md ├── leetcode-227-Basic-CalculatorII.md ├── leetcode-228-Summary-Ranges.md ├── leetcode-229-Majority-ElementII.md ├── leetcode-230-Kth-Smallest-Element-in-a-BST.md ├── leetcode-231-Power-of-Two.md ├── leetcode-232-Implement-Queue-using-Stacks.md ├── leetcode-233-Number-of-Digit-One.md ├── leetcode-234-Palindrome-Linked-List.md ├── leetcode-235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree.md ├── leetcode-236-Lowest-Common-Ancestor-of-a-Binary-Tree.md ├── leetcode-237-Delete-Node-in-a-Linked-List.md ├── leetcode-238-Product-of-Array-Except-Self.md ├── leetcode-239-Sliding-Window-Maximum.md ├── leetcode-240-Search-a-2D-MatrixII.md ├── leetcode-241-Different-Ways-to-Add-Parentheses.md ├── leetcode-242-Valid-Anagram.md ├── leetcode-257-Binary-Tree-Paths.md ├── leetcode-258-Add-Digits.md ├── leetcode-260-Single-NumberIII.md ├── leetcode-263-Ugly-Number.md ├── leetcode-264-Ugly-NumberII.md ├── leetcode-268-Missing-Number.md ├── leetcode-273-Intege-to-English-Words.md ├── leetcode-274-H-Index.md ├── leetcode-275-H-IndexII.md ├── leetcode-278-First-Bad-Version.md ├── leetcode-279-Perfect-Squares.md ├── leetcode-282-Expression-Add-Operators.md ├── leetcode-283-Move-Zeroes.md ├── leetcode-284-Peeking-Iterator.md ├── leetcode-287-Find-the-Duplicate-Number.md ├── leetcode-289-Game-of-Life.md ├── leetcode-290-Word-Pattern.md ├── leetcode-292-Nim-Game.md ├── leetcode-295-Find-Median-from-Data-Stream.md ├── leetcode-297-Serialize-and-Deserialize-Binary-Tree.md ├── leetcode-299-Bulls-and-Cows.md ├── leetcode-300-Longest-Increasing-Subsequence.md ├── leetcode-301-400.md ├── leetcode-301-Remove-Invalid-Parentheses.md ├── leetcode-303-Range-Sum-Query-Immutable.md ├── leetcode-304-Range-Sum-Query-2D-Immutable.md ├── leetcode-306-Additive-Number.md ├── leetcode-307-Range-Sum-Query-Mutable.md ├── leetcode-73-Set-Matrix-Zeroes.md ├── leetcode-91-Decode-Ways.md ├── leetcode-99-Recover-Binary-Search-Tree.md ├── leetcode100斩回顾.md ├── leetcode力扣刷题1到300的感受.md ├── more.md ├── node_modules ├── .bin │ ├── katex │ └── katex.cmd ├── boolbase │ ├── README.md │ ├── index.js │ └── package.json ├── cheerio │ ├── History.md │ ├── Readme.md │ ├── index.js │ ├── lib │ │ ├── api │ │ │ ├── attributes.js │ │ │ ├── css.js │ │ │ ├── forms.js │ │ │ ├── manipulation.js │ │ │ └── traversing.js │ │ ├── cheerio.js │ │ ├── parse.js │ │ ├── static.js │ │ └── utils.js │ └── package.json ├── colors │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── normal-usage.js │ │ └── safe-string.js │ ├── index.d.ts │ ├── lib │ │ ├── colors.js │ │ ├── custom │ │ │ ├── trap.js │ │ │ └── zalgo.js │ │ ├── extendStringPrototype.js │ │ ├── index.js │ │ ├── maps │ │ │ ├── america.js │ │ │ ├── rainbow.js │ │ │ ├── random.js │ │ │ └── zebra.js │ │ ├── styles.js │ │ └── system │ │ │ ├── has-flag.js │ │ │ └── supports-colors.js │ ├── package.json │ ├── safe.d.ts │ ├── safe.js │ └── themes │ │ └── generic-logging.js ├── core-util-is │ ├── LICENSE │ ├── README.md │ ├── float.patch │ ├── lib │ │ └── util.js │ ├── package.json │ └── test.js ├── css-select │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── attributes.js │ │ ├── compile.js │ │ ├── general.js │ │ ├── procedure.json │ │ ├── pseudos.js │ │ └── sort.js │ └── package.json ├── css-what │ ├── LICENSE │ ├── index.js │ ├── package.json │ └── readme.md ├── dom-serializer │ ├── LICENSE │ ├── index.js │ ├── node_modules │ │ └── domelementtype │ │ │ ├── LICENSE │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── readme.md │ └── package.json ├── domelementtype │ ├── LICENSE │ ├── index.js │ ├── package.json │ └── readme.md ├── domhandler │ ├── .travis.yml │ ├── LICENSE │ ├── index.js │ ├── lib │ │ ├── element.js │ │ └── node.js │ ├── package.json │ ├── readme.md │ └── test │ │ ├── cases │ │ ├── 01-basic.json │ │ ├── 02-single_tag_1.json │ │ ├── 03-single_tag_2.json │ │ ├── 04-unescaped_in_script.json │ │ ├── 05-tags_in_comment.json │ │ ├── 06-comment_in_script.json │ │ ├── 07-unescaped_in_style.json │ │ ├── 08-extra_spaces_in_tag.json │ │ ├── 09-unquoted_attrib.json │ │ ├── 10-singular_attribute.json │ │ ├── 11-text_outside_tags.json │ │ ├── 12-text_only.json │ │ ├── 13-comment_in_text.json │ │ ├── 14-comment_in_text_in_script.json │ │ ├── 15-non-verbose.json │ │ ├── 16-normalize_whitespace.json │ │ ├── 17-xml_namespace.json │ │ ├── 18-enforce_empty_tags.json │ │ ├── 19-ignore_empty_tags.json │ │ ├── 20-template_script_tags.json │ │ ├── 21-conditional_comments.json │ │ ├── 22-lowercase_tags.json │ │ ├── 23-dom-lvl1.json │ │ ├── 24-with-start-indices.json │ │ └── 25-with-end-indices.json │ │ └── tests.js ├── domutils │ ├── .npmignore │ ├── LICENSE │ ├── index.js │ ├── lib │ │ ├── helpers.js │ │ ├── legacy.js │ │ ├── manipulation.js │ │ ├── querying.js │ │ ├── stringify.js │ │ └── traversal.js │ ├── package.json │ ├── readme.md │ └── test │ │ ├── fixture.js │ │ ├── tests │ │ ├── helpers.js │ │ ├── legacy.js │ │ └── traversal.js │ │ └── utils.js ├── entities │ ├── .travis.yml │ ├── LICENSE │ ├── index.js │ ├── lib │ │ ├── decode.js │ │ ├── decode_codepoint.js │ │ └── encode.js │ ├── maps │ │ ├── decode.json │ │ ├── entities.json │ │ ├── legacy.json │ │ └── xml.json │ ├── package.json │ ├── readme.md │ └── test │ │ ├── mocha.opts │ │ └── test.js ├── gitbook-plugin-ad │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── book │ │ ├── plugin.css │ │ └── plugin.js │ ├── index.js │ └── package.json ├── gitbook-plugin-adsense │ ├── .editorconfig │ ├── .eslintrc │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── book │ │ └── plugin.js │ ├── index.js │ └── package.json ├── gitbook-plugin-anchor-navigation-ex │ ├── .idea │ │ ├── gitbook-plugin-anchor-navigation-ex.iml │ │ ├── jsLibraryMappings.xml │ │ ├── markdown-navigator.xml │ │ ├── markdown-navigator │ │ │ └── profiles_settings.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ ├── vcs.xml │ │ ├── watcherTasks.xml │ │ └── workspace.xml │ ├── LICENSE │ ├── README.md │ ├── assets │ │ ├── lib │ │ │ ├── config.js │ │ │ ├── log.js │ │ │ └── plugin.js │ │ └── style │ │ │ └── plugin.css │ ├── doc │ │ ├── README_EN.md │ │ ├── config-en.md │ │ ├── config.md │ │ ├── effectScreenshot.md │ │ ├── images │ │ │ ├── night默认参数效果.png │ │ │ ├── pageTop展示.png │ │ │ ├── printlog.png │ │ │ ├── sepia默认参数效果.png │ │ │ ├── toc标题icon展示.jpg │ │ │ ├── toc标题icon展示2.jpg │ │ │ ├── white默认参数效果.png │ │ │ ├── 层级关联显示.png │ │ │ ├── 标题重新与默认主题层级相关联.jpg │ │ │ └── 锚点效果和top展示.jpg │ │ ├── updateRecord-en.md │ │ └── updateRecord.md │ ├── index.js │ └── package.json ├── gitbook-plugin-anchors │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── plugin.css │ ├── index.js │ └── package.json ├── gitbook-plugin-copy-code-button │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── book │ │ └── toggle.js │ ├── demo_gif.gif │ ├── index.js │ └── package.json ├── gitbook-plugin-expandable-chapters-small │ ├── .npmignore │ ├── .project │ ├── LICENSE │ ├── README.md │ ├── book │ │ ├── expandable-chapters-small.css │ │ └── expandable-chapters-small.js │ ├── index.js │ └── package.json ├── gitbook-plugin-github-buttons │ ├── LICENSE │ ├── README.md │ ├── _layouts │ │ └── website │ │ │ └── page.html │ ├── index.js │ ├── lib │ │ ├── plugin.js │ │ └── plugin.js.map │ ├── package.json │ └── src │ │ └── plugin.js ├── gitbook-plugin-github │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── plugin.js │ ├── index.js │ └── package.json ├── gitbook-plugin-katex │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── static │ │ ├── fonts │ │ ├── KaTeX_AMS-Regular.eot │ │ ├── KaTeX_AMS-Regular.ttf │ │ ├── KaTeX_AMS-Regular.woff │ │ ├── KaTeX_AMS-Regular.woff2 │ │ ├── KaTeX_Caligraphic-Bold.eot │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ ├── KaTeX_Caligraphic-Regular.eot │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ ├── KaTeX_Fraktur-Bold.eot │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ ├── KaTeX_Fraktur-Bold.woff │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ ├── KaTeX_Fraktur-Regular.eot │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ ├── KaTeX_Fraktur-Regular.woff │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ ├── KaTeX_Main-Bold.eot │ │ ├── KaTeX_Main-Bold.ttf │ │ ├── KaTeX_Main-Bold.woff │ │ ├── KaTeX_Main-Bold.woff2 │ │ ├── KaTeX_Main-Italic.eot │ │ ├── KaTeX_Main-Italic.ttf │ │ ├── KaTeX_Main-Italic.woff │ │ ├── KaTeX_Main-Italic.woff2 │ │ ├── KaTeX_Main-Regular.eot │ │ ├── KaTeX_Main-Regular.ttf │ │ ├── KaTeX_Main-Regular.woff │ │ ├── KaTeX_Main-Regular.woff2 │ │ ├── KaTeX_Math-BoldItalic.eot │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ ├── KaTeX_Math-BoldItalic.woff │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ ├── KaTeX_Math-Italic.eot │ │ ├── KaTeX_Math-Italic.ttf │ │ ├── KaTeX_Math-Italic.woff │ │ ├── KaTeX_Math-Italic.woff2 │ │ ├── KaTeX_Math-Regular.eot │ │ ├── KaTeX_Math-Regular.ttf │ │ ├── KaTeX_Math-Regular.woff │ │ ├── KaTeX_Math-Regular.woff2 │ │ ├── KaTeX_SansSerif-Bold.eot │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ ├── KaTeX_SansSerif-Bold.woff │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ ├── KaTeX_SansSerif-Italic.eot │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ ├── KaTeX_SansSerif-Italic.woff │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ ├── KaTeX_SansSerif-Regular.eot │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ ├── KaTeX_SansSerif-Regular.woff │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ ├── KaTeX_Script-Regular.eot │ │ ├── KaTeX_Script-Regular.ttf │ │ ├── KaTeX_Script-Regular.woff │ │ ├── KaTeX_Script-Regular.woff2 │ │ ├── KaTeX_Size1-Regular.eot │ │ ├── KaTeX_Size1-Regular.ttf │ │ ├── KaTeX_Size1-Regular.woff │ │ ├── KaTeX_Size1-Regular.woff2 │ │ ├── KaTeX_Size2-Regular.eot │ │ ├── KaTeX_Size2-Regular.ttf │ │ ├── KaTeX_Size2-Regular.woff │ │ ├── KaTeX_Size2-Regular.woff2 │ │ ├── KaTeX_Size3-Regular.eot │ │ ├── KaTeX_Size3-Regular.ttf │ │ ├── KaTeX_Size3-Regular.woff │ │ ├── KaTeX_Size3-Regular.woff2 │ │ ├── KaTeX_Size4-Regular.eot │ │ ├── KaTeX_Size4-Regular.ttf │ │ ├── KaTeX_Size4-Regular.woff │ │ ├── KaTeX_Size4-Regular.woff2 │ │ ├── KaTeX_Typewriter-Regular.eot │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ ├── KaTeX_Typewriter-Regular.woff │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ └── katex.min.css ├── gitbook-plugin-meta │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── _layouts │ │ └── website │ │ │ └── page.html │ └── package.json ├── gitbook-plugin-search-plus │ ├── .eslintrc.json │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── _layouts │ │ └── website │ │ │ └── page.html │ ├── assets │ │ ├── jquery.mark.min.js │ │ ├── search.css │ │ └── search.js │ ├── index.js │ ├── package.json │ ├── search.gif │ ├── search2.gif │ └── search3.gif ├── gitbook-plugin-sitemap │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── gitbook-plugin-splitter │ ├── .npmignore │ ├── LICENSE.txt │ ├── README.md │ ├── book │ │ ├── splitter.css │ │ └── splitter.js │ ├── gitbook-splitter-demo.gif │ ├── index.js │ └── package.json ├── gitbook-plugin-toggle-chapters │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── book │ │ ├── toggle.css │ │ └── toggle.js │ ├── index.js │ └── package.json ├── github-slugid │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ └── test.js ├── html-entities │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── html4-entities.js │ │ ├── html5-entities.js │ │ └── xml-entities.js │ └── package.json ├── htmlparser2 │ ├── LICENSE │ ├── README.md │ ├── lib │ │ ├── CollectingHandler.js │ │ ├── FeedHandler.js │ │ ├── Parser.js │ │ ├── ProxyHandler.js │ │ ├── Stream.js │ │ ├── Tokenizer.js │ │ ├── WritableStream.js │ │ └── index.js │ └── package.json ├── inherits │ ├── LICENSE │ ├── README.md │ ├── inherits.js │ ├── inherits_browser.js │ └── package.json ├── isarray │ ├── .npmignore │ ├── .travis.yml │ ├── Makefile │ ├── README.md │ ├── component.json │ ├── index.js │ ├── package.json │ └── test.js ├── katex │ ├── LICENSE.txt │ ├── README.md │ ├── cli.js │ ├── dist │ │ ├── README.md │ │ ├── contrib │ │ │ └── auto-render.min.js │ │ ├── fonts │ │ │ ├── KaTeX_AMS-Regular.eot │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.eot │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.eot │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.eot │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.eot │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-Bold.eot │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-Italic.eot │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.eot │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.eot │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-Italic.eot │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_Math-Regular.eot │ │ │ ├── KaTeX_Math-Regular.ttf │ │ │ ├── KaTeX_Math-Regular.woff │ │ │ ├── KaTeX_Math-Regular.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.eot │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.eot │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.eot │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Script-Regular.eot │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Size1-Regular.eot │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.eot │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.eot │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.eot │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.eot │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ ├── katex.css │ │ ├── katex.js │ │ ├── katex.min.css │ │ └── katex.min.js │ ├── katex.js │ ├── package.json │ └── src │ │ ├── Lexer.js │ │ ├── MacroExpander.js │ │ ├── Options.js │ │ ├── ParseError.js │ │ ├── Parser.js │ │ ├── Settings.js │ │ ├── Style.js │ │ ├── buildCommon.js │ │ ├── buildHTML.js │ │ ├── buildMathML.js │ │ ├── buildTree.js │ │ ├── delimiter.js │ │ ├── domTree.js │ │ ├── environments.js │ │ ├── fontMetrics.js │ │ ├── fontMetricsData.js │ │ ├── functions.js │ │ ├── mathMLTree.js │ │ ├── parseData.js │ │ ├── parseTree.js │ │ ├── symbols.js │ │ ├── unicodeRegexes.js │ │ └── utils.js ├── lodash.assignin │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.bind │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.defaults │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.filter │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.flatten │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.foreach │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.map │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.merge │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.pick │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.reduce │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.reject │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── lodash.some │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── match-at │ ├── LICENSE │ ├── README.md │ ├── lib │ │ ├── __tests__ │ │ │ └── matchAt-test.js │ │ ├── matchAt.js │ │ └── matchAt.js.flow │ └── package.json ├── nth-check │ ├── .travis.yml │ ├── README.md │ ├── compile.js │ ├── index.js │ ├── package.json │ ├── parse.js │ └── test.js ├── process-nextick-args │ ├── index.js │ ├── license.md │ ├── package.json │ └── readme.md ├── readable-stream │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── GOVERNANCE.md │ ├── LICENSE │ ├── README.md │ ├── doc │ │ └── wg-meetings │ │ │ └── 2015-01-30.md │ ├── duplex-browser.js │ ├── duplex.js │ ├── lib │ │ ├── _stream_duplex.js │ │ ├── _stream_passthrough.js │ │ ├── _stream_readable.js │ │ ├── _stream_transform.js │ │ ├── _stream_writable.js │ │ └── internal │ │ │ └── streams │ │ │ ├── BufferList.js │ │ │ ├── destroy.js │ │ │ ├── stream-browser.js │ │ │ └── stream.js │ ├── package.json │ ├── passthrough.js │ ├── readable-browser.js │ ├── readable.js │ ├── transform.js │ ├── writable-browser.js │ └── writable.js ├── safe-buffer │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── sitemap │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── index.js │ ├── lib │ │ ├── errors.js │ │ ├── sitemap.js │ │ └── utils.js │ └── package.json ├── string_decoder │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── lib │ │ └── string_decoder.js │ └── package.json ├── underscore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── underscore-min.js │ ├── underscore-min.js.map │ └── underscore.js ├── url-join │ ├── .npmignore │ ├── README.md │ ├── lib │ │ └── url-join.js │ ├── package.json │ └── test │ │ └── tests.js └── util-deprecate │ ├── History.md │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── node.js │ └── package.json ├── package-lock.json ├── sitemap.xml ├── websiteStyle.css └── 极客时间优惠红包返现.md /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | _book/ 3 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 介绍 2 | 3 | 题解预览地址:[https://leetcode.wang](https://leetcode.wang),推荐电脑端打开,手机打开的话将页面滑到最上边,左上角是菜单 4 | 5 | leetcode 题目地址 https://leetcode.com/problemset/all/ 6 | 7 | github 项目地址:https://github.com/wind-liang/leetcode 8 | 9 | 为什么刷题:https://leetcode.wang/leetcode100%E6%96%A9%E5%9B%9E%E9%A1%BE.html 10 | 11 | 知乎开设了专栏,同步更新:[https://zhuanlan.zhihu.com/leetcode1024](https://zhuanlan.zhihu.com/leetcode1024),关注后可以及时收到更新,网站有时候可能出问题打不开,建议关注一下知乎专栏备用 12 | 13 | 准备刷一道,总结一道。 14 | 15 | 可以加好友一起交流。 16 | 17 | 微信: 17771420231 18 | 19 | 公众号: windliang,更新编程相关 20 | 21 | 如果觉得对你有帮助,记得给一个 star 哦 ^ ^ 22 | -------------------------------------------------------------------------------- /ads.txt: -------------------------------------------------------------------------------- 1 | google.com, pub-1480477141602191, DIRECT, f08c47fec0942fa0 -------------------------------------------------------------------------------- /g.sh: -------------------------------------------------------------------------------- 1 | git add . && git commit -m $1 && git push origin master -------------------------------------------------------------------------------- /leetCode-21-Merge-Two-Sorted-Lists.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/21.jpg) 4 | 5 | 合并两个有序链表。 6 | 7 | # 解法一 迭代 8 | 9 | 遍历两个链表。 10 | 11 | ```java 12 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) { 13 | ListNode h = new ListNode(0); 14 | ListNode ans=h; 15 | while (l1 != null && l2 != null) { 16 | if (l1.val < l2.val) { 17 | h.next = l1; 18 | h = h.next; 19 | l1 = l1.next; 20 | } else { 21 | h.next = l2; 22 | h = h.next; 23 | l2 = l2.next; 24 | } 25 | } 26 | if(l1==null){ 27 | h.next=l2; 28 | } 29 | if(l2==null){ 30 | h.next=l1; 31 | } 32 | return ans.next; 33 | } 34 | ``` 35 | 36 | 时间复杂度:O(m + n)。 37 | 38 | 空间复杂度:O(1)。 39 | 40 | # 解法二 递归 41 | 42 | 参考[这里](Merge Two Sorted Lists) 43 | 44 | ```java 45 | ListNode mergeTwoLists(ListNode l1, ListNode l2) { 46 | if(l1 == null) return l2; 47 | if(l2 == null) return l1; 48 | 49 | if(l1.val < l2.val) { 50 | l1.next = mergeTwoLists(l1.next, l2); 51 | return l1; 52 | } else { 53 | l2.next = mergeTwoLists(l2.next, l1); 54 | return l2; 55 | } 56 | } 57 | ``` 58 | 59 | 时间复杂度: 60 | 61 | 空间复杂度: 62 | 63 | # 总 64 | 65 | 递归看起来,两个字,优雅!但是关于递归的时间复杂度,空间复杂度的求法,先留个坑吧。 -------------------------------------------------------------------------------- /leetCode-58-Length-of-Last-Word.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/58.jpg) 4 | 5 | 输出最后一个单词的长度。 6 | 7 | # 解法一 8 | 9 | 直接从最后一个字符往前遍历,遇到空格停止就可以了。不过在此之前要过滤到末尾的空格。 10 | 11 | ```java 12 | public int lengthOfLastWord(String s) { 13 | int count = 0; 14 | int index = s.length() - 1; 15 | //过滤空格 16 | while (true) { 17 | if (index < 0 || s.charAt(index) != ' ') 18 | break; 19 | index--; 20 | } 21 | //计算最后一个单词的长度 22 | for (int i = index; i >= 0; i--) { 23 | if (s.charAt(i) == ' ') { 24 | break; 25 | } 26 | count++; 27 | } 28 | return count; 29 | } 30 | ``` 31 | 32 | 时间复杂度:O(n)。 33 | 34 | 空间复杂度:O(1)。 35 | 36 | # 总 37 | 38 | 时隔多天,又遇到了一个简单的题,没什么好说的,就是遍历一遍,没有 get 到考点。 -------------------------------------------------------------------------------- /leetCode-74-Search-a-2D-Matrix.md: -------------------------------------------------------------------------------- 1 | # 题目描述(中等难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/74.jpg) 4 | 5 | 判断一个矩阵中是否存在某个数,矩阵是有序的。 6 | 7 | # 解法一 二分法 8 | 9 | 看到了有序序列,啥都不用想直接二分,只需要考虑到怎么把二分时候的下标转换为矩阵的行、列下标就可以了,很简单,用除法和求余就够了。 10 | 11 | ```java 12 | public boolean searchMatrix(int[][] matrix, int target) { 13 | int rows = matrix.length; 14 | if (rows == 0) { 15 | return false; 16 | } 17 | int cols = matrix[0].length; 18 | int left = 0; 19 | int right = rows * cols - 1; 20 | while (left <= right) { 21 | int mid = (left + right) / 2; 22 | int temp = matrix[mid / cols][mid % cols]; 23 | if (temp == target) { 24 | return true; 25 | } else if (temp < target) { 26 | left = mid + 1; 27 | } else { 28 | right = mid - 1; 29 | } 30 | } 31 | return false; 32 | } 33 | ``` 34 | 35 | 时间复杂度:O ( log ( n ) )。 36 | 37 | 空间复杂度:O ( 1 )。 38 | 39 | # 总 40 | 41 | 这道题的二分法,比较简单,大家可以看下[33题](),相信对二分法会有一个更深刻的理解。 -------------------------------------------------------------------------------- /leetcode-118-Pascal's-Triangle.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/118.jpg) 4 | 5 | 其实就是杨辉三角,当前元素等于上一层的两个元素的和。 6 | 7 | # 解法一 8 | 9 | 用两层循环,注意一下我们下标是从 0 开始还是从 1 开始,然后就可以写出来了。 10 | 11 | ```java 12 | public List> generate(int numRows) { 13 | List> ans = new ArrayList<>(); 14 | for (int i = 0; i < numRows; i++) { 15 | List sub = new ArrayList<>(); 16 | for (int j = 0; j <= i; j++) { 17 | if (j == 0 || j == i) { 18 | sub.add(1); 19 | } else { 20 | List last = ans.get(i - 1); 21 | sub.add(last.get(j - 1) + last.get(j)); 22 | } 23 | 24 | } 25 | ans.add(sub); 26 | } 27 | return ans; 28 | } 29 | ``` 30 | 31 | # 总 32 | 33 | 好像有一段时间没有碰到简单题了,哈哈。 -------------------------------------------------------------------------------- /leetcode-141-Linked-List-Cycle.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/141.png) 4 | 5 | 判断一个链表是否有环。 6 | 7 | # 解法一 8 | 9 | 最直接的方法,遍历链表,并且把遍历过的节点用 `HashSet` 存起来,如果遍历过程中又遇到了之前的节点就说明有环。如果到达了 `null` 就说明没有环。 10 | 11 | ```java 12 | public boolean hasCycle(ListNode head) { 13 | HashSet set = new HashSet<>(); 14 | while (head != null) { 15 | set.add(head); 16 | head = head.next; 17 | if (set.contains(head)) { 18 | return true; 19 | } 20 | } 21 | return false; 22 | } 23 | ``` 24 | 25 | # 解法二 26 | 27 | 学数据结构课程的时候,应该都用过这个方法,很巧妙,快慢指针。 28 | 29 | 原理也很好理解,想象一下圆形跑道,两个人跑步,如果一个人跑的快,一个人跑的慢,那么不管两个人从哪个位置出发,跑的过程中两人一定会相遇。 30 | 31 | 所以这里我们用两个指针 `fast` 和 `slow`。`fast` 每次走两步,`slow` 每次走一步,如果 `fast` 到达了 `null` 就说明没有环。如果 `fast` 和 `slow` 相遇了就说明有环。 32 | 33 | ```java 34 | public boolean hasCycle(ListNode head) { 35 | ListNode slow = head; 36 | ListNode fast = head; 37 | while (fast != null) { 38 | if (fast.next == null) { 39 | return false; 40 | } 41 | slow = slow.next; 42 | fast = fast.next.next; 43 | if (fast == slow) { 44 | return true; 45 | } 46 | } 47 | return false; 48 | } 49 | ``` 50 | 51 | # 总 52 | 53 | 比较简单的一道题了,快慢指针的思想,也比较常用,很巧妙。 -------------------------------------------------------------------------------- /leetcode-167-Two-SumII-Input-array-is-sorted.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/167.jpg) 4 | 5 | 给一个有序数组和一个目标值,找出两个数使其和为目标值,返回这两个数的位置(数组下标加 1)。 6 | 7 | # 解法一 8 | 9 | [第 1 题](https://leetcode.wang/leetCode-1-Two-Sum.html) 做过无序数组找两个数,里边的解法当然也可以用到这道题,利用了 `HashMap`,可以过去看一下。 10 | 11 | [第 15 题](https://leetcode.wang/leetCode-15-3Sum.html) 找出三个数,使其和为目标值的题目中的解法中,其实我们将问题转换到了现在这道题,也可以过去看一下。具体的话,其实我们只需要首尾两个指针进行遍历即可。 12 | 13 | ```java 14 | public int[] twoSum(int[] numbers, int target) { 15 | int i = 0; 16 | int j = numbers.length - 1; 17 | while (i < j) { 18 | if (numbers[i] + numbers[j] == target) { 19 | return new int[] { i + 1, j + 1 }; 20 | } else if (numbers[i] + numbers[j] < target) { 21 | i++; 22 | } else { 23 | j--; 24 | } 25 | } 26 | //因为题目告诉我们一定有解,所以这里随便返回了 27 | return new int[] { -1, -1 }; 28 | } 29 | ``` 30 | 31 | # 总 32 | 33 | 这道题没有新东西,双指针的技巧经常用到。这可能是篇幅最少的一个题解了,哈哈。 -------------------------------------------------------------------------------- /leetcode-203-Remove-Linked-List-Elements.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/203.jpg) 4 | 5 | 给一个链表,删除链表中的给定值。 6 | 7 | # 解法一 8 | 9 | 遍历一遍去找目标值,将找到的所有节点删除即可。 10 | 11 | 为了方便考虑头结点,我们加一个 `dummy` 指针,`next` 指向头结点,这个技巧在链表中经常用到。在 [19 题](https://leetcode.wang/leetCode-19-Remov-Nth-Node-From-End-of-List.html) 中应该是第一次用到。 12 | 13 | ```java 14 | public ListNode removeElements(ListNode head, int val) { 15 | ListNode dummyHead = new ListNode(0); 16 | dummyHead.next = head; 17 | ListNode newHead = dummyHead; 18 | //newHead 始终指向要考虑的节点的前一个位置 19 | while (newHead.next != null) { 20 | ListNode next = newHead.next; 21 | if (next.val == val) { 22 | newHead.next = next.next; 23 | } else { 24 | newHead = newHead.next; 25 | } 26 | 27 | } 28 | return dummyHead.next; 29 | } 30 | ``` 31 | 32 | # 解法二 递归 33 | 34 | 也可以用递归,会更好理解一些。但是递归需要压栈,需要消耗一定的空间。 35 | 36 | ```java 37 | public ListNode removeElements(ListNode head, int val) { 38 | if (head == null) { 39 | return head; 40 | } 41 | if (head.val == val) { 42 | return removeElements(head.next, val); 43 | } else { 44 | head.next = removeElements(head.next, val); 45 | return head; 46 | } 47 | } 48 | ``` 49 | 50 | # 总 51 | 52 | 主要就是对链表的删除,还有 `dummy` 指针的使用。 -------------------------------------------------------------------------------- /leetcode-216-Combination-SumIII.md: -------------------------------------------------------------------------------- 1 | # 题目描述(中等难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/216.jpg) 4 | 5 | 返回所有目标和的组合。`k` 代表每个组合能选取的个数,`n` 代表目标和,可选取的数字是 `1` 到 `9`,每种组合中每个数字只能选择一次。 6 | 7 | # 思路分析 8 | 9 | 很典型的回溯法应用了,或者说是 `DFS`。约等于暴力求解,去考虑所有情况,然后依次判断即可。之前也做过很多回溯的题了,这里不细讲了,如果对回溯法不熟悉,大家可以在 [https://leetcode.wang/](https://leetcode.wang/) 左上角搜索「回溯」,多做一些题就有感觉了。 10 | 11 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/216_2.jpg) 12 | 13 | # 解法一 回溯法 14 | 15 | 回溯法完全可以看做一个模版,整体框架就是一个大的 for 循环,然后先 add,接着利用递归进行遍历,然后再 remove ,继续循环。 16 | 17 | ```java 18 | public List> combinationSum3(int k, int n) { 19 | List> res = new ArrayList<>(); 20 | getAnswer(res, new ArrayList<>(), k, n, 1); 21 | return res; 22 | } 23 | 24 | private void getAnswer(List> res, ArrayList temp, int k, int n, int start) { 25 | if (temp.size() == k) { 26 | if (n == 0) { 27 | res.add(new ArrayList<>(temp)); 28 | } 29 | return; 30 | } 31 | for (int i = start; i < 10; i++) { 32 | temp.add(i); 33 | getAnswer(res, temp, k, n - i, i + 1); 34 | temp.remove(temp.size() - 1); 35 | } 36 | } 37 | ``` 38 | 39 | # 总 40 | 41 | 这道题没什么难点,主要就是回溯法的应用。 -------------------------------------------------------------------------------- /leetcode-217-Contains-Duplicate.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/217.jpg) 4 | 5 | 判断是否有重复数字。 6 | 7 | # 思路分析 8 | 9 | 这种题目直接就想到利用 `HashMap` 或者 `HashSet`,将数字依次存入其中。这样做的好处就是,判断新加入的数字是否已经存在,时间复杂度可以是 `O(1)`。 10 | 11 | [官方题解](https://leetcode.com/problems/contains-duplicate/solution/) 也介绍了另外两种解法,就不细讲了。 12 | 13 | 一种是纯暴力方法,两层 `for` 循环,两两判断即可。 14 | 15 | 一种是先将原数组排序,然后判断是否有前后两个数字相同即可。 16 | 17 | # 解法一 18 | 19 | 这里只给出利用 `HashSet` 的方法了,空间换时间,比较常用。 20 | 21 | ```java 22 | public boolean containsDuplicate(int[] nums) { 23 | HashSet set = new HashSet<>(); 24 | for (int i = 0; i < nums.length; i++) { 25 | if (set.contains(nums[i])) { 26 | return true; 27 | } 28 | set.add(nums[i]); 29 | } 30 | return false; 31 | } 32 | ``` 33 | 34 | # 总 35 | 36 | 一道比较简单的题目,利用 `HashMap` 可以判重以及计数,比如 [30 题](https://leetcode.wang/leetCode-30-Substring-with-Concatenation-of-All-Words.html)、[49 题](https://leetcode.wang/leetCode-49-Group-Anagrams.html)、[136 题](https://leetcode.wang/leetcode-136-Single-Number.html)、[137 题](https://leetcode.wang/leetcode-137-Single-NumberII.html)。 -------------------------------------------------------------------------------- /leetcode-237-Delete-Node-in-a-Linked-List.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/237.png) 4 | 5 | 删除链表的某个节点。 6 | 7 | # 解法一 8 | 9 | 然后我以为就是一个简单的链表删除节点的题,但看到给的函数懵逼了。 10 | 11 | ```java 12 | public void deleteNode(ListNode node) { 13 | 14 | } 15 | ``` 16 | 17 | ???头结点呢?没有头结点怎么删除,函数给错了吧。 18 | 19 | 然后看了 [solution](https://leetcode.com/problems/delete-node-in-a-linked-list/solution/)。 20 | 21 | ```java 22 | public void deleteNode(ListNode node) { 23 | node.val = node.next.val; 24 | node.next = node.next.next; 25 | } 26 | ``` 27 | 28 | 好吧,我佛了,感觉感情受到了欺骗,这算什么删除节点... 29 | 30 | # 总 31 | 32 | 感觉很无聊的一道题,没有什么意义,可以看一下 [203 题](https://leetcode.wang/leetcode-203-Remove-Linked-List-Elements.html),纯正的删除节点的题目。 33 | 34 | -------------------------------------------------------------------------------- /leetcode-257-Binary-Tree-Paths.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/257.jpg) 4 | 5 | 输出从根到叶子节点的所有路径。 6 | 7 | # 思路分析 8 | 9 | 很明显是一个二叉树遍历的问题,我们可以用递归形式的 `DFS` ,使用栈形式的 `DFS`,使用队列形式的 `BFS`。 10 | 11 | 和 [112 题](https://leetcode.wang/leetcode-112-Path-Sum.html) 差不多,这里就不详细说了。 12 | 13 | 只给出 `DFS` 递归的代码了,其他代码的话可以参考 [这里](https://leetcode.com/problems/binary-tree-paths/discuss/68278/My-Java-solution-in-DFS-BFS-recursion)。 14 | 15 | # 解法一 DFS 16 | 17 | 用 `result` 保存所有解,到达叶子节点的时候就将结果保存起来。 18 | 19 | ```java 20 | public List binaryTreePaths(TreeNode root) { 21 | List result = new ArrayList<>(); 22 | if(root == null){ 23 | return result; 24 | } 25 | binaryTreePaths(root, "", result); 26 | return result; 27 | } 28 | 29 | private void binaryTreePaths(TreeNode root, String temp, List result) { 30 | if (root.left == null && root.right == null) { 31 | temp = temp + root.val; 32 | result.add(temp); 33 | return; 34 | } 35 | if (root.left != null) { 36 | binaryTreePaths(root.left, temp + root.val + "->", result); 37 | } 38 | if (root.right != null) { 39 | binaryTreePaths(root.right, temp + root.val + "->", result); 40 | } 41 | } 42 | ``` 43 | 44 | # 总 45 | 46 | 考察的就是二叉树的遍历,很基础的一道题。 -------------------------------------------------------------------------------- /leetcode-263-Ugly-Number.md: -------------------------------------------------------------------------------- 1 | # 题目描述(简单难度) 2 | 3 | ![](https://windliang.oss-cn-beijing.aliyuncs.com/263.png) 4 | 5 | 判断是否是丑数,丑数的质数因子中仅含有 `2, 3, 5`。 6 | 7 | # 解法一 8 | 9 | 可以用递归的思想去写,判断能否被 `2, 3, 5` 整除,如果能整除的话,就去递归。 10 | 11 | ```java 12 | public boolean isUgly(int num) { 13 | if (num <= 0) { 14 | return false; 15 | } 16 | if (num % 2 == 0) { 17 | return isUgly(num / 2); 18 | } 19 | 20 | if (num % 3 == 0) { 21 | return isUgly(num / 3); 22 | } 23 | 24 | if (num % 5 == 0) { 25 | return isUgly(num / 5); 26 | } 27 | 28 | return num == 1; 29 | } 30 | ``` 31 | 32 | 还可以直接用 `while` 循环,分享 [这里](https://leetcode.com/problems/ugly-number/discuss/69342/Simplest-java-solution) 的解法。 33 | 34 | ```java 35 | public boolean isUgly(int num) { 36 | if (num <= 0) return false; 37 | while (num % 2 == 0) num /= 2; 38 | while (num % 3 == 0) num /= 3; 39 | while (num % 5 == 0) num /= 5; 40 | return num == 1; 41 | } 42 | ``` 43 | 44 | # 总 45 | 46 | emm,很简单的一道题。 -------------------------------------------------------------------------------- /leetcode-301-400.md: -------------------------------------------------------------------------------- 1 | 感谢关注!可以在左边菜单栏选择要查看的题目。 -------------------------------------------------------------------------------- /more.md: -------------------------------------------------------------------------------- 1 | # 持续更新中 2 | 3 | 为什么刷题:https://leetcode.wang/leetcode100%E6%96%A9%E5%9B%9E%E9%A1%BE.html 4 | 5 | 知乎开设了专栏,同步更新:[https://zhuanlan.zhihu.com/leetcode1024](https://zhuanlan.zhihu.com/leetcode1024),关注后可以及时收到更新,网站有时候可能出问题打不开,建议关注一下知乎专栏备用。 6 | 7 | 准备刷一道,总结一道,目前事情比较多,更新频率会低一些,感谢支持。 8 | 9 | 300 题以后的打算,参考 leetcode 力扣刷题 1 到 300 的感受。 10 | 11 | 可以加好友一起交流 12 | 13 | 微信: 17771420231 14 | 15 | 公众号: windliang,更新编程相关 -------------------------------------------------------------------------------- /node_modules/.bin/katex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | "$basedir/node" "$basedir/../katex/cli.js" "$@" 10 | ret=$? 11 | else 12 | node "$basedir/../katex/cli.js" "$@" 13 | ret=$? 14 | fi 15 | exit $ret 16 | -------------------------------------------------------------------------------- /node_modules/.bin/katex.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\..\katex\cli.js" %* 3 | ) ELSE ( 4 | @SETLOCAL 5 | @SET PATHEXT=%PATHEXT:;.JS;=;% 6 | node "%~dp0\..\katex\cli.js" %* 7 | ) -------------------------------------------------------------------------------- /node_modules/boolbase/README.md: -------------------------------------------------------------------------------- 1 | #boolbase 2 | This very simple module provides two basic functions, one that always returns true (`trueFunc`) and one that always returns false (`falseFunc`). 3 | 4 | ###WTF? 5 | 6 | By having only a single instance of these functions around, it's possible to do some nice optimizations. Eg. [`CSSselect`](https://github.com/fb55/CSSselect) uses these functions to determine whether a selector won't match any elements. If that's the case, the DOM doesn't even have to be touched. 7 | 8 | ###And why is this a separate module? 9 | 10 | I'm trying to modularize `CSSselect` and most modules depend on these functions. IMHO, having a separate module is the easiest solution to this problem. -------------------------------------------------------------------------------- /node_modules/boolbase/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | trueFunc: function trueFunc(){ 3 | return true; 4 | }, 5 | falseFunc: function falseFunc(){ 6 | return false; 7 | } 8 | }; -------------------------------------------------------------------------------- /node_modules/cheerio/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Export cheerio (with ) 3 | */ 4 | 5 | exports = module.exports = require('./lib/cheerio'); 6 | 7 | /* 8 | Export the version 9 | */ 10 | 11 | exports.version = require('./package.json').version; 12 | -------------------------------------------------------------------------------- /node_modules/colors/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Original Library 4 | - Copyright (c) Marak Squires 5 | 6 | Additional Functionality 7 | - Copyright (c) Sindre Sorhus (sindresorhus.com) 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /node_modules/colors/lib/index.js: -------------------------------------------------------------------------------- 1 | var colors = require('./colors'); 2 | module['exports'] = colors; 3 | 4 | // Remark: By default, colors will add style properties to String.prototype. 5 | // 6 | // If you don't wish to extend String.prototype, you can do this instead and 7 | // native String will not be touched: 8 | // 9 | // var colors = require('colors/safe); 10 | // colors.red("foo") 11 | // 12 | // 13 | require('./extendStringPrototype')(); 14 | -------------------------------------------------------------------------------- /node_modules/colors/lib/maps/america.js: -------------------------------------------------------------------------------- 1 | module['exports'] = function(colors) { 2 | return function(letter, i, exploded) { 3 | if (letter === ' ') return letter; 4 | switch (i%3) { 5 | case 0: return colors.red(letter); 6 | case 1: return colors.white(letter); 7 | case 2: return colors.blue(letter); 8 | } 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/colors/lib/maps/rainbow.js: -------------------------------------------------------------------------------- 1 | module['exports'] = function(colors) { 2 | // RoY G BiV 3 | var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; 4 | return function(letter, i, exploded) { 5 | if (letter === ' ') { 6 | return letter; 7 | } else { 8 | return colors[rainbowColors[i++ % rainbowColors.length]](letter); 9 | } 10 | }; 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /node_modules/colors/lib/maps/random.js: -------------------------------------------------------------------------------- 1 | module['exports'] = function(colors) { 2 | var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 3 | 'blue', 'white', 'cyan', 'magenta']; 4 | return function(letter, i, exploded) { 5 | return letter === ' ' ? letter : 6 | colors[ 7 | available[Math.round(Math.random() * (available.length - 2))] 8 | ](letter); 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/colors/lib/maps/zebra.js: -------------------------------------------------------------------------------- 1 | module['exports'] = function(colors) { 2 | return function(letter, i, exploded) { 3 | return i % 2 === 0 ? letter : colors.inverse(letter); 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/colors/safe.js: -------------------------------------------------------------------------------- 1 | // 2 | // Remark: Requiring this file will use the "safe" colors API, 3 | // which will not touch String.prototype. 4 | // 5 | // var colors = require('colors/safe'); 6 | // colors.red("foo") 7 | // 8 | // 9 | var colors = require('./lib/colors'); 10 | module['exports'] = colors; 11 | -------------------------------------------------------------------------------- /node_modules/colors/themes/generic-logging.js: -------------------------------------------------------------------------------- 1 | module['exports'] = { 2 | silly: 'rainbow', 3 | input: 'grey', 4 | verbose: 'cyan', 5 | prompt: 'grey', 6 | info: 'green', 7 | data: 'grey', 8 | help: 'cyan', 9 | warn: 'yellow', 10 | debug: 'blue', 11 | error: 'red', 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/core-util-is/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Node.js contributors. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/core-util-is/README.md: -------------------------------------------------------------------------------- 1 | # core-util-is 2 | 3 | The `util.is*` functions introduced in Node v0.12. 4 | -------------------------------------------------------------------------------- /node_modules/css-select/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Felix Böhm 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, 11 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /node_modules/css-select/lib/procedure.json: -------------------------------------------------------------------------------- 1 | { 2 | "universal": 50, 3 | "tag": 30, 4 | "attribute": 1, 5 | "pseudo": 0, 6 | "descendant": -1, 7 | "child": -1, 8 | "parent": -1, 9 | "sibling": -1, 10 | "adjacent": -1 11 | } 12 | -------------------------------------------------------------------------------- /node_modules/css-what/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Felix Böhm 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, 11 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /node_modules/dom-serializer/LICENSE: -------------------------------------------------------------------------------- 1 | License 2 | 3 | (The MIT License) 4 | 5 | Copyright (c) 2014 The cheeriojs contributors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /node_modules/dom-serializer/node_modules/domelementtype/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Felix Böhm 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, 11 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /node_modules/dom-serializer/node_modules/domelementtype/index.js: -------------------------------------------------------------------------------- 1 | //Types of elements found in the DOM 2 | module.exports = { 3 | Text: "text", //Text 4 | Directive: "directive", // 5 | Comment: "comment", // 6 | Script: "script", //", 5 | "expected": [ 6 | { 7 | "type": "tag", 8 | "name": "head", 9 | "attribs": {}, 10 | "children": [ 11 | { 12 | "type": "script", 13 | "name": "script", 14 | "attribs": { 15 | "language": "Javascript" 16 | }, 17 | "children": [ 18 | { 19 | "data": "var foo = \"\"; alert(2 > foo); var baz = 10 << 2; var zip = 10 >> 1; var yap = \"<<>>>><<\";", 20 | "type": "text" 21 | } 22 | ] 23 | } 24 | ] 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/05-tags_in_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Special char in comment", 3 | "options": {}, 4 | "html": "", 5 | "expected": [ 6 | { 7 | "type": "tag", 8 | "name": "head", 9 | "attribs": {}, 10 | "children": [ 11 | { 12 | "data": " commented out tags Test", 13 | "type": "comment" 14 | } 15 | ] 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/06-comment_in_script.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Script source in comment", 3 | "options": {}, 4 | "html": "", 5 | "expected": [ 6 | { 7 | "type": "script", 8 | "name": "script", 9 | "attribs": {}, 10 | "children": [ 11 | { 12 | "data": "", 13 | "type": "text" 14 | } 15 | ] 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/07-unescaped_in_style.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unescaped chars in style", 3 | "options": {}, 4 | "html": "", 5 | "expected": [ 6 | { 7 | "type": "style", 8 | "name": "style", 9 | "attribs": { 10 | "type": "text/css" 11 | }, 12 | "children": [ 13 | { 14 | "data": "\n body > p\n\t{ font-weight: bold; }", 15 | "type": "text" 16 | } 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Extra spaces in tag", 3 | "options": {}, 4 | "html": "the text", 5 | "expected": [ 6 | { 7 | "type": "tag", 8 | "name": "font", 9 | "attribs": { 10 | "size": "14" 11 | }, 12 | "children": [ 13 | { 14 | "data": "the text", 15 | "type": "text" 16 | } 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/09-unquoted_attrib.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unquoted attributes", 3 | "options": {}, 4 | "html": "the text", 5 | "expected": [ 6 | { 7 | "type": "tag", 8 | "name": "font", 9 | "attribs": { 10 | "size": "14" 11 | }, 12 | "children": [ 13 | { 14 | "data": "the text", 15 | "type": "text" 16 | } 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /node_modules/domhandler/test/cases/10-singular_attribute.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Singular attribute", 3 | "options": {}, 4 | "html": "