diff --git a/.gitignore b/.gitignore
index 2890113a..b4a52775 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,3 @@
-/target/
-!.mvn/wrapper/maven-wrapper.jar
-/logs
-.svn
-
-### IntelliJ IDEA ###
-.idea
-*.iws
+.idea/
+target/
*.iml
-*.ipr
-/out/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..8dada3ed
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
index bce1ee49..e9df21cd 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,18 @@
-# 1. Java基础
-
-
-
-# 2. 设计模式
-
-[设计模式](https://github.com/ggb2312/JavaNotes/tree/master/design-pattern)
-
-
-
-# 3. springboot-integration-examples
-
-[springboot-integration-examples](https://github.com/ggb2312/JavaNotes/tree/master/springboot-integration-examples)
-
-基于最新的 SpringBoot2.0+
-
-## 3.1 Idea新建一个SpringBoot项目
-
- [Idea新建一个SpringBoot项目](https://www.cnblogs.com/gj-blog/p/10803591.html)
-
-## 3.2 springboot-oss(SpringBoot整合阿里云OSS文件上传、下载、查看、删除)
-
- [SpringBoot整合阿里云OSS文件上传、下载、查看、删除](https://www.cnblogs.com/gj-blog/p/10789544.html)
-
-## 3.3 springboot-aoplog(SpringBoot整合aop日志管理)
-
- [SpringBoot整合aop日志管理](https://www.cnblogs.com/gj-blog/p/10803600.html)
-
-## 3.4 springboot-wx(SpringBoot整合微信小程序登录)
-
- [SpringBoot整合微信小程序登录](https://www.cnblogs.com/gj-blog/p/10803607.html)
-
-## 3.5 springboot-mybatisplus(SpringBoot整合MybatisPlus)
-
-[SpringBoot整合MybatisPlus](https://www.cnblogs.com/gj-blog/p/10803593.html)
+```
+├─algorithms 算法
+├─database 数据库
+├─distributed 分布式系统
+├─framework 一些常用类库
+├─java-advance 高级类库和jsr规范等
+├─java-basic Java基础
+├─lesson-code 一些课程代码
+├─mvc mvc框架
+├─orm orm框架
+├─spring-annotation spring注解驱动开发
+├─spring-batch
+├─springboot-aop springaop使用以及aop应用
+│
+└─
+
+```
diff --git a/algorithms/README.MD b/algorithms/README.MD
new file mode 100644
index 00000000..23e4b53e
--- /dev/null
+++ b/algorithms/README.MD
@@ -0,0 +1,55 @@
+
+
+```
+├─algorithm
+│
+├─datastructure 数据结构与常见算法
+│ │
+│ ├─graph 图
+│ │
+│ ├─hashtab 哈希表
+│ │
+│ ├─linkedlist 链表
+│ │
+│ ├─queue 队列
+│ │
+│ ├─recursion 递归
+│ │
+│ ├─search 搜索
+│ │
+│ ├─sort 排序
+│ │
+│ ├─sparsematrix 矩阵
+│ │
+│ ├─stack 栈
+│ │
+│ └─tree 树
+│
+├─leetcode leetcode对应数据结构刷题代码
+│ │
+│ ├─array 数组
+│ │
+│ ├─linkedlist 链表
+│ │
+│ ├─hashtable 哈希表
+│ │
+│ ├─stackqueue 栈与队列
+│ │
+│ ├─recurionbacktracking 递归与回溯
+│ │
+│ ├─binarytree 二叉树
+│ │
+│ ├─dynamic 动态规划
+│ │
+│ ├─greedy 贪心
+│ │
+│ └─other 其他
+│
+├─offer
+│
+├─thread
+│
+└─interview
+```
+
+
diff --git "a/algorithms/TempFilePath/leetcode/editor/cn/[4]\345\257\273\346\211\276\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\344\270\255\344\275\215\346\225\260.java" "b/algorithms/TempFilePath/leetcode/editor/cn/[4]\345\257\273\346\211\276\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\344\270\255\344\275\215\346\225\260.java"
deleted file mode 100644
index a614bb36..00000000
--- "a/algorithms/TempFilePath/leetcode/editor/cn/[4]\345\257\273\346\211\276\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\344\270\255\344\275\215\346\225\260.java"
+++ /dev/null
@@ -1,32 +0,0 @@
-//给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。
-//
-// 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。
-//
-// 你可以假设 nums1 和 nums2 不会同时为空。
-//
-// 示例 1:
-//
-// nums1 = [1, 3]
-//nums2 = [2]
-//
-//则中位数是 2.0
-//
-//
-// 示例 2:
-//
-// nums1 = [1, 2]
-//nums2 = [3, 4]
-//
-//则中位数是 (2 + 3)/2 = 2.5
-//
-// Related Topics 数组 二分查找 分治算法
-
-
-
-//leetcode submit region begin(Prohibit modification and deletion)
-class Solution {
- public double findMedianSortedArrays(int[] nums1, int[] nums2) {
-
- }
-}
-//leetcode submit region end(Prohibit modification and deletion)
diff --git "a/algorithms/TempFilePath/leetcode/editor/cn/[]\345\217\252\345\207\272\347\216\260\344\270\200\346\254\241\347\232\204\346\225\260\345\255\227.java" "b/algorithms/TempFilePath/leetcode/editor/cn/[]\345\217\252\345\207\272\347\216\260\344\270\200\346\254\241\347\232\204\346\225\260\345\255\227.java"
deleted file mode 100644
index 49cb8971..00000000
--- "a/algorithms/TempFilePath/leetcode/editor/cn/[]\345\217\252\345\207\272\347\216\260\344\270\200\346\254\241\347\232\204\346\225\260\345\255\227.java"
+++ /dev/null
@@ -1,27 +0,0 @@
-//给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
-//
-// 说明:
-//
-// 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?
-//
-// 示例 1:
-//
-// 输入: [2,2,1]
-//输出: 1
-//
-//
-// 示例 2:
-//
-// 输入: [4,1,2,1,2]
-//输出: 4
-// Related Topics 位运算 哈希表
-
-
-
-//leetcode submit region begin(Prohibit modification and deletion)
-class Solution {
- public int singleNumber(int[] nums) {
-
- }
-}
-//leetcode submit region end(Prohibit modification and deletion)
diff --git a/algorithms/TempFilePath/leetcode/editor/cn/all.json b/algorithms/TempFilePath/leetcode/editor/cn/all.json
deleted file mode 100644
index 88e36f0f..00000000
--- a/algorithms/TempFilePath/leetcode/editor/cn/all.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"formTitle":"[1]两数之和","frontendQuestionId":"1","leaf":true,"level":1,"nodeType":"def","questionId":"1","status":"ac","title":"两数之和","titleSlug":"two-sum"},{"formTitle":"[2]两数相加","frontendQuestionId":"2","leaf":true,"level":2,"nodeType":"def","questionId":"2","status":"","title":"两数相加","titleSlug":"add-two-numbers"},{"formTitle":"[3]无重复字符的最长子串","frontendQuestionId":"3","leaf":true,"level":2,"nodeType":"def","questionId":"3","status":"ac","title":"无重复字符的最长子串","titleSlug":"longest-substring-without-repeating-characters"},{"formTitle":"[4]寻找两个有序数组的中位数","frontendQuestionId":"4","leaf":true,"level":3,"nodeType":"def","questionId":"4","status":"","title":"寻找两个有序数组的中位数","titleSlug":"median-of-two-sorted-arrays"},{"formTitle":"[5]最长回文子串","frontendQuestionId":"5","leaf":true,"level":2,"nodeType":"def","questionId":"5","status":"","title":"最长回文子串","titleSlug":"longest-palindromic-substring"},{"formTitle":"[6]Z 字形变换","frontendQuestionId":"6","leaf":true,"level":2,"nodeType":"def","questionId":"6","status":"","title":"Z 字形变换","titleSlug":"zigzag-conversion"},{"formTitle":"[7]整数反转","frontendQuestionId":"7","leaf":true,"level":1,"nodeType":"def","questionId":"7","status":"notac","title":"整数反转","titleSlug":"reverse-integer"},{"formTitle":"[8]字符串转换整数 (atoi)","frontendQuestionId":"8","leaf":true,"level":2,"nodeType":"def","questionId":"8","status":"","title":"字符串转换整数 (atoi)","titleSlug":"string-to-integer-atoi"},{"formTitle":"[9]回文数","frontendQuestionId":"9","leaf":true,"level":1,"nodeType":"def","questionId":"9","status":"","title":"回文数","titleSlug":"palindrome-number"},{"formTitle":"[10]正则表达式匹配","frontendQuestionId":"10","leaf":true,"level":3,"nodeType":"def","questionId":"10","status":"","title":"正则表达式匹配","titleSlug":"regular-expression-matching"},{"formTitle":"[11]盛最多水的容器","frontendQuestionId":"11","leaf":true,"level":2,"nodeType":"def","questionId":"11","status":"ac","title":"盛最多水的容器","titleSlug":"container-with-most-water"},{"formTitle":"[12]整数转罗马数字","frontendQuestionId":"12","leaf":true,"level":2,"nodeType":"def","questionId":"12","status":"","title":"整数转罗马数字","titleSlug":"integer-to-roman"},{"formTitle":"[13]罗马数字转整数","frontendQuestionId":"13","leaf":true,"level":1,"nodeType":"def","questionId":"13","status":"","title":"罗马数字转整数","titleSlug":"roman-to-integer"},{"formTitle":"[14]最长公共前缀","frontendQuestionId":"14","leaf":true,"level":1,"nodeType":"def","questionId":"14","status":"","title":"最长公共前缀","titleSlug":"longest-common-prefix"},{"formTitle":"[15]三数之和","frontendQuestionId":"15","leaf":true,"level":2,"nodeType":"def","questionId":"15","status":"","title":"三数之和","titleSlug":"3sum"},{"formTitle":"[16]最接近的三数之和","frontendQuestionId":"16","leaf":true,"level":2,"nodeType":"def","questionId":"16","status":"","title":"最接近的三数之和","titleSlug":"3sum-closest"},{"formTitle":"[17]电话号码的字母组合","frontendQuestionId":"17","leaf":true,"level":2,"nodeType":"def","questionId":"17","status":"","title":"电话号码的字母组合","titleSlug":"letter-combinations-of-a-phone-number"},{"formTitle":"[18]四数之和","frontendQuestionId":"18","leaf":true,"level":2,"nodeType":"def","questionId":"18","status":"","title":"四数之和","titleSlug":"4sum"},{"formTitle":"[19]删除链表的倒数第N个节点","frontendQuestionId":"19","leaf":true,"level":2,"nodeType":"def","questionId":"19","status":"","title":"删除链表的倒数第N个节点","titleSlug":"remove-nth-node-from-end-of-list"},{"formTitle":"[20]有效的括号","frontendQuestionId":"20","leaf":true,"level":1,"nodeType":"def","questionId":"20","status":"","title":"有效的括号","titleSlug":"valid-parentheses"},{"formTitle":"[21]合并两个有序链表","frontendQuestionId":"21","leaf":true,"level":1,"nodeType":"def","questionId":"21","status":"","title":"合并两个有序链表","titleSlug":"merge-two-sorted-lists"},{"formTitle":"[22]括号生成","frontendQuestionId":"22","leaf":true,"level":2,"nodeType":"def","questionId":"22","status":"","title":"括号生成","titleSlug":"generate-parentheses"},{"formTitle":"[23]合并K个排序链表","frontendQuestionId":"23","leaf":true,"level":3,"nodeType":"def","questionId":"23","status":"","title":"合并K个排序链表","titleSlug":"merge-k-sorted-lists"},{"formTitle":"[24]两两交换链表中的节点","frontendQuestionId":"24","leaf":true,"level":2,"nodeType":"def","questionId":"24","status":"","title":"两两交换链表中的节点","titleSlug":"swap-nodes-in-pairs"},{"formTitle":"[25]K 个一组翻转链表","frontendQuestionId":"25","leaf":true,"level":3,"nodeType":"def","questionId":"25","status":"","title":"K 个一组翻转链表","titleSlug":"reverse-nodes-in-k-group"},{"formTitle":"[26]删除排序数组中的重复项","frontendQuestionId":"26","leaf":true,"level":1,"nodeType":"def","questionId":"26","status":"ac","title":"删除排序数组中的重复项","titleSlug":"remove-duplicates-from-sorted-array"},{"formTitle":"[27]移除元素","frontendQuestionId":"27","leaf":true,"level":1,"nodeType":"def","questionId":"27","status":"ac","title":"移除元素","titleSlug":"remove-element"},{"formTitle":"[28]实现 strStr()","frontendQuestionId":"28","leaf":true,"level":1,"nodeType":"def","questionId":"28","status":"","title":"实现 strStr()","titleSlug":"implement-strstr"},{"formTitle":"[29]两数相除","frontendQuestionId":"29","leaf":true,"level":2,"nodeType":"def","questionId":"29","status":"","title":"两数相除","titleSlug":"divide-two-integers"},{"formTitle":"[30]串联所有单词的子串","frontendQuestionId":"30","leaf":true,"level":3,"nodeType":"def","questionId":"30","status":"","title":"串联所有单词的子串","titleSlug":"substring-with-concatenation-of-all-words"},{"formTitle":"[31]下一个排列","frontendQuestionId":"31","leaf":true,"level":2,"nodeType":"def","questionId":"31","status":"","title":"下一个排列","titleSlug":"next-permutation"},{"formTitle":"[32]最长有效括号","frontendQuestionId":"32","leaf":true,"level":3,"nodeType":"def","questionId":"32","status":"","title":"最长有效括号","titleSlug":"longest-valid-parentheses"},{"formTitle":"[33]搜索旋转排序数组","frontendQuestionId":"33","leaf":true,"level":2,"nodeType":"def","questionId":"33","status":"","title":"搜索旋转排序数组","titleSlug":"search-in-rotated-sorted-array"},{"formTitle":"[34]在排序数组中查找元素的第一个和最后一个位置","frontendQuestionId":"34","leaf":true,"level":2,"nodeType":"def","questionId":"34","status":"","title":"在排序数组中查找元素的第一个和最后一个位置","titleSlug":"find-first-and-last-position-of-element-in-sorted-array"},{"formTitle":"[35]搜索插入位置","frontendQuestionId":"35","leaf":true,"level":1,"nodeType":"def","questionId":"35","status":"","title":"搜索插入位置","titleSlug":"search-insert-position"},{"formTitle":"[36]有效的数独","frontendQuestionId":"36","leaf":true,"level":2,"nodeType":"def","questionId":"36","status":"","title":"有效的数独","titleSlug":"valid-sudoku"},{"formTitle":"[37]解数独","frontendQuestionId":"37","leaf":true,"level":3,"nodeType":"def","questionId":"37","status":"","title":"解数独","titleSlug":"sudoku-solver"},{"formTitle":"[38]报数","frontendQuestionId":"38","leaf":true,"level":1,"nodeType":"def","questionId":"38","status":"","title":"报数","titleSlug":"count-and-say"},{"formTitle":"[39]组合总和","frontendQuestionId":"39","leaf":true,"level":2,"nodeType":"def","questionId":"39","status":"","title":"组合总和","titleSlug":"combination-sum"},{"formTitle":"[40]组合总和 II","frontendQuestionId":"40","leaf":true,"level":2,"nodeType":"def","questionId":"40","status":"","title":"组合总和 II","titleSlug":"combination-sum-ii"},{"formTitle":"[41]缺失的第一个正数","frontendQuestionId":"41","leaf":true,"level":3,"nodeType":"def","questionId":"41","status":"","title":"缺失的第一个正数","titleSlug":"first-missing-positive"},{"formTitle":"[42]接雨水","frontendQuestionId":"42","leaf":true,"level":3,"nodeType":"def","questionId":"42","status":"","title":"接雨水","titleSlug":"trapping-rain-water"},{"formTitle":"[43]字符串相乘","frontendQuestionId":"43","leaf":true,"level":2,"nodeType":"def","questionId":"43","status":"","title":"字符串相乘","titleSlug":"multiply-strings"},{"formTitle":"[44]通配符匹配","frontendQuestionId":"44","leaf":true,"level":3,"nodeType":"def","questionId":"44","status":"","title":"通配符匹配","titleSlug":"wildcard-matching"},{"formTitle":"[45]跳跃游戏 II","frontendQuestionId":"45","leaf":true,"level":3,"nodeType":"def","questionId":"45","status":"","title":"跳跃游戏 II","titleSlug":"jump-game-ii"},{"formTitle":"[46]全排列","frontendQuestionId":"46","leaf":true,"level":2,"nodeType":"def","questionId":"46","status":"","title":"全排列","titleSlug":"permutations"},{"formTitle":"[47]全排列 II","frontendQuestionId":"47","leaf":true,"level":2,"nodeType":"def","questionId":"47","status":"","title":"全排列 II","titleSlug":"permutations-ii"},{"formTitle":"[48]旋转图像","frontendQuestionId":"48","leaf":true,"level":2,"nodeType":"def","questionId":"48","status":"","title":"旋转图像","titleSlug":"rotate-image"},{"formTitle":"[49]字母异位词分组","frontendQuestionId":"49","leaf":true,"level":2,"nodeType":"def","questionId":"49","status":"","title":"字母异位词分组","titleSlug":"group-anagrams"},{"formTitle":"[50]Pow(x, n)","frontendQuestionId":"50","leaf":true,"level":2,"nodeType":"def","questionId":"50","status":"","title":"Pow(x, n)","titleSlug":"powx-n"},{"formTitle":"[51]N皇后","frontendQuestionId":"51","leaf":true,"level":3,"nodeType":"def","questionId":"51","status":"","title":"N皇后","titleSlug":"n-queens"},{"formTitle":"[52]N皇后 II","frontendQuestionId":"52","leaf":true,"level":3,"nodeType":"def","questionId":"52","status":"","title":"N皇后 II","titleSlug":"n-queens-ii"},{"formTitle":"[53]最大子序和","frontendQuestionId":"53","leaf":true,"level":1,"nodeType":"def","questionId":"53","status":"","title":"最大子序和","titleSlug":"maximum-subarray"},{"formTitle":"[54]螺旋矩阵","frontendQuestionId":"54","leaf":true,"level":2,"nodeType":"def","questionId":"54","status":"","title":"螺旋矩阵","titleSlug":"spiral-matrix"},{"formTitle":"[55]跳跃游戏","frontendQuestionId":"55","leaf":true,"level":2,"nodeType":"def","questionId":"55","status":"","title":"跳跃游戏","titleSlug":"jump-game"},{"formTitle":"[56]合并区间","frontendQuestionId":"56","leaf":true,"level":2,"nodeType":"def","questionId":"56","status":"","title":"合并区间","titleSlug":"merge-intervals"},{"formTitle":"[57]插入区间","frontendQuestionId":"57","leaf":true,"level":3,"nodeType":"def","questionId":"57","status":"","title":"插入区间","titleSlug":"insert-interval"},{"formTitle":"[58]最后一个单词的长度","frontendQuestionId":"58","leaf":true,"level":1,"nodeType":"def","questionId":"58","status":"","title":"最后一个单词的长度","titleSlug":"length-of-last-word"},{"formTitle":"[59]螺旋矩阵 II","frontendQuestionId":"59","leaf":true,"level":2,"nodeType":"def","questionId":"59","status":"","title":"螺旋矩阵 II","titleSlug":"spiral-matrix-ii"},{"formTitle":"[60]第k个排列","frontendQuestionId":"60","leaf":true,"level":2,"nodeType":"def","questionId":"60","status":"","title":"第k个排列","titleSlug":"permutation-sequence"},{"formTitle":"[61]旋转链表","frontendQuestionId":"61","leaf":true,"level":2,"nodeType":"def","questionId":"61","status":"","title":"旋转链表","titleSlug":"rotate-list"},{"formTitle":"[62]不同路径","frontendQuestionId":"62","leaf":true,"level":2,"nodeType":"def","questionId":"62","status":"","title":"不同路径","titleSlug":"unique-paths"},{"formTitle":"[63]不同路径 II","frontendQuestionId":"63","leaf":true,"level":2,"nodeType":"def","questionId":"63","status":"","title":"不同路径 II","titleSlug":"unique-paths-ii"},{"formTitle":"[64]最小路径和","frontendQuestionId":"64","leaf":true,"level":2,"nodeType":"def","questionId":"64","status":"","title":"最小路径和","titleSlug":"minimum-path-sum"},{"formTitle":"[65]有效数字","frontendQuestionId":"65","leaf":true,"level":3,"nodeType":"def","questionId":"65","status":"","title":"有效数字","titleSlug":"valid-number"},{"formTitle":"[66]加一","frontendQuestionId":"66","leaf":true,"level":1,"nodeType":"def","questionId":"66","status":"","title":"加一","titleSlug":"plus-one"},{"formTitle":"[67]二进制求和","frontendQuestionId":"67","leaf":true,"level":1,"nodeType":"def","questionId":"67","status":"","title":"二进制求和","titleSlug":"add-binary"},{"formTitle":"[68]文本左右对齐","frontendQuestionId":"68","leaf":true,"level":3,"nodeType":"def","questionId":"68","status":"","title":"文本左右对齐","titleSlug":"text-justification"},{"formTitle":"[69]x 的平方根","frontendQuestionId":"69","leaf":true,"level":1,"nodeType":"def","questionId":"69","status":"","title":"x 的平方根","titleSlug":"sqrtx"},{"formTitle":"[70]爬楼梯","frontendQuestionId":"70","leaf":true,"level":1,"nodeType":"def","questionId":"70","status":"","title":"爬楼梯","titleSlug":"climbing-stairs"},{"formTitle":"[71]简化路径","frontendQuestionId":"71","leaf":true,"level":2,"nodeType":"def","questionId":"71","status":"","title":"简化路径","titleSlug":"simplify-path"},{"formTitle":"[72]编辑距离","frontendQuestionId":"72","leaf":true,"level":3,"nodeType":"def","questionId":"72","status":"","title":"编辑距离","titleSlug":"edit-distance"},{"formTitle":"[73]矩阵置零","frontendQuestionId":"73","leaf":true,"level":2,"nodeType":"def","questionId":"73","status":"","title":"矩阵置零","titleSlug":"set-matrix-zeroes"},{"formTitle":"[74]搜索二维矩阵","frontendQuestionId":"74","leaf":true,"level":2,"nodeType":"def","questionId":"74","status":"","title":"搜索二维矩阵","titleSlug":"search-a-2d-matrix"},{"formTitle":"[75]颜色分类","frontendQuestionId":"75","leaf":true,"level":2,"nodeType":"def","questionId":"75","status":"ac","title":"颜色分类","titleSlug":"sort-colors"},{"formTitle":"[76]最小覆盖子串","frontendQuestionId":"76","leaf":true,"level":3,"nodeType":"def","questionId":"76","status":"ac","title":"最小覆盖子串","titleSlug":"minimum-window-substring"},{"formTitle":"[77]组合","frontendQuestionId":"77","leaf":true,"level":2,"nodeType":"def","questionId":"77","status":"","title":"组合","titleSlug":"combinations"},{"formTitle":"[78]子集","frontendQuestionId":"78","leaf":true,"level":2,"nodeType":"def","questionId":"78","status":"","title":"子集","titleSlug":"subsets"},{"formTitle":"[79]单词搜索","frontendQuestionId":"79","leaf":true,"level":2,"nodeType":"def","questionId":"79","status":"","title":"单词搜索","titleSlug":"word-search"},{"formTitle":"[80]删除排序数组中的重复项 II","frontendQuestionId":"80","leaf":true,"level":2,"nodeType":"def","questionId":"80","status":"","title":"删除排序数组中的重复项 II","titleSlug":"remove-duplicates-from-sorted-array-ii"},{"formTitle":"[81]搜索旋转排序数组 II","frontendQuestionId":"81","leaf":true,"level":2,"nodeType":"def","questionId":"81","status":"","title":"搜索旋转排序数组 II","titleSlug":"search-in-rotated-sorted-array-ii"},{"formTitle":"[82]删除排序链表中的重复元素 II","frontendQuestionId":"82","leaf":true,"level":2,"nodeType":"def","questionId":"82","status":"","title":"删除排序链表中的重复元素 II","titleSlug":"remove-duplicates-from-sorted-list-ii"},{"formTitle":"[83]删除排序链表中的重复元素","frontendQuestionId":"83","leaf":true,"level":1,"nodeType":"def","questionId":"83","status":"","title":"删除排序链表中的重复元素","titleSlug":"remove-duplicates-from-sorted-list"},{"formTitle":"[84]柱状图中最大的矩形","frontendQuestionId":"84","leaf":true,"level":3,"nodeType":"def","questionId":"84","status":"","title":"柱状图中最大的矩形","titleSlug":"largest-rectangle-in-histogram"},{"formTitle":"[85]最大矩形","frontendQuestionId":"85","leaf":true,"level":3,"nodeType":"def","questionId":"85","status":"","title":"最大矩形","titleSlug":"maximal-rectangle"},{"formTitle":"[86]分隔链表","frontendQuestionId":"86","leaf":true,"level":2,"nodeType":"def","questionId":"86","status":"","title":"分隔链表","titleSlug":"partition-list"},{"formTitle":"[87]扰乱字符串","frontendQuestionId":"87","leaf":true,"level":3,"nodeType":"def","questionId":"87","status":"","title":"扰乱字符串","titleSlug":"scramble-string"},{"formTitle":"[88]合并两个有序数组","frontendQuestionId":"88","leaf":true,"level":1,"nodeType":"def","questionId":"88","status":"ac","title":"合并两个有序数组","titleSlug":"merge-sorted-array"},{"formTitle":"[89]格雷编码","frontendQuestionId":"89","leaf":true,"level":2,"nodeType":"def","questionId":"89","status":"","title":"格雷编码","titleSlug":"gray-code"},{"formTitle":"[90]子集 II","frontendQuestionId":"90","leaf":true,"level":2,"nodeType":"def","questionId":"90","status":"","title":"子集 II","titleSlug":"subsets-ii"},{"formTitle":"[91]解码方法","frontendQuestionId":"91","leaf":true,"level":2,"nodeType":"def","questionId":"91","status":"","title":"解码方法","titleSlug":"decode-ways"},{"formTitle":"[92]反转链表 II","frontendQuestionId":"92","leaf":true,"level":2,"nodeType":"def","questionId":"92","status":"","title":"反转链表 II","titleSlug":"reverse-linked-list-ii"},{"formTitle":"[93]复原IP地址","frontendQuestionId":"93","leaf":true,"level":2,"nodeType":"def","questionId":"93","status":"","title":"复原IP地址","titleSlug":"restore-ip-addresses"},{"formTitle":"[94]二叉树的中序遍历","frontendQuestionId":"94","leaf":true,"level":2,"nodeType":"def","questionId":"94","status":"","title":"二叉树的中序遍历","titleSlug":"binary-tree-inorder-traversal"},{"formTitle":"[95]不同的二叉搜索树 II","frontendQuestionId":"95","leaf":true,"level":2,"nodeType":"def","questionId":"95","status":"","title":"不同的二叉搜索树 II","titleSlug":"unique-binary-search-trees-ii"},{"formTitle":"[96]不同的二叉搜索树","frontendQuestionId":"96","leaf":true,"level":2,"nodeType":"def","questionId":"96","status":"","title":"不同的二叉搜索树","titleSlug":"unique-binary-search-trees"},{"formTitle":"[97]交错字符串","frontendQuestionId":"97","leaf":true,"level":3,"nodeType":"def","questionId":"97","status":"","title":"交错字符串","titleSlug":"interleaving-string"},{"formTitle":"[98]验证二叉搜索树","frontendQuestionId":"98","leaf":true,"level":2,"nodeType":"def","questionId":"98","status":"","title":"验证二叉搜索树","titleSlug":"validate-binary-search-tree"},{"formTitle":"[99]恢复二叉搜索树","frontendQuestionId":"99","leaf":true,"level":3,"nodeType":"def","questionId":"99","status":"","title":"恢复二叉搜索树","titleSlug":"recover-binary-search-tree"},{"formTitle":"[100]相同的树","frontendQuestionId":"100","leaf":true,"level":1,"nodeType":"def","questionId":"100","status":"","title":"相同的树","titleSlug":"same-tree"},{"formTitle":"[101]对称二叉树","frontendQuestionId":"101","leaf":true,"level":1,"nodeType":"def","questionId":"101","status":"","title":"对称二叉树","titleSlug":"symmetric-tree"},{"formTitle":"[102]二叉树的层次遍历","frontendQuestionId":"102","leaf":true,"level":2,"nodeType":"def","questionId":"102","status":"","title":"二叉树的层次遍历","titleSlug":"binary-tree-level-order-traversal"},{"formTitle":"[103]二叉树的锯齿形层次遍历","frontendQuestionId":"103","leaf":true,"level":2,"nodeType":"def","questionId":"103","status":"","title":"二叉树的锯齿形层次遍历","titleSlug":"binary-tree-zigzag-level-order-traversal"},{"formTitle":"[104]二叉树的最大深度","frontendQuestionId":"104","leaf":true,"level":1,"nodeType":"def","questionId":"104","status":"","title":"二叉树的最大深度","titleSlug":"maximum-depth-of-binary-tree"},{"formTitle":"[105]从前序与中序遍历序列构造二叉树","frontendQuestionId":"105","leaf":true,"level":2,"nodeType":"def","questionId":"105","status":"","title":"从前序与中序遍历序列构造二叉树","titleSlug":"construct-binary-tree-from-preorder-and-inorder-traversal"},{"formTitle":"[106]从中序与后序遍历序列构造二叉树","frontendQuestionId":"106","leaf":true,"level":2,"nodeType":"def","questionId":"106","status":"","title":"从中序与后序遍历序列构造二叉树","titleSlug":"construct-binary-tree-from-inorder-and-postorder-traversal"},{"formTitle":"[107]二叉树的层次遍历 II","frontendQuestionId":"107","leaf":true,"level":1,"nodeType":"def","questionId":"107","status":"","title":"二叉树的层次遍历 II","titleSlug":"binary-tree-level-order-traversal-ii"},{"formTitle":"[108]将有序数组转换为二叉搜索树","frontendQuestionId":"108","leaf":true,"level":1,"nodeType":"def","questionId":"108","status":"","title":"将有序数组转换为二叉搜索树","titleSlug":"convert-sorted-array-to-binary-search-tree"},{"formTitle":"[109]有序链表转换二叉搜索树","frontendQuestionId":"109","leaf":true,"level":2,"nodeType":"def","questionId":"109","status":"","title":"有序链表转换二叉搜索树","titleSlug":"convert-sorted-list-to-binary-search-tree"},{"formTitle":"[110]平衡二叉树","frontendQuestionId":"110","leaf":true,"level":1,"nodeType":"def","questionId":"110","status":"","title":"平衡二叉树","titleSlug":"balanced-binary-tree"},{"formTitle":"[111]二叉树的最小深度","frontendQuestionId":"111","leaf":true,"level":1,"nodeType":"def","questionId":"111","status":"","title":"二叉树的最小深度","titleSlug":"minimum-depth-of-binary-tree"},{"formTitle":"[112]路径总和","frontendQuestionId":"112","leaf":true,"level":1,"nodeType":"def","questionId":"112","status":"","title":"路径总和","titleSlug":"path-sum"},{"formTitle":"[113]路径总和 II","frontendQuestionId":"113","leaf":true,"level":2,"nodeType":"def","questionId":"113","status":"","title":"路径总和 II","titleSlug":"path-sum-ii"},{"formTitle":"[114]二叉树展开为链表","frontendQuestionId":"114","leaf":true,"level":2,"nodeType":"def","questionId":"114","status":"","title":"二叉树展开为链表","titleSlug":"flatten-binary-tree-to-linked-list"},{"formTitle":"[115]不同的子序列","frontendQuestionId":"115","leaf":true,"level":3,"nodeType":"def","questionId":"115","status":"","title":"不同的子序列","titleSlug":"distinct-subsequences"},{"formTitle":"[116]填充每个节点的下一个右侧节点指针","frontendQuestionId":"116","leaf":true,"level":2,"nodeType":"def","questionId":"116","status":"","title":"填充每个节点的下一个右侧节点指针","titleSlug":"populating-next-right-pointers-in-each-node"},{"formTitle":"[117]填充每个节点的下一个右侧节点指针 II","frontendQuestionId":"117","leaf":true,"level":2,"nodeType":"def","questionId":"117","status":"","title":"填充每个节点的下一个右侧节点指针 II","titleSlug":"populating-next-right-pointers-in-each-node-ii"},{"formTitle":"[118]杨辉三角","frontendQuestionId":"118","leaf":true,"level":1,"nodeType":"def","questionId":"118","status":"","title":"杨辉三角","titleSlug":"pascals-triangle"},{"formTitle":"[119]杨辉三角 II","frontendQuestionId":"119","leaf":true,"level":1,"nodeType":"def","questionId":"119","status":"","title":"杨辉三角 II","titleSlug":"pascals-triangle-ii"},{"formTitle":"[120]三角形最小路径和","frontendQuestionId":"120","leaf":true,"level":2,"nodeType":"def","questionId":"120","status":"","title":"三角形最小路径和","titleSlug":"triangle"},{"formTitle":"[121]买卖股票的最佳时机","frontendQuestionId":"121","leaf":true,"level":1,"nodeType":"def","questionId":"121","status":"","title":"买卖股票的最佳时机","titleSlug":"best-time-to-buy-and-sell-stock"},{"formTitle":"[122]买卖股票的最佳时机 II","frontendQuestionId":"122","leaf":true,"level":1,"nodeType":"def","questionId":"122","status":"","title":"买卖股票的最佳时机 II","titleSlug":"best-time-to-buy-and-sell-stock-ii"},{"formTitle":"[123]买卖股票的最佳时机 III","frontendQuestionId":"123","leaf":true,"level":3,"nodeType":"def","questionId":"123","status":"","title":"买卖股票的最佳时机 III","titleSlug":"best-time-to-buy-and-sell-stock-iii"},{"formTitle":"[124]二叉树中的最大路径和","frontendQuestionId":"124","leaf":true,"level":3,"nodeType":"def","questionId":"124","status":"","title":"二叉树中的最大路径和","titleSlug":"binary-tree-maximum-path-sum"},{"formTitle":"[125]验证回文串","frontendQuestionId":"125","leaf":true,"level":1,"nodeType":"def","questionId":"125","status":"ac","title":"验证回文串","titleSlug":"valid-palindrome"},{"formTitle":"[126]单词接龙 II","frontendQuestionId":"126","leaf":true,"level":3,"nodeType":"def","questionId":"126","status":"","title":"单词接龙 II","titleSlug":"word-ladder-ii"},{"formTitle":"[127]单词接龙","frontendQuestionId":"127","leaf":true,"level":2,"nodeType":"def","questionId":"127","status":"","title":"单词接龙","titleSlug":"word-ladder"},{"formTitle":"[128]最长连续序列","frontendQuestionId":"128","leaf":true,"level":3,"nodeType":"def","questionId":"128","status":"","title":"最长连续序列","titleSlug":"longest-consecutive-sequence"},{"formTitle":"[129]求根到叶子节点数字之和","frontendQuestionId":"129","leaf":true,"level":2,"nodeType":"def","questionId":"129","status":"","title":"求根到叶子节点数字之和","titleSlug":"sum-root-to-leaf-numbers"},{"formTitle":"[130]被围绕的区域","frontendQuestionId":"130","leaf":true,"level":2,"nodeType":"def","questionId":"130","status":"","title":"被围绕的区域","titleSlug":"surrounded-regions"},{"formTitle":"[131]分割回文串","frontendQuestionId":"131","leaf":true,"level":2,"nodeType":"def","questionId":"131","status":"","title":"分割回文串","titleSlug":"palindrome-partitioning"},{"formTitle":"[132]分割回文串 II","frontendQuestionId":"132","leaf":true,"level":3,"nodeType":"def","questionId":"132","status":"","title":"分割回文串 II","titleSlug":"palindrome-partitioning-ii"},{"formTitle":"[133]克隆图","frontendQuestionId":"133","leaf":true,"level":2,"nodeType":"def","questionId":"133","status":"","title":"克隆图","titleSlug":"clone-graph"},{"formTitle":"[134]加油站","frontendQuestionId":"134","leaf":true,"level":2,"nodeType":"def","questionId":"134","status":"","title":"加油站","titleSlug":"gas-station"},{"formTitle":"[135]分发糖果","frontendQuestionId":"135","leaf":true,"level":3,"nodeType":"def","questionId":"135","status":"","title":"分发糖果","titleSlug":"candy"},{"formTitle":"[136]只出现一次的数字","frontendQuestionId":"136","leaf":true,"level":1,"nodeType":"def","questionId":"136","status":"","title":"只出现一次的数字","titleSlug":"single-number"},{"formTitle":"[137]只出现一次的数字 II","frontendQuestionId":"137","leaf":true,"level":2,"nodeType":"def","questionId":"137","status":"","title":"只出现一次的数字 II","titleSlug":"single-number-ii"},{"formTitle":"[138]复制带随机指针的链表","frontendQuestionId":"138","leaf":true,"level":2,"nodeType":"def","questionId":"138","status":"","title":"复制带随机指针的链表","titleSlug":"copy-list-with-random-pointer"},{"formTitle":"[139]单词拆分","frontendQuestionId":"139","leaf":true,"level":2,"nodeType":"def","questionId":"139","status":"","title":"单词拆分","titleSlug":"word-break"},{"formTitle":"[140]单词拆分 II","frontendQuestionId":"140","leaf":true,"level":3,"nodeType":"def","questionId":"140","status":"","title":"单词拆分 II","titleSlug":"word-break-ii"},{"formTitle":"[141]环形链表","frontendQuestionId":"141","leaf":true,"level":1,"nodeType":"def","questionId":"141","status":"","title":"环形链表","titleSlug":"linked-list-cycle"},{"formTitle":"[142]环形链表 II","frontendQuestionId":"142","leaf":true,"level":2,"nodeType":"def","questionId":"142","status":"","title":"环形链表 II","titleSlug":"linked-list-cycle-ii"},{"formTitle":"[143]重排链表","frontendQuestionId":"143","leaf":true,"level":2,"nodeType":"def","questionId":"143","status":"","title":"重排链表","titleSlug":"reorder-list"},{"formTitle":"[144]二叉树的前序遍历","frontendQuestionId":"144","leaf":true,"level":2,"nodeType":"def","questionId":"144","status":"","title":"二叉树的前序遍历","titleSlug":"binary-tree-preorder-traversal"},{"formTitle":"[145]二叉树的后序遍历","frontendQuestionId":"145","leaf":true,"level":3,"nodeType":"def","questionId":"145","status":"","title":"二叉树的后序遍历","titleSlug":"binary-tree-postorder-traversal"},{"formTitle":"[146]LRU缓存机制","frontendQuestionId":"146","leaf":true,"level":2,"nodeType":"def","questionId":"146","status":"ac","title":"LRU缓存机制","titleSlug":"lru-cache"},{"formTitle":"[147]对链表进行插入排序","frontendQuestionId":"147","leaf":true,"level":2,"nodeType":"def","questionId":"147","status":"","title":"对链表进行插入排序","titleSlug":"insertion-sort-list"},{"formTitle":"[148]排序链表","frontendQuestionId":"148","leaf":true,"level":2,"nodeType":"def","questionId":"148","status":"","title":"排序链表","titleSlug":"sort-list"},{"formTitle":"[149]直线上最多的点数","frontendQuestionId":"149","leaf":true,"level":3,"nodeType":"def","questionId":"149","status":"","title":"直线上最多的点数","titleSlug":"max-points-on-a-line"},{"formTitle":"[150]逆波兰表达式求值","frontendQuestionId":"150","leaf":true,"level":2,"nodeType":"def","questionId":"150","status":"","title":"逆波兰表达式求值","titleSlug":"evaluate-reverse-polish-notation"},{"formTitle":"[151]翻转字符串里的单词","frontendQuestionId":"151","leaf":true,"level":2,"nodeType":"def","questionId":"151","status":"","title":"翻转字符串里的单词","titleSlug":"reverse-words-in-a-string"},{"formTitle":"[152]乘积最大子序列","frontendQuestionId":"152","leaf":true,"level":2,"nodeType":"def","questionId":"152","status":"","title":"乘积最大子序列","titleSlug":"maximum-product-subarray"},{"formTitle":"[153]寻找旋转排序数组中的最小值","frontendQuestionId":"153","leaf":true,"level":2,"nodeType":"def","questionId":"153","status":"","title":"寻找旋转排序数组中的最小值","titleSlug":"find-minimum-in-rotated-sorted-array"},{"formTitle":"[154]寻找旋转排序数组中的最小值 II","frontendQuestionId":"154","leaf":true,"level":3,"nodeType":"def","questionId":"154","status":"","title":"寻找旋转排序数组中的最小值 II","titleSlug":"find-minimum-in-rotated-sorted-array-ii"},{"formTitle":"[155]最小栈","frontendQuestionId":"155","leaf":true,"level":1,"nodeType":"def","questionId":"155","status":"","title":"最小栈","titleSlug":"min-stack"},{"formTitle":"[156]上下翻转二叉树","frontendQuestionId":"156","leaf":true,"level":2,"nodeType":"def","questionId":"156","status":"lock","title":"上下翻转二叉树","titleSlug":"binary-tree-upside-down"},{"formTitle":"[157]用 Read4 读取 N 个字符","frontendQuestionId":"157","leaf":true,"level":1,"nodeType":"def","questionId":"157","status":"lock","title":"用 Read4 读取 N 个字符","titleSlug":"read-n-characters-given-read4"},{"formTitle":"[158]用 Read4 读取 N 个字符 II","frontendQuestionId":"158","leaf":true,"level":3,"nodeType":"def","questionId":"158","status":"lock","title":"用 Read4 读取 N 个字符 II","titleSlug":"read-n-characters-given-read4-ii-call-multiple-times"},{"formTitle":"[159]至多包含两个不同字符的最长子串","frontendQuestionId":"159","leaf":true,"level":3,"nodeType":"def","questionId":"159","status":"lock","title":"至多包含两个不同字符的最长子串","titleSlug":"longest-substring-with-at-most-two-distinct-characters"},{"formTitle":"[160]相交链表","frontendQuestionId":"160","leaf":true,"level":1,"nodeType":"def","questionId":"160","status":"","title":"相交链表","titleSlug":"intersection-of-two-linked-lists"},{"formTitle":"[161]相隔为 1 的编辑距离","frontendQuestionId":"161","leaf":true,"level":2,"nodeType":"def","questionId":"161","status":"lock","title":"相隔为 1 的编辑距离","titleSlug":"one-edit-distance"},{"formTitle":"[162]寻找峰值","frontendQuestionId":"162","leaf":true,"level":2,"nodeType":"def","questionId":"162","status":"","title":"寻找峰值","titleSlug":"find-peak-element"},{"formTitle":"[163]缺失的区间","frontendQuestionId":"163","leaf":true,"level":2,"nodeType":"def","questionId":"163","status":"lock","title":"缺失的区间","titleSlug":"missing-ranges"},{"formTitle":"[164]最大间距","frontendQuestionId":"164","leaf":true,"level":3,"nodeType":"def","questionId":"164","status":"","title":"最大间距","titleSlug":"maximum-gap"},{"formTitle":"[165]比较版本号","frontendQuestionId":"165","leaf":true,"level":2,"nodeType":"def","questionId":"165","status":"","title":"比较版本号","titleSlug":"compare-version-numbers"},{"formTitle":"[166]分数到小数","frontendQuestionId":"166","leaf":true,"level":2,"nodeType":"def","questionId":"166","status":"","title":"分数到小数","titleSlug":"fraction-to-recurring-decimal"},{"formTitle":"[167]两数之和 II - 输入有序数组","frontendQuestionId":"167","leaf":true,"level":1,"nodeType":"def","questionId":"167","status":"ac","title":"两数之和 II - 输入有序数组","titleSlug":"two-sum-ii-input-array-is-sorted"},{"formTitle":"[168]Excel表列名称","frontendQuestionId":"168","leaf":true,"level":1,"nodeType":"def","questionId":"168","status":"","title":"Excel表列名称","titleSlug":"excel-sheet-column-title"},{"formTitle":"[169]求众数","frontendQuestionId":"169","leaf":true,"level":1,"nodeType":"def","questionId":"169","status":"","title":"求众数","titleSlug":"majority-element"},{"formTitle":"[170]两数之和 III - 数据结构设计","frontendQuestionId":"170","leaf":true,"level":1,"nodeType":"def","questionId":"170","status":"lock","title":"两数之和 III - 数据结构设计","titleSlug":"two-sum-iii-data-structure-design"},{"formTitle":"[171]Excel表列序号","frontendQuestionId":"171","leaf":true,"level":1,"nodeType":"def","questionId":"171","status":"","title":"Excel表列序号","titleSlug":"excel-sheet-column-number"},{"formTitle":"[172]阶乘后的零","frontendQuestionId":"172","leaf":true,"level":1,"nodeType":"def","questionId":"172","status":"","title":"阶乘后的零","titleSlug":"factorial-trailing-zeroes"},{"formTitle":"[173]二叉搜索树迭代器","frontendQuestionId":"173","leaf":true,"level":2,"nodeType":"def","questionId":"173","status":"","title":"二叉搜索树迭代器","titleSlug":"binary-search-tree-iterator"},{"formTitle":"[174]地下城游戏","frontendQuestionId":"174","leaf":true,"level":3,"nodeType":"def","questionId":"174","status":"","title":"地下城游戏","titleSlug":"dungeon-game"},{"formTitle":"[175]组合两个表","frontendQuestionId":"175","leaf":true,"level":1,"nodeType":"def","questionId":"175","status":"","title":"组合两个表","titleSlug":"combine-two-tables"},{"formTitle":"[176]第二高的薪水","frontendQuestionId":"176","leaf":true,"level":1,"nodeType":"def","questionId":"176","status":"","title":"第二高的薪水","titleSlug":"second-highest-salary"},{"formTitle":"[177]第N高的薪水","frontendQuestionId":"177","leaf":true,"level":2,"nodeType":"def","questionId":"177","status":"","title":"第N高的薪水","titleSlug":"nth-highest-salary"},{"formTitle":"[178]分数排名","frontendQuestionId":"178","leaf":true,"level":2,"nodeType":"def","questionId":"178","status":"","title":"分数排名","titleSlug":"rank-scores"},{"formTitle":"[179]最大数","frontendQuestionId":"179","leaf":true,"level":2,"nodeType":"def","questionId":"179","status":"","title":"最大数","titleSlug":"largest-number"},{"formTitle":"[180]连续出现的数字","frontendQuestionId":"180","leaf":true,"level":2,"nodeType":"def","questionId":"180","status":"","title":"连续出现的数字","titleSlug":"consecutive-numbers"},{"formTitle":"[181]超过经理收入的员工","frontendQuestionId":"181","leaf":true,"level":1,"nodeType":"def","questionId":"181","status":"","title":"超过经理收入的员工","titleSlug":"employees-earning-more-than-their-managers"},{"formTitle":"[182]查找重复的电子邮箱","frontendQuestionId":"182","leaf":true,"level":1,"nodeType":"def","questionId":"182","status":"","title":"查找重复的电子邮箱","titleSlug":"duplicate-emails"},{"formTitle":"[183]从不订购的客户","frontendQuestionId":"183","leaf":true,"level":1,"nodeType":"def","questionId":"183","status":"","title":"从不订购的客户","titleSlug":"customers-who-never-order"},{"formTitle":"[184]部门工资最高的员工","frontendQuestionId":"184","leaf":true,"level":2,"nodeType":"def","questionId":"184","status":"","title":"部门工资最高的员工","titleSlug":"department-highest-salary"},{"formTitle":"[185]部门工资前三高的所有员工","frontendQuestionId":"185","leaf":true,"level":3,"nodeType":"def","questionId":"185","status":"","title":"部门工资前三高的所有员工","titleSlug":"department-top-three-salaries"},{"formTitle":"[186]翻转字符串里的单词 II","frontendQuestionId":"186","leaf":true,"level":2,"nodeType":"def","questionId":"186","status":"lock","title":"翻转字符串里的单词 II","titleSlug":"reverse-words-in-a-string-ii"},{"formTitle":"[187]重复的DNA序列","frontendQuestionId":"187","leaf":true,"level":2,"nodeType":"def","questionId":"187","status":"","title":"重复的DNA序列","titleSlug":"repeated-dna-sequences"},{"formTitle":"[188]买卖股票的最佳时机 IV","frontendQuestionId":"188","leaf":true,"level":3,"nodeType":"def","questionId":"188","status":"","title":"买卖股票的最佳时机 IV","titleSlug":"best-time-to-buy-and-sell-stock-iv"},{"formTitle":"[189]旋转数组","frontendQuestionId":"189","leaf":true,"level":1,"nodeType":"def","questionId":"189","status":"","title":"旋转数组","titleSlug":"rotate-array"},{"formTitle":"[190]颠倒二进制位","frontendQuestionId":"190","leaf":true,"level":1,"nodeType":"def","questionId":"190","status":"","title":"颠倒二进制位","titleSlug":"reverse-bits"},{"formTitle":"[191]位1的个数","frontendQuestionId":"191","leaf":true,"level":1,"nodeType":"def","questionId":"191","status":"","title":"位1的个数","titleSlug":"number-of-1-bits"},{"formTitle":"[192]统计词频","frontendQuestionId":"192","leaf":true,"level":2,"nodeType":"def","questionId":"192","status":"","title":"统计词频","titleSlug":"word-frequency"},{"formTitle":"[193]有效电话号码","frontendQuestionId":"193","leaf":true,"level":1,"nodeType":"def","questionId":"193","status":"","title":"有效电话号码","titleSlug":"valid-phone-numbers"},{"formTitle":"[194]转置文件","frontendQuestionId":"194","leaf":true,"level":2,"nodeType":"def","questionId":"194","status":"","title":"转置文件","titleSlug":"transpose-file"},{"formTitle":"[195]第十行","frontendQuestionId":"195","leaf":true,"level":1,"nodeType":"def","questionId":"195","status":"","title":"第十行","titleSlug":"tenth-line"},{"formTitle":"[196]删除重复的电子邮箱","frontendQuestionId":"196","leaf":true,"level":1,"nodeType":"def","questionId":"196","status":"","title":"删除重复的电子邮箱","titleSlug":"delete-duplicate-emails"},{"formTitle":"[197]上升的温度","frontendQuestionId":"197","leaf":true,"level":1,"nodeType":"def","questionId":"197","status":"","title":"上升的温度","titleSlug":"rising-temperature"},{"formTitle":"[198]打家劫舍","frontendQuestionId":"198","leaf":true,"level":1,"nodeType":"def","questionId":"198","status":"","title":"打家劫舍","titleSlug":"house-robber"},{"formTitle":"[199]二叉树的右视图","frontendQuestionId":"199","leaf":true,"level":2,"nodeType":"def","questionId":"199","status":"","title":"二叉树的右视图","titleSlug":"binary-tree-right-side-view"},{"formTitle":"[200]岛屿数量","frontendQuestionId":"200","leaf":true,"level":2,"nodeType":"def","questionId":"200","status":"","title":"岛屿数量","titleSlug":"number-of-islands"},{"formTitle":"[201]数字范围按位与","frontendQuestionId":"201","leaf":true,"level":2,"nodeType":"def","questionId":"201","status":"","title":"数字范围按位与","titleSlug":"bitwise-and-of-numbers-range"},{"formTitle":"[202]快乐数","frontendQuestionId":"202","leaf":true,"level":1,"nodeType":"def","questionId":"202","status":"ac","title":"快乐数","titleSlug":"happy-number"},{"formTitle":"[203]移除链表元素","frontendQuestionId":"203","leaf":true,"level":1,"nodeType":"def","questionId":"203","status":"","title":"移除链表元素","titleSlug":"remove-linked-list-elements"},{"formTitle":"[204]计数质数","frontendQuestionId":"204","leaf":true,"level":1,"nodeType":"def","questionId":"204","status":"","title":"计数质数","titleSlug":"count-primes"},{"formTitle":"[205]同构字符串","frontendQuestionId":"205","leaf":true,"level":1,"nodeType":"def","questionId":"205","status":"ac","title":"同构字符串","titleSlug":"isomorphic-strings"},{"formTitle":"[206]反转链表","frontendQuestionId":"206","leaf":true,"level":1,"nodeType":"def","questionId":"206","status":"","title":"反转链表","titleSlug":"reverse-linked-list"},{"formTitle":"[207]课程表","frontendQuestionId":"207","leaf":true,"level":2,"nodeType":"def","questionId":"207","status":"","title":"课程表","titleSlug":"course-schedule"},{"formTitle":"[208]实现 Trie (前缀树)","frontendQuestionId":"208","leaf":true,"level":2,"nodeType":"def","questionId":"208","status":"","title":"实现 Trie (前缀树)","titleSlug":"implement-trie-prefix-tree"},{"formTitle":"[209]长度最小的子数组","frontendQuestionId":"209","leaf":true,"level":2,"nodeType":"def","questionId":"209","status":"ac","title":"长度最小的子数组","titleSlug":"minimum-size-subarray-sum"},{"formTitle":"[210]课程表 II","frontendQuestionId":"210","leaf":true,"level":2,"nodeType":"def","questionId":"210","status":"","title":"课程表 II","titleSlug":"course-schedule-ii"},{"formTitle":"[211]添加与搜索单词 - 数据结构设计","frontendQuestionId":"211","leaf":true,"level":2,"nodeType":"def","questionId":"211","status":"","title":"添加与搜索单词 - 数据结构设计","titleSlug":"add-and-search-word-data-structure-design"},{"formTitle":"[212]单词搜索 II","frontendQuestionId":"212","leaf":true,"level":3,"nodeType":"def","questionId":"212","status":"","title":"单词搜索 II","titleSlug":"word-search-ii"},{"formTitle":"[213]打家劫舍 II","frontendQuestionId":"213","leaf":true,"level":2,"nodeType":"def","questionId":"213","status":"","title":"打家劫舍 II","titleSlug":"house-robber-ii"},{"formTitle":"[214]最短回文串","frontendQuestionId":"214","leaf":true,"level":3,"nodeType":"def","questionId":"214","status":"","title":"最短回文串","titleSlug":"shortest-palindrome"},{"formTitle":"[215]数组中的第K个最大元素","frontendQuestionId":"215","leaf":true,"level":2,"nodeType":"def","questionId":"215","status":"","title":"数组中的第K个最大元素","titleSlug":"kth-largest-element-in-an-array"},{"formTitle":"[216]组合总和 III","frontendQuestionId":"216","leaf":true,"level":2,"nodeType":"def","questionId":"216","status":"","title":"组合总和 III","titleSlug":"combination-sum-iii"},{"formTitle":"[217]存在重复元素","frontendQuestionId":"217","leaf":true,"level":1,"nodeType":"def","questionId":"217","status":"","title":"存在重复元素","titleSlug":"contains-duplicate"},{"formTitle":"[218]天际线问题","frontendQuestionId":"218","leaf":true,"level":3,"nodeType":"def","questionId":"218","status":"","title":"天际线问题","titleSlug":"the-skyline-problem"},{"formTitle":"[219]存在重复元素 II","frontendQuestionId":"219","leaf":true,"level":1,"nodeType":"def","questionId":"219","status":"","title":"存在重复元素 II","titleSlug":"contains-duplicate-ii"},{"formTitle":"[220]存在重复元素 III","frontendQuestionId":"220","leaf":true,"level":2,"nodeType":"def","questionId":"220","status":"","title":"存在重复元素 III","titleSlug":"contains-duplicate-iii"},{"formTitle":"[221]最大正方形","frontendQuestionId":"221","leaf":true,"level":2,"nodeType":"def","questionId":"221","status":"","title":"最大正方形","titleSlug":"maximal-square"},{"formTitle":"[222]完全二叉树的节点个数","frontendQuestionId":"222","leaf":true,"level":2,"nodeType":"def","questionId":"222","status":"","title":"完全二叉树的节点个数","titleSlug":"count-complete-tree-nodes"},{"formTitle":"[223]矩形面积","frontendQuestionId":"223","leaf":true,"level":2,"nodeType":"def","questionId":"223","status":"","title":"矩形面积","titleSlug":"rectangle-area"},{"formTitle":"[224]基本计算器","frontendQuestionId":"224","leaf":true,"level":3,"nodeType":"def","questionId":"224","status":"","title":"基本计算器","titleSlug":"basic-calculator"},{"formTitle":"[225]用队列实现栈","frontendQuestionId":"225","leaf":true,"level":1,"nodeType":"def","questionId":"225","status":"","title":"用队列实现栈","titleSlug":"implement-stack-using-queues"},{"formTitle":"[226]翻转二叉树","frontendQuestionId":"226","leaf":true,"level":1,"nodeType":"def","questionId":"226","status":"","title":"翻转二叉树","titleSlug":"invert-binary-tree"},{"formTitle":"[227]基本计算器 II","frontendQuestionId":"227","leaf":true,"level":2,"nodeType":"def","questionId":"227","status":"","title":"基本计算器 II","titleSlug":"basic-calculator-ii"},{"formTitle":"[228]汇总区间","frontendQuestionId":"228","leaf":true,"level":2,"nodeType":"def","questionId":"228","status":"","title":"汇总区间","titleSlug":"summary-ranges"},{"formTitle":"[229]求众数 II","frontendQuestionId":"229","leaf":true,"level":2,"nodeType":"def","questionId":"229","status":"","title":"求众数 II","titleSlug":"majority-element-ii"},{"formTitle":"[230]二叉搜索树中第K小的元素","frontendQuestionId":"230","leaf":true,"level":2,"nodeType":"def","questionId":"230","status":"","title":"二叉搜索树中第K小的元素","titleSlug":"kth-smallest-element-in-a-bst"},{"formTitle":"[231]2的幂","frontendQuestionId":"231","leaf":true,"level":1,"nodeType":"def","questionId":"231","status":"","title":"2的幂","titleSlug":"power-of-two"},{"formTitle":"[232]用栈实现队列","frontendQuestionId":"232","leaf":true,"level":1,"nodeType":"def","questionId":"232","status":"","title":"用栈实现队列","titleSlug":"implement-queue-using-stacks"},{"formTitle":"[233]数字 1 的个数","frontendQuestionId":"233","leaf":true,"level":3,"nodeType":"def","questionId":"233","status":"","title":"数字 1 的个数","titleSlug":"number-of-digit-one"},{"formTitle":"[234]回文链表","frontendQuestionId":"234","leaf":true,"level":1,"nodeType":"def","questionId":"234","status":"","title":"回文链表","titleSlug":"palindrome-linked-list"},{"formTitle":"[235]二叉搜索树的最近公共祖先","frontendQuestionId":"235","leaf":true,"level":1,"nodeType":"def","questionId":"235","status":"","title":"二叉搜索树的最近公共祖先","titleSlug":"lowest-common-ancestor-of-a-binary-search-tree"},{"formTitle":"[236]二叉树的最近公共祖先","frontendQuestionId":"236","leaf":true,"level":2,"nodeType":"def","questionId":"236","status":"","title":"二叉树的最近公共祖先","titleSlug":"lowest-common-ancestor-of-a-binary-tree"},{"formTitle":"[237]删除链表中的节点","frontendQuestionId":"237","leaf":true,"level":1,"nodeType":"def","questionId":"237","status":"","title":"删除链表中的节点","titleSlug":"delete-node-in-a-linked-list"},{"formTitle":"[238]除自身以外数组的乘积","frontendQuestionId":"238","leaf":true,"level":2,"nodeType":"def","questionId":"238","status":"","title":"除自身以外数组的乘积","titleSlug":"product-of-array-except-self"},{"formTitle":"[239]滑动窗口最大值","frontendQuestionId":"239","leaf":true,"level":3,"nodeType":"def","questionId":"239","status":"","title":"滑动窗口最大值","titleSlug":"sliding-window-maximum"},{"formTitle":"[240]搜索二维矩阵 II","frontendQuestionId":"240","leaf":true,"level":2,"nodeType":"def","questionId":"240","status":"","title":"搜索二维矩阵 II","titleSlug":"search-a-2d-matrix-ii"},{"formTitle":"[241]为运算表达式设计优先级","frontendQuestionId":"241","leaf":true,"level":2,"nodeType":"def","questionId":"241","status":"","title":"为运算表达式设计优先级","titleSlug":"different-ways-to-add-parentheses"},{"formTitle":"[242]有效的字母异位词","frontendQuestionId":"242","leaf":true,"level":1,"nodeType":"def","questionId":"242","status":"ac","title":"有效的字母异位词","titleSlug":"valid-anagram"},{"formTitle":"[243]最短单词距离","frontendQuestionId":"243","leaf":true,"level":1,"nodeType":"def","questionId":"243","status":"lock","title":"最短单词距离","titleSlug":"shortest-word-distance"},{"formTitle":"[244]最短单词距离 II","frontendQuestionId":"244","leaf":true,"level":2,"nodeType":"def","questionId":"244","status":"lock","title":"最短单词距离 II","titleSlug":"shortest-word-distance-ii"},{"formTitle":"[245]最短单词距离 III","frontendQuestionId":"245","leaf":true,"level":2,"nodeType":"def","questionId":"245","status":"lock","title":"最短单词距离 III","titleSlug":"shortest-word-distance-iii"},{"formTitle":"[246]中心对称数","frontendQuestionId":"246","leaf":true,"level":1,"nodeType":"def","questionId":"246","status":"lock","title":"中心对称数","titleSlug":"strobogrammatic-number"},{"formTitle":"[247]中心对称数 II","frontendQuestionId":"247","leaf":true,"level":2,"nodeType":"def","questionId":"247","status":"lock","title":"中心对称数 II","titleSlug":"strobogrammatic-number-ii"},{"formTitle":"[248]中心对称数 III","frontendQuestionId":"248","leaf":true,"level":3,"nodeType":"def","questionId":"248","status":"lock","title":"中心对称数 III","titleSlug":"strobogrammatic-number-iii"},{"formTitle":"[249]移位字符串分组","frontendQuestionId":"249","leaf":true,"level":2,"nodeType":"def","questionId":"249","status":"lock","title":"移位字符串分组","titleSlug":"group-shifted-strings"},{"formTitle":"[250]统计同值子树","frontendQuestionId":"250","leaf":true,"level":2,"nodeType":"def","questionId":"250","status":"lock","title":"统计同值子树","titleSlug":"count-univalue-subtrees"},{"formTitle":"[251]展开二维向量","frontendQuestionId":"251","leaf":true,"level":2,"nodeType":"def","questionId":"251","status":"lock","title":"展开二维向量","titleSlug":"flatten-2d-vector"},{"formTitle":"[252]会议室","frontendQuestionId":"252","leaf":true,"level":1,"nodeType":"def","questionId":"252","status":"lock","title":"会议室","titleSlug":"meeting-rooms"},{"formTitle":"[253]会议室 II","frontendQuestionId":"253","leaf":true,"level":2,"nodeType":"def","questionId":"253","status":"lock","title":"会议室 II","titleSlug":"meeting-rooms-ii"},{"formTitle":"[254]因子的组合","frontendQuestionId":"254","leaf":true,"level":2,"nodeType":"def","questionId":"254","status":"lock","title":"因子的组合","titleSlug":"factor-combinations"},{"formTitle":"[255]验证前序遍历序列二叉搜索树","frontendQuestionId":"255","leaf":true,"level":2,"nodeType":"def","questionId":"255","status":"lock","title":"验证前序遍历序列二叉搜索树","titleSlug":"verify-preorder-sequence-in-binary-search-tree"},{"formTitle":"[256]粉刷房子","frontendQuestionId":"256","leaf":true,"level":1,"nodeType":"def","questionId":"256","status":"lock","title":"粉刷房子","titleSlug":"paint-house"},{"formTitle":"[257]二叉树的所有路径","frontendQuestionId":"257","leaf":true,"level":1,"nodeType":"def","questionId":"257","status":"","title":"二叉树的所有路径","titleSlug":"binary-tree-paths"},{"formTitle":"[258]各位相加","frontendQuestionId":"258","leaf":true,"level":1,"nodeType":"def","questionId":"258","status":"","title":"各位相加","titleSlug":"add-digits"},{"formTitle":"[259]较小的三数之和","frontendQuestionId":"259","leaf":true,"level":2,"nodeType":"def","questionId":"259","status":"lock","title":"较小的三数之和","titleSlug":"3sum-smaller"},{"formTitle":"[260]只出现一次的数字 III","frontendQuestionId":"260","leaf":true,"level":2,"nodeType":"def","questionId":"260","status":"","title":"只出现一次的数字 III","titleSlug":"single-number-iii"},{"formTitle":"[261]以图判树","frontendQuestionId":"261","leaf":true,"level":2,"nodeType":"def","questionId":"261","status":"lock","title":"以图判树","titleSlug":"graph-valid-tree"},{"formTitle":"[262]行程和用户","frontendQuestionId":"262","leaf":true,"level":3,"nodeType":"def","questionId":"262","status":"","title":"行程和用户","titleSlug":"trips-and-users"},{"formTitle":"[263]丑数","frontendQuestionId":"263","leaf":true,"level":1,"nodeType":"def","questionId":"263","status":"","title":"丑数","titleSlug":"ugly-number"},{"formTitle":"[264]丑数 II","frontendQuestionId":"264","leaf":true,"level":2,"nodeType":"def","questionId":"264","status":"","title":"丑数 II","titleSlug":"ugly-number-ii"},{"formTitle":"[265]粉刷房子 II","frontendQuestionId":"265","leaf":true,"level":3,"nodeType":"def","questionId":"265","status":"lock","title":"粉刷房子 II","titleSlug":"paint-house-ii"},{"formTitle":"[266]回文排列","frontendQuestionId":"266","leaf":true,"level":1,"nodeType":"def","questionId":"266","status":"lock","title":"回文排列","titleSlug":"palindrome-permutation"},{"formTitle":"[267]回文排列 II","frontendQuestionId":"267","leaf":true,"level":2,"nodeType":"def","questionId":"267","status":"lock","title":"回文排列 II","titleSlug":"palindrome-permutation-ii"},{"formTitle":"[268]缺失数字","frontendQuestionId":"268","leaf":true,"level":1,"nodeType":"def","questionId":"268","status":"","title":"缺失数字","titleSlug":"missing-number"},{"formTitle":"[269]火星词典","frontendQuestionId":"269","leaf":true,"level":3,"nodeType":"def","questionId":"269","status":"lock","title":"火星词典","titleSlug":"alien-dictionary"},{"formTitle":"[270]最接近的二叉搜索树值","frontendQuestionId":"270","leaf":true,"level":1,"nodeType":"def","questionId":"270","status":"lock","title":"最接近的二叉搜索树值","titleSlug":"closest-binary-search-tree-value"},{"formTitle":"[271]字符串的编码与解码","frontendQuestionId":"271","leaf":true,"level":2,"nodeType":"def","questionId":"271","status":"lock","title":"字符串的编码与解码","titleSlug":"encode-and-decode-strings"},{"formTitle":"[272]最接近的二叉搜索树值 II","frontendQuestionId":"272","leaf":true,"level":3,"nodeType":"def","questionId":"272","status":"lock","title":"最接近的二叉搜索树值 II","titleSlug":"closest-binary-search-tree-value-ii"},{"formTitle":"[273]整数转换英文表示","frontendQuestionId":"273","leaf":true,"level":3,"nodeType":"def","questionId":"273","status":"","title":"整数转换英文表示","titleSlug":"integer-to-english-words"},{"formTitle":"[274]H指数","frontendQuestionId":"274","leaf":true,"level":2,"nodeType":"def","questionId":"274","status":"","title":"H指数","titleSlug":"h-index"},{"formTitle":"[275]H指数 II","frontendQuestionId":"275","leaf":true,"level":2,"nodeType":"def","questionId":"275","status":"","title":"H指数 II","titleSlug":"h-index-ii"},{"formTitle":"[276]栅栏涂色","frontendQuestionId":"276","leaf":true,"level":1,"nodeType":"def","questionId":"276","status":"lock","title":"栅栏涂色","titleSlug":"paint-fence"},{"formTitle":"[277]搜寻名人","frontendQuestionId":"277","leaf":true,"level":2,"nodeType":"def","questionId":"277","status":"lock","title":"搜寻名人","titleSlug":"find-the-celebrity"},{"formTitle":"[278]第一个错误的版本","frontendQuestionId":"278","leaf":true,"level":1,"nodeType":"def","questionId":"278","status":"","title":"第一个错误的版本","titleSlug":"first-bad-version"},{"formTitle":"[279]完全平方数","frontendQuestionId":"279","leaf":true,"level":2,"nodeType":"def","questionId":"279","status":"","title":"完全平方数","titleSlug":"perfect-squares"},{"formTitle":"[280]摆动排序","frontendQuestionId":"280","leaf":true,"level":2,"nodeType":"def","questionId":"280","status":"lock","title":"摆动排序","titleSlug":"wiggle-sort"},{"formTitle":"[281]锯齿迭代器","frontendQuestionId":"281","leaf":true,"level":2,"nodeType":"def","questionId":"281","status":"lock","title":"锯齿迭代器","titleSlug":"zigzag-iterator"},{"formTitle":"[282]给表达式添加运算符","frontendQuestionId":"282","leaf":true,"level":3,"nodeType":"def","questionId":"282","status":"","title":"给表达式添加运算符","titleSlug":"expression-add-operators"},{"formTitle":"[283]移动零","frontendQuestionId":"283","leaf":true,"level":1,"nodeType":"def","questionId":"283","status":"ac","title":"移动零","titleSlug":"move-zeroes"},{"formTitle":"[284]顶端迭代器","frontendQuestionId":"284","leaf":true,"level":2,"nodeType":"def","questionId":"284","status":"","title":"顶端迭代器","titleSlug":"peeking-iterator"},{"formTitle":"[285]二叉搜索树中的顺序后继","frontendQuestionId":"285","leaf":true,"level":2,"nodeType":"def","questionId":"285","status":"lock","title":"二叉搜索树中的顺序后继","titleSlug":"inorder-successor-in-bst"},{"formTitle":"[286]墙与门","frontendQuestionId":"286","leaf":true,"level":2,"nodeType":"def","questionId":"286","status":"lock","title":"墙与门","titleSlug":"walls-and-gates"},{"formTitle":"[287]寻找重复数","frontendQuestionId":"287","leaf":true,"level":2,"nodeType":"def","questionId":"287","status":"","title":"寻找重复数","titleSlug":"find-the-duplicate-number"},{"formTitle":"[288]单词的唯一缩写","frontendQuestionId":"288","leaf":true,"level":2,"nodeType":"def","questionId":"288","status":"lock","title":"单词的唯一缩写","titleSlug":"unique-word-abbreviation"},{"formTitle":"[289]生命游戏","frontendQuestionId":"289","leaf":true,"level":2,"nodeType":"def","questionId":"289","status":"","title":"生命游戏","titleSlug":"game-of-life"},{"formTitle":"[290]单词规律","frontendQuestionId":"290","leaf":true,"level":1,"nodeType":"def","questionId":"290","status":"ac","title":"单词规律","titleSlug":"word-pattern"},{"formTitle":"[291]单词规律 II","frontendQuestionId":"291","leaf":true,"level":3,"nodeType":"def","questionId":"291","status":"lock","title":"单词规律 II","titleSlug":"word-pattern-ii"},{"formTitle":"[292]Nim 游戏","frontendQuestionId":"292","leaf":true,"level":1,"nodeType":"def","questionId":"292","status":"","title":"Nim 游戏","titleSlug":"nim-game"},{"formTitle":"[293]翻转游戏","frontendQuestionId":"293","leaf":true,"level":1,"nodeType":"def","questionId":"293","status":"lock","title":"翻转游戏","titleSlug":"flip-game"},{"formTitle":"[294]翻转游戏 II","frontendQuestionId":"294","leaf":true,"level":2,"nodeType":"def","questionId":"294","status":"lock","title":"翻转游戏 II","titleSlug":"flip-game-ii"},{"formTitle":"[295]数据流的中位数","frontendQuestionId":"295","leaf":true,"level":3,"nodeType":"def","questionId":"295","status":"","title":"数据流的中位数","titleSlug":"find-median-from-data-stream"},{"formTitle":"[296]最佳的碰头地点","frontendQuestionId":"296","leaf":true,"level":3,"nodeType":"def","questionId":"296","status":"lock","title":"最佳的碰头地点","titleSlug":"best-meeting-point"},{"formTitle":"[297]二叉树的序列化与反序列化","frontendQuestionId":"297","leaf":true,"level":3,"nodeType":"def","questionId":"297","status":"","title":"二叉树的序列化与反序列化","titleSlug":"serialize-and-deserialize-binary-tree"},{"formTitle":"[298]二叉树最长连续序列","frontendQuestionId":"298","leaf":true,"level":2,"nodeType":"def","questionId":"298","status":"lock","title":"二叉树最长连续序列","titleSlug":"binary-tree-longest-consecutive-sequence"},{"formTitle":"[299]猜数字游戏","frontendQuestionId":"299","leaf":true,"level":1,"nodeType":"def","questionId":"299","status":"","title":"猜数字游戏","titleSlug":"bulls-and-cows"},{"formTitle":"[300]最长上升子序列","frontendQuestionId":"300","leaf":true,"level":2,"nodeType":"def","questionId":"300","status":"","title":"最长上升子序列","titleSlug":"longest-increasing-subsequence"},{"formTitle":"[301]删除无效的括号","frontendQuestionId":"301","leaf":true,"level":3,"nodeType":"def","questionId":"301","status":"","title":"删除无效的括号","titleSlug":"remove-invalid-parentheses"},{"formTitle":"[302]包含全部黑色像素的最小矩形","frontendQuestionId":"302","leaf":true,"level":3,"nodeType":"def","questionId":"302","status":"lock","title":"包含全部黑色像素的最小矩形","titleSlug":"smallest-rectangle-enclosing-black-pixels"},{"formTitle":"[303]区域和检索 - 数组不可变","frontendQuestionId":"303","leaf":true,"level":1,"nodeType":"def","questionId":"303","status":"","title":"区域和检索 - 数组不可变","titleSlug":"range-sum-query-immutable"},{"formTitle":"[304]二维区域和检索 - 矩阵不可变","frontendQuestionId":"304","leaf":true,"level":2,"nodeType":"def","questionId":"304","status":"","title":"二维区域和检索 - 矩阵不可变","titleSlug":"range-sum-query-2d-immutable"},{"formTitle":"[305]岛屿数量 II","frontendQuestionId":"305","leaf":true,"level":3,"nodeType":"def","questionId":"305","status":"lock","title":"岛屿数量 II","titleSlug":"number-of-islands-ii"},{"formTitle":"[306]累加数","frontendQuestionId":"306","leaf":true,"level":2,"nodeType":"def","questionId":"306","status":"","title":"累加数","titleSlug":"additive-number"},{"formTitle":"[307]区域和检索 - 数组可修改","frontendQuestionId":"307","leaf":true,"level":2,"nodeType":"def","questionId":"307","status":"","title":"区域和检索 - 数组可修改","titleSlug":"range-sum-query-mutable"},{"formTitle":"[308]二维区域和检索 - 可变","frontendQuestionId":"308","leaf":true,"level":3,"nodeType":"def","questionId":"308","status":"lock","title":"二维区域和检索 - 可变","titleSlug":"range-sum-query-2d-mutable"},{"formTitle":"[309]最佳买卖股票时机含冷冻期","frontendQuestionId":"309","leaf":true,"level":2,"nodeType":"def","questionId":"309","status":"","title":"最佳买卖股票时机含冷冻期","titleSlug":"best-time-to-buy-and-sell-stock-with-cooldown"},{"formTitle":"[310]最小高度树","frontendQuestionId":"310","leaf":true,"level":2,"nodeType":"def","questionId":"310","status":"","title":"最小高度树","titleSlug":"minimum-height-trees"},{"formTitle":"[311]稀疏矩阵的乘法","frontendQuestionId":"311","leaf":true,"level":2,"nodeType":"def","questionId":"311","status":"lock","title":"稀疏矩阵的乘法","titleSlug":"sparse-matrix-multiplication"},{"formTitle":"[312]戳气球","frontendQuestionId":"312","leaf":true,"level":3,"nodeType":"def","questionId":"312","status":"","title":"戳气球","titleSlug":"burst-balloons"},{"formTitle":"[313]超级丑数","frontendQuestionId":"313","leaf":true,"level":2,"nodeType":"def","questionId":"313","status":"","title":"超级丑数","titleSlug":"super-ugly-number"},{"formTitle":"[314]二叉树的垂直遍历","frontendQuestionId":"314","leaf":true,"level":2,"nodeType":"def","questionId":"314","status":"lock","title":"二叉树的垂直遍历","titleSlug":"binary-tree-vertical-order-traversal"},{"formTitle":"[315]计算右侧小于当前元素的个数","frontendQuestionId":"315","leaf":true,"level":3,"nodeType":"def","questionId":"315","status":"","title":"计算右侧小于当前元素的个数","titleSlug":"count-of-smaller-numbers-after-self"},{"formTitle":"[316]去除重复字母","frontendQuestionId":"316","leaf":true,"level":3,"nodeType":"def","questionId":"316","status":"","title":"去除重复字母","titleSlug":"remove-duplicate-letters"},{"formTitle":"[317]离建筑物最近的距离","frontendQuestionId":"317","leaf":true,"level":3,"nodeType":"def","questionId":"317","status":"lock","title":"离建筑物最近的距离","titleSlug":"shortest-distance-from-all-buildings"},{"formTitle":"[318]最大单词长度乘积","frontendQuestionId":"318","leaf":true,"level":2,"nodeType":"def","questionId":"318","status":"","title":"最大单词长度乘积","titleSlug":"maximum-product-of-word-lengths"},{"formTitle":"[319]灯泡开关","frontendQuestionId":"319","leaf":true,"level":2,"nodeType":"def","questionId":"319","status":"","title":"灯泡开关","titleSlug":"bulb-switcher"},{"formTitle":"[320]列举单词的全部缩写","frontendQuestionId":"320","leaf":true,"level":2,"nodeType":"def","questionId":"320","status":"lock","title":"列举单词的全部缩写","titleSlug":"generalized-abbreviation"},{"formTitle":"[321]拼接最大数","frontendQuestionId":"321","leaf":true,"level":3,"nodeType":"def","questionId":"321","status":"","title":"拼接最大数","titleSlug":"create-maximum-number"},{"formTitle":"[322]零钱兑换","frontendQuestionId":"322","leaf":true,"level":2,"nodeType":"def","questionId":"322","status":"","title":"零钱兑换","titleSlug":"coin-change"},{"formTitle":"[323]无向图中连通分量的数目","frontendQuestionId":"323","leaf":true,"level":2,"nodeType":"def","questionId":"323","status":"lock","title":"无向图中连通分量的数目","titleSlug":"number-of-connected-components-in-an-undirected-graph"},{"formTitle":"[324]摆动排序 II","frontendQuestionId":"324","leaf":true,"level":2,"nodeType":"def","questionId":"324","status":"","title":"摆动排序 II","titleSlug":"wiggle-sort-ii"},{"formTitle":"[325]和等于 k 的最长子数组长度","frontendQuestionId":"325","leaf":true,"level":2,"nodeType":"def","questionId":"325","status":"lock","title":"和等于 k 的最长子数组长度","titleSlug":"maximum-size-subarray-sum-equals-k"},{"formTitle":"[326]3的幂","frontendQuestionId":"326","leaf":true,"level":1,"nodeType":"def","questionId":"326","status":"","title":"3的幂","titleSlug":"power-of-three"},{"formTitle":"[327]区间和的个数","frontendQuestionId":"327","leaf":true,"level":3,"nodeType":"def","questionId":"327","status":"","title":"区间和的个数","titleSlug":"count-of-range-sum"},{"formTitle":"[328]奇偶链表","frontendQuestionId":"328","leaf":true,"level":2,"nodeType":"def","questionId":"328","status":"","title":"奇偶链表","titleSlug":"odd-even-linked-list"},{"formTitle":"[329]矩阵中的最长递增路径","frontendQuestionId":"329","leaf":true,"level":3,"nodeType":"def","questionId":"329","status":"","title":"矩阵中的最长递增路径","titleSlug":"longest-increasing-path-in-a-matrix"},{"formTitle":"[330]按要求补齐数组","frontendQuestionId":"330","leaf":true,"level":3,"nodeType":"def","questionId":"330","status":"","title":"按要求补齐数组","titleSlug":"patching-array"},{"formTitle":"[331]验证二叉树的前序序列化","frontendQuestionId":"331","leaf":true,"level":2,"nodeType":"def","questionId":"331","status":"","title":"验证二叉树的前序序列化","titleSlug":"verify-preorder-serialization-of-a-binary-tree"},{"formTitle":"[332]重新安排行程","frontendQuestionId":"332","leaf":true,"level":2,"nodeType":"def","questionId":"332","status":"","title":"重新安排行程","titleSlug":"reconstruct-itinerary"},{"formTitle":"[333]最大 BST 子树","frontendQuestionId":"333","leaf":true,"level":2,"nodeType":"def","questionId":"333","status":"lock","title":"最大 BST 子树","titleSlug":"largest-bst-subtree"},{"formTitle":"[334]递增的三元子序列","frontendQuestionId":"334","leaf":true,"level":2,"nodeType":"def","questionId":"334","status":"","title":"递增的三元子序列","titleSlug":"increasing-triplet-subsequence"},{"formTitle":"[335]路径交叉","frontendQuestionId":"335","leaf":true,"level":3,"nodeType":"def","questionId":"335","status":"","title":"路径交叉","titleSlug":"self-crossing"},{"formTitle":"[336]回文对","frontendQuestionId":"336","leaf":true,"level":3,"nodeType":"def","questionId":"336","status":"","title":"回文对","titleSlug":"palindrome-pairs"},{"formTitle":"[337]打家劫舍 III","frontendQuestionId":"337","leaf":true,"level":2,"nodeType":"def","questionId":"337","status":"","title":"打家劫舍 III","titleSlug":"house-robber-iii"},{"formTitle":"[338]比特位计数","frontendQuestionId":"338","leaf":true,"level":2,"nodeType":"def","questionId":"338","status":"","title":"比特位计数","titleSlug":"counting-bits"},{"formTitle":"[339]嵌套列表权重和","frontendQuestionId":"339","leaf":true,"level":1,"nodeType":"def","questionId":"339","status":"lock","title":"嵌套列表权重和","titleSlug":"nested-list-weight-sum"},{"formTitle":"[340]至多包含 K 个不同字符的最长子串","frontendQuestionId":"340","leaf":true,"level":3,"nodeType":"def","questionId":"340","status":"lock","title":"至多包含 K 个不同字符的最长子串","titleSlug":"longest-substring-with-at-most-k-distinct-characters"},{"formTitle":"[341]扁平化嵌套列表迭代器","frontendQuestionId":"341","leaf":true,"level":2,"nodeType":"def","questionId":"341","status":"","title":"扁平化嵌套列表迭代器","titleSlug":"flatten-nested-list-iterator"},{"formTitle":"[342]4的幂","frontendQuestionId":"342","leaf":true,"level":1,"nodeType":"def","questionId":"342","status":"","title":"4的幂","titleSlug":"power-of-four"},{"formTitle":"[343]整数拆分","frontendQuestionId":"343","leaf":true,"level":2,"nodeType":"def","questionId":"343","status":"","title":"整数拆分","titleSlug":"integer-break"},{"formTitle":"[344]反转字符串","frontendQuestionId":"344","leaf":true,"level":1,"nodeType":"def","questionId":"344","status":"ac","title":"反转字符串","titleSlug":"reverse-string"},{"formTitle":"[345]反转字符串中的元音字母","frontendQuestionId":"345","leaf":true,"level":1,"nodeType":"def","questionId":"345","status":"ac","title":"反转字符串中的元音字母","titleSlug":"reverse-vowels-of-a-string"},{"formTitle":"[346]数据流中的移动平均值","frontendQuestionId":"346","leaf":true,"level":1,"nodeType":"def","questionId":"346","status":"lock","title":"数据流中的移动平均值","titleSlug":"moving-average-from-data-stream"},{"formTitle":"[347]前 K 个高频元素","frontendQuestionId":"347","leaf":true,"level":2,"nodeType":"def","questionId":"347","status":"","title":"前 K 个高频元素","titleSlug":"top-k-frequent-elements"},{"formTitle":"[348]判定井字棋胜负","frontendQuestionId":"348","leaf":true,"level":2,"nodeType":"def","questionId":"348","status":"lock","title":"判定井字棋胜负","titleSlug":"design-tic-tac-toe"},{"formTitle":"[349]两个数组的交集","frontendQuestionId":"349","leaf":true,"level":1,"nodeType":"def","questionId":"349","status":"ac","title":"两个数组的交集","titleSlug":"intersection-of-two-arrays"},{"formTitle":"[350]两个数组的交集 II","frontendQuestionId":"350","leaf":true,"level":1,"nodeType":"def","questionId":"350","status":"ac","title":"两个数组的交集 II","titleSlug":"intersection-of-two-arrays-ii"},{"formTitle":"[351]安卓系统手势解锁","frontendQuestionId":"351","leaf":true,"level":2,"nodeType":"def","questionId":"351","status":"lock","title":"安卓系统手势解锁","titleSlug":"android-unlock-patterns"},{"formTitle":"[352]将数据流变为多个不相交区间","frontendQuestionId":"352","leaf":true,"level":3,"nodeType":"def","questionId":"352","status":"","title":"将数据流变为多个不相交区间","titleSlug":"data-stream-as-disjoint-intervals"},{"formTitle":"[353]贪吃蛇","frontendQuestionId":"353","leaf":true,"level":2,"nodeType":"def","questionId":"353","status":"lock","title":"贪吃蛇","titleSlug":"design-snake-game"},{"formTitle":"[354]俄罗斯套娃信封问题","frontendQuestionId":"354","leaf":true,"level":3,"nodeType":"def","questionId":"354","status":"","title":"俄罗斯套娃信封问题","titleSlug":"russian-doll-envelopes"},{"formTitle":"[355]设计推特","frontendQuestionId":"355","leaf":true,"level":2,"nodeType":"def","questionId":"355","status":"","title":"设计推特","titleSlug":"design-twitter"},{"formTitle":"[356]直线镜像","frontendQuestionId":"356","leaf":true,"level":2,"nodeType":"def","questionId":"356","status":"lock","title":"直线镜像","titleSlug":"line-reflection"},{"formTitle":"[357]计算各个位数不同的数字个数","frontendQuestionId":"357","leaf":true,"level":2,"nodeType":"def","questionId":"357","status":"","title":"计算各个位数不同的数字个数","titleSlug":"count-numbers-with-unique-digits"},{"formTitle":"[358]K 距离间隔重排字符串","frontendQuestionId":"358","leaf":true,"level":3,"nodeType":"def","questionId":"358","status":"lock","title":"K 距离间隔重排字符串","titleSlug":"rearrange-string-k-distance-apart"},{"formTitle":"[359]日志速率限制器","frontendQuestionId":"359","leaf":true,"level":1,"nodeType":"def","questionId":"359","status":"lock","title":"日志速率限制器","titleSlug":"logger-rate-limiter"},{"formTitle":"[360]有序转化数组","frontendQuestionId":"360","leaf":true,"level":2,"nodeType":"def","questionId":"360","status":"lock","title":"有序转化数组","titleSlug":"sort-transformed-array"},{"formTitle":"[361]轰炸敌人","frontendQuestionId":"361","leaf":true,"level":2,"nodeType":"def","questionId":"361","status":"lock","title":"轰炸敌人","titleSlug":"bomb-enemy"},{"formTitle":"[362]敲击计数器","frontendQuestionId":"362","leaf":true,"level":2,"nodeType":"def","questionId":"362","status":"lock","title":"敲击计数器","titleSlug":"design-hit-counter"},{"formTitle":"[363]矩形区域不超过 K 的最大数值和","frontendQuestionId":"363","leaf":true,"level":3,"nodeType":"def","questionId":"363","status":"","title":"矩形区域不超过 K 的最大数值和","titleSlug":"max-sum-of-rectangle-no-larger-than-k"},{"formTitle":"[364]加权嵌套序列和 II","frontendQuestionId":"364","leaf":true,"level":2,"nodeType":"def","questionId":"364","status":"lock","title":"加权嵌套序列和 II","titleSlug":"nested-list-weight-sum-ii"},{"formTitle":"[365]水壶问题","frontendQuestionId":"365","leaf":true,"level":2,"nodeType":"def","questionId":"365","status":"","title":"水壶问题","titleSlug":"water-and-jug-problem"},{"formTitle":"[366]寻找完全二叉树的叶子节点","frontendQuestionId":"366","leaf":true,"level":2,"nodeType":"def","questionId":"366","status":"lock","title":"寻找完全二叉树的叶子节点","titleSlug":"find-leaves-of-binary-tree"},{"formTitle":"[367]有效的完全平方数","frontendQuestionId":"367","leaf":true,"level":1,"nodeType":"def","questionId":"367","status":"","title":"有效的完全平方数","titleSlug":"valid-perfect-square"},{"formTitle":"[368]最大整除子集","frontendQuestionId":"368","leaf":true,"level":2,"nodeType":"def","questionId":"368","status":"","title":"最大整除子集","titleSlug":"largest-divisible-subset"},{"formTitle":"[369]给单链表加一","frontendQuestionId":"369","leaf":true,"level":2,"nodeType":"def","questionId":"369","status":"lock","title":"给单链表加一","titleSlug":"plus-one-linked-list"},{"formTitle":"[370]区间加法","frontendQuestionId":"370","leaf":true,"level":2,"nodeType":"def","questionId":"370","status":"lock","title":"区间加法","titleSlug":"range-addition"},{"formTitle":"[371]两整数之和","frontendQuestionId":"371","leaf":true,"level":1,"nodeType":"def","questionId":"371","status":"","title":"两整数之和","titleSlug":"sum-of-two-integers"},{"formTitle":"[372]超级次方","frontendQuestionId":"372","leaf":true,"level":2,"nodeType":"def","questionId":"372","status":"","title":"超级次方","titleSlug":"super-pow"},{"formTitle":"[373]查找和最小的K对数字","frontendQuestionId":"373","leaf":true,"level":2,"nodeType":"def","questionId":"373","status":"","title":"查找和最小的K对数字","titleSlug":"find-k-pairs-with-smallest-sums"},{"formTitle":"[374]猜数字大小","frontendQuestionId":"374","leaf":true,"level":1,"nodeType":"def","questionId":"374","status":"","title":"猜数字大小","titleSlug":"guess-number-higher-or-lower"},{"formTitle":"[375]猜数字大小 II","frontendQuestionId":"375","leaf":true,"level":2,"nodeType":"def","questionId":"375","status":"","title":"猜数字大小 II","titleSlug":"guess-number-higher-or-lower-ii"},{"formTitle":"[376]摆动序列","frontendQuestionId":"376","leaf":true,"level":2,"nodeType":"def","questionId":"376","status":"","title":"摆动序列","titleSlug":"wiggle-subsequence"},{"formTitle":"[377]组合总和 Ⅳ","frontendQuestionId":"377","leaf":true,"level":2,"nodeType":"def","questionId":"377","status":"","title":"组合总和 Ⅳ","titleSlug":"combination-sum-iv"},{"formTitle":"[378]有序矩阵中第K小的元素","frontendQuestionId":"378","leaf":true,"level":2,"nodeType":"def","questionId":"378","status":"","title":"有序矩阵中第K小的元素","titleSlug":"kth-smallest-element-in-a-sorted-matrix"},{"formTitle":"[379]电话目录管理系统","frontendQuestionId":"379","leaf":true,"level":2,"nodeType":"def","questionId":"379","status":"lock","title":"电话目录管理系统","titleSlug":"design-phone-directory"},{"formTitle":"[380]常数时间插入、删除和获取随机元素","frontendQuestionId":"380","leaf":true,"level":2,"nodeType":"def","questionId":"380","status":"","title":"常数时间插入、删除和获取随机元素","titleSlug":"insert-delete-getrandom-o1"},{"formTitle":"[381]O(1) 时间插入、删除和获取随机元素 - 允许重复","frontendQuestionId":"381","leaf":true,"level":3,"nodeType":"def","questionId":"381","status":"","title":"O(1) 时间插入、删除和获取随机元素 - 允许重复","titleSlug":"insert-delete-getrandom-o1-duplicates-allowed"},{"formTitle":"[382]链表随机节点","frontendQuestionId":"382","leaf":true,"level":2,"nodeType":"def","questionId":"382","status":"","title":"链表随机节点","titleSlug":"linked-list-random-node"},{"formTitle":"[383]赎金信","frontendQuestionId":"383","leaf":true,"level":1,"nodeType":"def","questionId":"383","status":"","title":"赎金信","titleSlug":"ransom-note"},{"formTitle":"[384]打乱数组","frontendQuestionId":"384","leaf":true,"level":2,"nodeType":"def","questionId":"384","status":"","title":"打乱数组","titleSlug":"shuffle-an-array"},{"formTitle":"[385]迷你语法分析器","frontendQuestionId":"385","leaf":true,"level":2,"nodeType":"def","questionId":"385","status":"","title":"迷你语法分析器","titleSlug":"mini-parser"},{"formTitle":"[386]字典序排数","frontendQuestionId":"386","leaf":true,"level":2,"nodeType":"def","questionId":"386","status":"","title":"字典序排数","titleSlug":"lexicographical-numbers"},{"formTitle":"[387]字符串中的第一个唯一字符","frontendQuestionId":"387","leaf":true,"level":1,"nodeType":"def","questionId":"387","status":"","title":"字符串中的第一个唯一字符","titleSlug":"first-unique-character-in-a-string"},{"formTitle":"[388]文件的最长绝对路径","frontendQuestionId":"388","leaf":true,"level":2,"nodeType":"def","questionId":"388","status":"","title":"文件的最长绝对路径","titleSlug":"longest-absolute-file-path"},{"formTitle":"[389]找不同","frontendQuestionId":"389","leaf":true,"level":1,"nodeType":"def","questionId":"389","status":"","title":"找不同","titleSlug":"find-the-difference"},{"formTitle":"[390]消除游戏","frontendQuestionId":"390","leaf":true,"level":2,"nodeType":"def","questionId":"390","status":"","title":"消除游戏","titleSlug":"elimination-game"},{"formTitle":"[391]完美矩形","frontendQuestionId":"391","leaf":true,"level":3,"nodeType":"def","questionId":"391","status":"","title":"完美矩形","titleSlug":"perfect-rectangle"},{"formTitle":"[392]判断子序列","frontendQuestionId":"392","leaf":true,"level":1,"nodeType":"def","questionId":"392","status":"","title":"判断子序列","titleSlug":"is-subsequence"},{"formTitle":"[393]UTF-8 编码验证","frontendQuestionId":"393","leaf":true,"level":2,"nodeType":"def","questionId":"393","status":"","title":"UTF-8 编码验证","titleSlug":"utf-8-validation"},{"formTitle":"[394]字符串解码","frontendQuestionId":"394","leaf":true,"level":2,"nodeType":"def","questionId":"394","status":"","title":"字符串解码","titleSlug":"decode-string"},{"formTitle":"[395]至少有K个重复字符的最长子串","frontendQuestionId":"395","leaf":true,"level":2,"nodeType":"def","questionId":"395","status":"","title":"至少有K个重复字符的最长子串","titleSlug":"longest-substring-with-at-least-k-repeating-characters"},{"formTitle":"[396]旋转函数","frontendQuestionId":"396","leaf":true,"level":2,"nodeType":"def","questionId":"396","status":"","title":"旋转函数","titleSlug":"rotate-function"},{"formTitle":"[397]整数替换","frontendQuestionId":"397","leaf":true,"level":2,"nodeType":"def","questionId":"397","status":"","title":"整数替换","titleSlug":"integer-replacement"},{"formTitle":"[398]随机数索引","frontendQuestionId":"398","leaf":true,"level":2,"nodeType":"def","questionId":"398","status":"","title":"随机数索引","titleSlug":"random-pick-index"},{"formTitle":"[399]除法求值","frontendQuestionId":"399","leaf":true,"level":2,"nodeType":"def","questionId":"399","status":"","title":"除法求值","titleSlug":"evaluate-division"},{"formTitle":"[400]第N个数字","frontendQuestionId":"400","leaf":true,"level":2,"nodeType":"def","questionId":"400","status":"","title":"第N个数字","titleSlug":"nth-digit"},{"formTitle":"[401]二进制手表","frontendQuestionId":"401","leaf":true,"level":1,"nodeType":"def","questionId":"401","status":"","title":"二进制手表","titleSlug":"binary-watch"},{"formTitle":"[402]移掉K位数字","frontendQuestionId":"402","leaf":true,"level":2,"nodeType":"def","questionId":"402","status":"","title":"移掉K位数字","titleSlug":"remove-k-digits"},{"formTitle":"[403]青蛙过河","frontendQuestionId":"403","leaf":true,"level":3,"nodeType":"def","questionId":"403","status":"","title":"青蛙过河","titleSlug":"frog-jump"},{"formTitle":"[404]左叶子之和","frontendQuestionId":"404","leaf":true,"level":1,"nodeType":"def","questionId":"404","status":"","title":"左叶子之和","titleSlug":"sum-of-left-leaves"},{"formTitle":"[405]数字转换为十六进制数","frontendQuestionId":"405","leaf":true,"level":1,"nodeType":"def","questionId":"405","status":"","title":"数字转换为十六进制数","titleSlug":"convert-a-number-to-hexadecimal"},{"formTitle":"[406]根据身高重建队列","frontendQuestionId":"406","leaf":true,"level":2,"nodeType":"def","questionId":"406","status":"","title":"根据身高重建队列","titleSlug":"queue-reconstruction-by-height"},{"formTitle":"[407]接雨水 II","frontendQuestionId":"407","leaf":true,"level":3,"nodeType":"def","questionId":"407","status":"","title":"接雨水 II","titleSlug":"trapping-rain-water-ii"},{"formTitle":"[408]有效单词缩写","frontendQuestionId":"408","leaf":true,"level":1,"nodeType":"def","questionId":"408","status":"lock","title":"有效单词缩写","titleSlug":"valid-word-abbreviation"},{"formTitle":"[409]最长回文串","frontendQuestionId":"409","leaf":true,"level":1,"nodeType":"def","questionId":"409","status":"","title":"最长回文串","titleSlug":"longest-palindrome"},{"formTitle":"[410]分割数组的最大值","frontendQuestionId":"410","leaf":true,"level":3,"nodeType":"def","questionId":"410","status":"","title":"分割数组的最大值","titleSlug":"split-array-largest-sum"},{"formTitle":"[411]最短特异单词缩写","frontendQuestionId":"411","leaf":true,"level":3,"nodeType":"def","questionId":"411","status":"lock","title":"最短特异单词缩写","titleSlug":"minimum-unique-word-abbreviation"},{"formTitle":"[412]Fizz Buzz","frontendQuestionId":"412","leaf":true,"level":1,"nodeType":"def","questionId":"412","status":"","title":"Fizz Buzz","titleSlug":"fizz-buzz"},{"formTitle":"[413]等差数列划分","frontendQuestionId":"413","leaf":true,"level":2,"nodeType":"def","questionId":"413","status":"","title":"等差数列划分","titleSlug":"arithmetic-slices"},{"formTitle":"[414]第三大的数","frontendQuestionId":"414","leaf":true,"level":1,"nodeType":"def","questionId":"414","status":"","title":"第三大的数","titleSlug":"third-maximum-number"},{"formTitle":"[415]字符串相加","frontendQuestionId":"415","leaf":true,"level":1,"nodeType":"def","questionId":"415","status":"","title":"字符串相加","titleSlug":"add-strings"},{"formTitle":"[416]分割等和子集","frontendQuestionId":"416","leaf":true,"level":2,"nodeType":"def","questionId":"416","status":"","title":"分割等和子集","titleSlug":"partition-equal-subset-sum"},{"formTitle":"[417]太平洋大西洋水流问题","frontendQuestionId":"417","leaf":true,"level":2,"nodeType":"def","questionId":"417","status":"","title":"太平洋大西洋水流问题","titleSlug":"pacific-atlantic-water-flow"},{"formTitle":"[418]屏幕可显示句子的数量","frontendQuestionId":"418","leaf":true,"level":2,"nodeType":"def","questionId":"418","status":"lock","title":"屏幕可显示句子的数量","titleSlug":"sentence-screen-fitting"},{"formTitle":"[419]甲板上的战舰","frontendQuestionId":"419","leaf":true,"level":2,"nodeType":"def","questionId":"419","status":"","title":"甲板上的战舰","titleSlug":"battleships-in-a-board"},{"formTitle":"[420]强密码检验器","frontendQuestionId":"420","leaf":true,"level":3,"nodeType":"def","questionId":"420","status":"","title":"强密码检验器","titleSlug":"strong-password-checker"},{"formTitle":"[421]数组中两个数的最大异或值","frontendQuestionId":"421","leaf":true,"level":2,"nodeType":"def","questionId":"421","status":"","title":"数组中两个数的最大异或值","titleSlug":"maximum-xor-of-two-numbers-in-an-array"},{"formTitle":"[422]有效的单词方块","frontendQuestionId":"422","leaf":true,"level":1,"nodeType":"def","questionId":"422","status":"lock","title":"有效的单词方块","titleSlug":"valid-word-square"},{"formTitle":"[423]从英文中重建数字","frontendQuestionId":"423","leaf":true,"level":2,"nodeType":"def","questionId":"423","status":"","title":"从英文中重建数字","titleSlug":"reconstruct-original-digits-from-english"},{"formTitle":"[424]替换后的最长重复字符","frontendQuestionId":"424","leaf":true,"level":2,"nodeType":"def","questionId":"424","status":"","title":"替换后的最长重复字符","titleSlug":"longest-repeating-character-replacement"},{"formTitle":"[425]单词方块","frontendQuestionId":"425","leaf":true,"level":3,"nodeType":"def","questionId":"425","status":"lock","title":"单词方块","titleSlug":"word-squares"},{"formTitle":"[426]将二叉搜索树转化为排序的双向链表","frontendQuestionId":"426","leaf":true,"level":2,"nodeType":"def","questionId":"758","status":"lock","title":"将二叉搜索树转化为排序的双向链表","titleSlug":"convert-binary-search-tree-to-sorted-doubly-linked-list"},{"formTitle":"[427]建立四叉树","frontendQuestionId":"427","leaf":true,"level":2,"nodeType":"def","questionId":"772","status":"","title":"建立四叉树","titleSlug":"construct-quad-tree"},{"formTitle":"[428]序列化和反序列化 N 叉树","frontendQuestionId":"428","leaf":true,"level":3,"nodeType":"def","questionId":"765","status":"lock","title":"序列化和反序列化 N 叉树","titleSlug":"serialize-and-deserialize-n-ary-tree"},{"formTitle":"[429]N叉树的层序遍历","frontendQuestionId":"429","leaf":true,"level":1,"nodeType":"def","questionId":"764","status":"","title":"N叉树的层序遍历","titleSlug":"n-ary-tree-level-order-traversal"},{"formTitle":"[430]扁平化多级双向链表","frontendQuestionId":"430","leaf":true,"level":2,"nodeType":"def","questionId":"766","status":"","title":"扁平化多级双向链表","titleSlug":"flatten-a-multilevel-doubly-linked-list"},{"formTitle":"[431]将 N 叉树编码为二叉树","frontendQuestionId":"431","leaf":true,"level":3,"nodeType":"def","questionId":"771","status":"lock","title":"将 N 叉树编码为二叉树","titleSlug":"encode-n-ary-tree-to-binary-tree"},{"formTitle":"[432]全 O(1) 的数据结构","frontendQuestionId":"432","leaf":true,"level":3,"nodeType":"def","questionId":"432","status":"","title":"全 O(1) 的数据结构","titleSlug":"all-oone-data-structure"},{"formTitle":"[433]最小基因变化","frontendQuestionId":"433","leaf":true,"level":2,"nodeType":"def","questionId":"433","status":"","title":"最小基因变化","titleSlug":"minimum-genetic-mutation"},{"formTitle":"[434]字符串中的单词数","frontendQuestionId":"434","leaf":true,"level":1,"nodeType":"def","questionId":"434","status":"","title":"字符串中的单词数","titleSlug":"number-of-segments-in-a-string"},{"formTitle":"[435]无重叠区间","frontendQuestionId":"435","leaf":true,"level":2,"nodeType":"def","questionId":"435","status":"","title":"无重叠区间","titleSlug":"non-overlapping-intervals"},{"formTitle":"[436]寻找右区间","frontendQuestionId":"436","leaf":true,"level":2,"nodeType":"def","questionId":"436","status":"","title":"寻找右区间","titleSlug":"find-right-interval"},{"formTitle":"[437]路径总和 III","frontendQuestionId":"437","leaf":true,"level":1,"nodeType":"def","questionId":"437","status":"","title":"路径总和 III","titleSlug":"path-sum-iii"},{"formTitle":"[438]找到字符串中所有字母异位词","frontendQuestionId":"438","leaf":true,"level":2,"nodeType":"def","questionId":"438","status":"ac","title":"找到字符串中所有字母异位词","titleSlug":"find-all-anagrams-in-a-string"},{"formTitle":"[439]三元表达式解析器","frontendQuestionId":"439","leaf":true,"level":2,"nodeType":"def","questionId":"439","status":"lock","title":"三元表达式解析器","titleSlug":"ternary-expression-parser"},{"formTitle":"[440]字典序的第K小数字","frontendQuestionId":"440","leaf":true,"level":3,"nodeType":"def","questionId":"440","status":"","title":"字典序的第K小数字","titleSlug":"k-th-smallest-in-lexicographical-order"},{"formTitle":"[441]排列硬币","frontendQuestionId":"441","leaf":true,"level":1,"nodeType":"def","questionId":"441","status":"","title":"排列硬币","titleSlug":"arranging-coins"},{"formTitle":"[442]数组中重复的数据","frontendQuestionId":"442","leaf":true,"level":2,"nodeType":"def","questionId":"442","status":"","title":"数组中重复的数据","titleSlug":"find-all-duplicates-in-an-array"},{"formTitle":"[443]压缩字符串","frontendQuestionId":"443","leaf":true,"level":1,"nodeType":"def","questionId":"443","status":"","title":"压缩字符串","titleSlug":"string-compression"},{"formTitle":"[444]序列重建","frontendQuestionId":"444","leaf":true,"level":2,"nodeType":"def","questionId":"444","status":"lock","title":"序列重建","titleSlug":"sequence-reconstruction"},{"formTitle":"[445]两数相加 II","frontendQuestionId":"445","leaf":true,"level":2,"nodeType":"def","questionId":"445","status":"","title":"两数相加 II","titleSlug":"add-two-numbers-ii"},{"formTitle":"[446]等差数列划分 II - 子序列","frontendQuestionId":"446","leaf":true,"level":3,"nodeType":"def","questionId":"446","status":"","title":"等差数列划分 II - 子序列","titleSlug":"arithmetic-slices-ii-subsequence"},{"formTitle":"[447]回旋镖的数量","frontendQuestionId":"447","leaf":true,"level":1,"nodeType":"def","questionId":"447","status":"","title":"回旋镖的数量","titleSlug":"number-of-boomerangs"},{"formTitle":"[448]找到所有数组中消失的数字","frontendQuestionId":"448","leaf":true,"level":1,"nodeType":"def","questionId":"448","status":"","title":"找到所有数组中消失的数字","titleSlug":"find-all-numbers-disappeared-in-an-array"},{"formTitle":"[449]序列化和反序列化二叉搜索树","frontendQuestionId":"449","leaf":true,"level":2,"nodeType":"def","questionId":"449","status":"","title":"序列化和反序列化二叉搜索树","titleSlug":"serialize-and-deserialize-bst"},{"formTitle":"[450]删除二叉搜索树中的节点","frontendQuestionId":"450","leaf":true,"level":2,"nodeType":"def","questionId":"450","status":"","title":"删除二叉搜索树中的节点","titleSlug":"delete-node-in-a-bst"},{"formTitle":"[451]根据字符出现频率排序","frontendQuestionId":"451","leaf":true,"level":2,"nodeType":"def","questionId":"451","status":"ac","title":"根据字符出现频率排序","titleSlug":"sort-characters-by-frequency"},{"formTitle":"[452]用最少数量的箭引爆气球","frontendQuestionId":"452","leaf":true,"level":2,"nodeType":"def","questionId":"452","status":"","title":"用最少数量的箭引爆气球","titleSlug":"minimum-number-of-arrows-to-burst-balloons"},{"formTitle":"[453]最小移动次数使数组元素相等","frontendQuestionId":"453","leaf":true,"level":1,"nodeType":"def","questionId":"453","status":"","title":"最小移动次数使数组元素相等","titleSlug":"minimum-moves-to-equal-array-elements"},{"formTitle":"[454]四数相加 II","frontendQuestionId":"454","leaf":true,"level":2,"nodeType":"def","questionId":"454","status":"","title":"四数相加 II","titleSlug":"4sum-ii"},{"formTitle":"[455]分发饼干","frontendQuestionId":"455","leaf":true,"level":1,"nodeType":"def","questionId":"455","status":"","title":"分发饼干","titleSlug":"assign-cookies"},{"formTitle":"[456]132模式","frontendQuestionId":"456","leaf":true,"level":2,"nodeType":"def","questionId":"456","status":"","title":"132模式","titleSlug":"132-pattern"},{"formTitle":"[457]环形数组循环","frontendQuestionId":"457","leaf":true,"level":2,"nodeType":"def","questionId":"457","status":"","title":"环形数组循环","titleSlug":"circular-array-loop"},{"formTitle":"[458]可怜的小猪","frontendQuestionId":"458","leaf":true,"level":3,"nodeType":"def","questionId":"458","status":"","title":"可怜的小猪","titleSlug":"poor-pigs"},{"formTitle":"[459]重复的子字符串","frontendQuestionId":"459","leaf":true,"level":1,"nodeType":"def","questionId":"459","status":"","title":"重复的子字符串","titleSlug":"repeated-substring-pattern"},{"formTitle":"[460]LFU缓存","frontendQuestionId":"460","leaf":true,"level":3,"nodeType":"def","questionId":"460","status":"","title":"LFU缓存","titleSlug":"lfu-cache"},{"formTitle":"[461]汉明距离","frontendQuestionId":"461","leaf":true,"level":1,"nodeType":"def","questionId":"461","status":"","title":"汉明距离","titleSlug":"hamming-distance"},{"formTitle":"[462]最少移动次数使数组元素相等 II","frontendQuestionId":"462","leaf":true,"level":2,"nodeType":"def","questionId":"462","status":"","title":"最少移动次数使数组元素相等 II","titleSlug":"minimum-moves-to-equal-array-elements-ii"},{"formTitle":"[463]岛屿的周长","frontendQuestionId":"463","leaf":true,"level":1,"nodeType":"def","questionId":"463","status":"","title":"岛屿的周长","titleSlug":"island-perimeter"},{"formTitle":"[464]我能赢吗","frontendQuestionId":"464","leaf":true,"level":2,"nodeType":"def","questionId":"464","status":"","title":"我能赢吗","titleSlug":"can-i-win"},{"formTitle":"[465]最优账单平衡","frontendQuestionId":"465","leaf":true,"level":3,"nodeType":"def","questionId":"465","status":"lock","title":"最优账单平衡","titleSlug":"optimal-account-balancing"},{"formTitle":"[466]统计重复个数","frontendQuestionId":"466","leaf":true,"level":3,"nodeType":"def","questionId":"466","status":"","title":"统计重复个数","titleSlug":"count-the-repetitions"},{"formTitle":"[467]环绕字符串中唯一的子字符串","frontendQuestionId":"467","leaf":true,"level":2,"nodeType":"def","questionId":"467","status":"","title":"环绕字符串中唯一的子字符串","titleSlug":"unique-substrings-in-wraparound-string"},{"formTitle":"[468]验证IP地址","frontendQuestionId":"468","leaf":true,"level":2,"nodeType":"def","questionId":"468","status":"","title":"验证IP地址","titleSlug":"validate-ip-address"},{"formTitle":"[469]凸多边形","frontendQuestionId":"469","leaf":true,"level":2,"nodeType":"def","questionId":"469","status":"lock","title":"凸多边形","titleSlug":"convex-polygon"},{"formTitle":"[470]用 Rand7() 实现 Rand10()","frontendQuestionId":"470","leaf":true,"level":2,"nodeType":"def","questionId":"903","status":"","title":"用 Rand7() 实现 Rand10()","titleSlug":"implement-rand10-using-rand7"},{"formTitle":"[471]编码最短长度的字符串","frontendQuestionId":"471","leaf":true,"level":3,"nodeType":"def","questionId":"471","status":"lock","title":"编码最短长度的字符串","titleSlug":"encode-string-with-shortest-length"},{"formTitle":"[472]连接词","frontendQuestionId":"472","leaf":true,"level":3,"nodeType":"def","questionId":"472","status":"","title":"连接词","titleSlug":"concatenated-words"},{"formTitle":"[473]火柴拼正方形","frontendQuestionId":"473","leaf":true,"level":2,"nodeType":"def","questionId":"473","status":"","title":"火柴拼正方形","titleSlug":"matchsticks-to-square"},{"formTitle":"[474]一和零","frontendQuestionId":"474","leaf":true,"level":2,"nodeType":"def","questionId":"474","status":"","title":"一和零","titleSlug":"ones-and-zeroes"},{"formTitle":"[475]供暖器","frontendQuestionId":"475","leaf":true,"level":1,"nodeType":"def","questionId":"475","status":"","title":"供暖器","titleSlug":"heaters"},{"formTitle":"[476]数字的补数","frontendQuestionId":"476","leaf":true,"level":1,"nodeType":"def","questionId":"476","status":"","title":"数字的补数","titleSlug":"number-complement"},{"formTitle":"[477]汉明距离总和","frontendQuestionId":"477","leaf":true,"level":2,"nodeType":"def","questionId":"477","status":"","title":"汉明距离总和","titleSlug":"total-hamming-distance"},{"formTitle":"[478]在圆内随机生成点","frontendQuestionId":"478","leaf":true,"level":2,"nodeType":"def","questionId":"915","status":"","title":"在圆内随机生成点","titleSlug":"generate-random-point-in-a-circle"},{"formTitle":"[479]最大回文数乘积","frontendQuestionId":"479","leaf":true,"level":3,"nodeType":"def","questionId":"479","status":"","title":"最大回文数乘积","titleSlug":"largest-palindrome-product"},{"formTitle":"[480]滑动窗口中位数","frontendQuestionId":"480","leaf":true,"level":3,"nodeType":"def","questionId":"480","status":"","title":"滑动窗口中位数","titleSlug":"sliding-window-median"},{"formTitle":"[481]神奇字符串","frontendQuestionId":"481","leaf":true,"level":2,"nodeType":"def","questionId":"481","status":"","title":"神奇字符串","titleSlug":"magical-string"},{"formTitle":"[482]密钥格式化","frontendQuestionId":"482","leaf":true,"level":1,"nodeType":"def","questionId":"482","status":"","title":"密钥格式化","titleSlug":"license-key-formatting"},{"formTitle":"[483]最小好进制","frontendQuestionId":"483","leaf":true,"level":3,"nodeType":"def","questionId":"483","status":"","title":"最小好进制","titleSlug":"smallest-good-base"},{"formTitle":"[484]寻找排列","frontendQuestionId":"484","leaf":true,"level":2,"nodeType":"def","questionId":"484","status":"lock","title":"寻找排列","titleSlug":"find-permutation"},{"formTitle":"[485]最大连续1的个数","frontendQuestionId":"485","leaf":true,"level":1,"nodeType":"def","questionId":"485","status":"","title":"最大连续1的个数","titleSlug":"max-consecutive-ones"},{"formTitle":"[486]预测赢家","frontendQuestionId":"486","leaf":true,"level":2,"nodeType":"def","questionId":"486","status":"","title":"预测赢家","titleSlug":"predict-the-winner"},{"formTitle":"[487]最大连续1的个数 II","frontendQuestionId":"487","leaf":true,"level":2,"nodeType":"def","questionId":"487","status":"lock","title":"最大连续1的个数 II","titleSlug":"max-consecutive-ones-ii"},{"formTitle":"[488]祖玛游戏","frontendQuestionId":"488","leaf":true,"level":3,"nodeType":"def","questionId":"488","status":"","title":"祖玛游戏","titleSlug":"zuma-game"},{"formTitle":"[489]扫地机器人","frontendQuestionId":"489","leaf":true,"level":3,"nodeType":"def","questionId":"865","status":"lock","title":"扫地机器人","titleSlug":"robot-room-cleaner"},{"formTitle":"[490]迷宫","frontendQuestionId":"490","leaf":true,"level":2,"nodeType":"def","questionId":"490","status":"lock","title":"迷宫","titleSlug":"the-maze"},{"formTitle":"[491]递增子序列","frontendQuestionId":"491","leaf":true,"level":2,"nodeType":"def","questionId":"491","status":"","title":"递增子序列","titleSlug":"increasing-subsequences"},{"formTitle":"[492]构造矩形","frontendQuestionId":"492","leaf":true,"level":1,"nodeType":"def","questionId":"492","status":"","title":"构造矩形","titleSlug":"construct-the-rectangle"},{"formTitle":"[493]翻转对","frontendQuestionId":"493","leaf":true,"level":3,"nodeType":"def","questionId":"493","status":"","title":"翻转对","titleSlug":"reverse-pairs"},{"formTitle":"[494]目标和","frontendQuestionId":"494","leaf":true,"level":2,"nodeType":"def","questionId":"494","status":"","title":"目标和","titleSlug":"target-sum"},{"formTitle":"[495]提莫攻击","frontendQuestionId":"495","leaf":true,"level":2,"nodeType":"def","questionId":"495","status":"","title":"提莫攻击","titleSlug":"teemo-attacking"},{"formTitle":"[496]下一个更大元素 I","frontendQuestionId":"496","leaf":true,"level":1,"nodeType":"def","questionId":"496","status":"","title":"下一个更大元素 I","titleSlug":"next-greater-element-i"},{"formTitle":"[497]非重叠矩形中的随机点","frontendQuestionId":"497","leaf":true,"level":2,"nodeType":"def","questionId":"914","status":"","title":"非重叠矩形中的随机点","titleSlug":"random-point-in-non-overlapping-rectangles"},{"formTitle":"[498]对角线遍历","frontendQuestionId":"498","leaf":true,"level":2,"nodeType":"def","questionId":"498","status":"","title":"对角线遍历","titleSlug":"diagonal-traverse"},{"formTitle":"[499]迷宫 III","frontendQuestionId":"499","leaf":true,"level":3,"nodeType":"def","questionId":"499","status":"lock","title":"迷宫 III","titleSlug":"the-maze-iii"},{"formTitle":"[500]键盘行","frontendQuestionId":"500","leaf":true,"level":1,"nodeType":"def","questionId":"500","status":"","title":"键盘行","titleSlug":"keyboard-row"},{"formTitle":"[501]二叉搜索树中的众数","frontendQuestionId":"501","leaf":true,"level":1,"nodeType":"def","questionId":"501","status":"","title":"二叉搜索树中的众数","titleSlug":"find-mode-in-binary-search-tree"},{"formTitle":"[502]IPO","frontendQuestionId":"502","leaf":true,"level":3,"nodeType":"def","questionId":"502","status":"","title":"IPO","titleSlug":"ipo"},{"formTitle":"[503]下一个更大元素 II","frontendQuestionId":"503","leaf":true,"level":2,"nodeType":"def","questionId":"503","status":"","title":"下一个更大元素 II","titleSlug":"next-greater-element-ii"},{"formTitle":"[504]七进制数","frontendQuestionId":"504","leaf":true,"level":1,"nodeType":"def","questionId":"504","status":"","title":"七进制数","titleSlug":"base-7"},{"formTitle":"[505]迷宫 II","frontendQuestionId":"505","leaf":true,"level":2,"nodeType":"def","questionId":"505","status":"lock","title":"迷宫 II","titleSlug":"the-maze-ii"},{"formTitle":"[506]相对名次","frontendQuestionId":"506","leaf":true,"level":1,"nodeType":"def","questionId":"506","status":"","title":"相对名次","titleSlug":"relative-ranks"},{"formTitle":"[507]完美数","frontendQuestionId":"507","leaf":true,"level":1,"nodeType":"def","questionId":"507","status":"","title":"完美数","titleSlug":"perfect-number"},{"formTitle":"[508]出现次数最多的子树元素和","frontendQuestionId":"508","leaf":true,"level":2,"nodeType":"def","questionId":"508","status":"","title":"出现次数最多的子树元素和","titleSlug":"most-frequent-subtree-sum"},{"formTitle":"[509]斐波那契数","frontendQuestionId":"509","leaf":true,"level":1,"nodeType":"def","questionId":"1013","status":"ac","title":"斐波那契数","titleSlug":"fibonacci-number"},{"formTitle":"[510]二叉搜索树中的中序后继 II","frontendQuestionId":"510","leaf":true,"level":2,"nodeType":"def","questionId":"509","status":"lock","title":"二叉搜索树中的中序后继 II","titleSlug":"inorder-successor-in-bst-ii"},{"formTitle":"[511]游戏玩法分析 I","frontendQuestionId":"511","leaf":true,"level":1,"nodeType":"def","questionId":"1179","status":"lock","title":"游戏玩法分析 I","titleSlug":"game-play-analysis-i"},{"formTitle":"[512]游戏玩法分析 II","frontendQuestionId":"512","leaf":true,"level":1,"nodeType":"def","questionId":"1180","status":"lock","title":"游戏玩法分析 II","titleSlug":"game-play-analysis-ii"},{"formTitle":"[513]找树左下角的值","frontendQuestionId":"513","leaf":true,"level":2,"nodeType":"def","questionId":"513","status":"","title":"找树左下角的值","titleSlug":"find-bottom-left-tree-value"},{"formTitle":"[514]自由之路","frontendQuestionId":"514","leaf":true,"level":3,"nodeType":"def","questionId":"514","status":"","title":"自由之路","titleSlug":"freedom-trail"},{"formTitle":"[515]在每个树行中找最大值","frontendQuestionId":"515","leaf":true,"level":2,"nodeType":"def","questionId":"515","status":"","title":"在每个树行中找最大值","titleSlug":"find-largest-value-in-each-tree-row"},{"formTitle":"[516]最长回文子序列","frontendQuestionId":"516","leaf":true,"level":2,"nodeType":"def","questionId":"516","status":"","title":"最长回文子序列","titleSlug":"longest-palindromic-subsequence"},{"formTitle":"[517]超级洗衣机","frontendQuestionId":"517","leaf":true,"level":3,"nodeType":"def","questionId":"517","status":"","title":"超级洗衣机","titleSlug":"super-washing-machines"},{"formTitle":"[518]零钱兑换 II","frontendQuestionId":"518","leaf":true,"level":2,"nodeType":"def","questionId":"518","status":"","title":"零钱兑换 II","titleSlug":"coin-change-2"},{"formTitle":"[519]随机翻转矩阵","frontendQuestionId":"519","leaf":true,"level":2,"nodeType":"def","questionId":"913","status":"","title":"随机翻转矩阵","titleSlug":"random-flip-matrix"},{"formTitle":"[520]检测大写字母","frontendQuestionId":"520","leaf":true,"level":1,"nodeType":"def","questionId":"520","status":"","title":"检测大写字母","titleSlug":"detect-capital"},{"formTitle":"[521]最长特殊序列 Ⅰ","frontendQuestionId":"521","leaf":true,"level":1,"nodeType":"def","questionId":"521","status":"","title":"最长特殊序列 Ⅰ","titleSlug":"longest-uncommon-subsequence-i"},{"formTitle":"[522]最长特殊序列 II","frontendQuestionId":"522","leaf":true,"level":2,"nodeType":"def","questionId":"522","status":"","title":"最长特殊序列 II","titleSlug":"longest-uncommon-subsequence-ii"},{"formTitle":"[523]连续的子数组和","frontendQuestionId":"523","leaf":true,"level":2,"nodeType":"def","questionId":"523","status":"","title":"连续的子数组和","titleSlug":"continuous-subarray-sum"},{"formTitle":"[524]通过删除字母匹配到字典里最长单词","frontendQuestionId":"524","leaf":true,"level":2,"nodeType":"def","questionId":"524","status":"","title":"通过删除字母匹配到字典里最长单词","titleSlug":"longest-word-in-dictionary-through-deleting"},{"formTitle":"[525]连续数组","frontendQuestionId":"525","leaf":true,"level":2,"nodeType":"def","questionId":"525","status":"","title":"连续数组","titleSlug":"contiguous-array"},{"formTitle":"[526]优美的排列","frontendQuestionId":"526","leaf":true,"level":2,"nodeType":"def","questionId":"526","status":"","title":"优美的排列","titleSlug":"beautiful-arrangement"},{"formTitle":"[527]单词缩写","frontendQuestionId":"527","leaf":true,"level":3,"nodeType":"def","questionId":"527","status":"lock","title":"单词缩写","titleSlug":"word-abbreviation"},{"formTitle":"[528]按权重随机选择","frontendQuestionId":"528","leaf":true,"level":2,"nodeType":"def","questionId":"912","status":"","title":"按权重随机选择","titleSlug":"random-pick-with-weight"},{"formTitle":"[529]扫雷游戏","frontendQuestionId":"529","leaf":true,"level":2,"nodeType":"def","questionId":"529","status":"","title":"扫雷游戏","titleSlug":"minesweeper"},{"formTitle":"[530]二叉搜索树的最小绝对差","frontendQuestionId":"530","leaf":true,"level":1,"nodeType":"def","questionId":"530","status":"","title":"二叉搜索树的最小绝对差","titleSlug":"minimum-absolute-difference-in-bst"},{"formTitle":"[531]孤独像素 I","frontendQuestionId":"531","leaf":true,"level":2,"nodeType":"def","questionId":"531","status":"lock","title":"孤独像素 I","titleSlug":"lonely-pixel-i"},{"formTitle":"[532]数组中的K-diff数对","frontendQuestionId":"532","leaf":true,"level":1,"nodeType":"def","questionId":"532","status":"","title":"数组中的K-diff数对","titleSlug":"k-diff-pairs-in-an-array"},{"formTitle":"[533]孤独像素 II","frontendQuestionId":"533","leaf":true,"level":2,"nodeType":"def","questionId":"533","status":"lock","title":"孤独像素 II","titleSlug":"lonely-pixel-ii"},{"formTitle":"[534]游戏玩法分析 III","frontendQuestionId":"534","leaf":true,"level":2,"nodeType":"def","questionId":"1181","status":"lock","title":"游戏玩法分析 III","titleSlug":"game-play-analysis-iii"},{"formTitle":"[535]TinyURL 的加密与解密","frontendQuestionId":"535","leaf":true,"level":2,"nodeType":"def","questionId":"535","status":"","title":"TinyURL 的加密与解密","titleSlug":"encode-and-decode-tinyurl"},{"formTitle":"[536]从字符串生成二叉树","frontendQuestionId":"536","leaf":true,"level":2,"nodeType":"def","questionId":"536","status":"lock","title":"从字符串生成二叉树","titleSlug":"construct-binary-tree-from-string"},{"formTitle":"[537]复数乘法","frontendQuestionId":"537","leaf":true,"level":2,"nodeType":"def","questionId":"537","status":"","title":"复数乘法","titleSlug":"complex-number-multiplication"},{"formTitle":"[538]把二叉搜索树转换为累加树","frontendQuestionId":"538","leaf":true,"level":1,"nodeType":"def","questionId":"538","status":"","title":"把二叉搜索树转换为累加树","titleSlug":"convert-bst-to-greater-tree"},{"formTitle":"[539]最小时间差","frontendQuestionId":"539","leaf":true,"level":2,"nodeType":"def","questionId":"539","status":"","title":"最小时间差","titleSlug":"minimum-time-difference"},{"formTitle":"[540]有序数组中的单一元素","frontendQuestionId":"540","leaf":true,"level":2,"nodeType":"def","questionId":"540","status":"","title":"有序数组中的单一元素","titleSlug":"single-element-in-a-sorted-array"},{"formTitle":"[541]反转字符串 II","frontendQuestionId":"541","leaf":true,"level":1,"nodeType":"def","questionId":"541","status":"","title":"反转字符串 II","titleSlug":"reverse-string-ii"},{"formTitle":"[542]01 矩阵","frontendQuestionId":"542","leaf":true,"level":2,"nodeType":"def","questionId":"542","status":"","title":"01 矩阵","titleSlug":"01-matrix"},{"formTitle":"[543]二叉树的直径","frontendQuestionId":"543","leaf":true,"level":1,"nodeType":"def","questionId":"543","status":"","title":"二叉树的直径","titleSlug":"diameter-of-binary-tree"},{"formTitle":"[544]输出比赛匹配对","frontendQuestionId":"544","leaf":true,"level":2,"nodeType":"def","questionId":"544","status":"lock","title":"输出比赛匹配对","titleSlug":"output-contest-matches"},{"formTitle":"[545]二叉树的边界","frontendQuestionId":"545","leaf":true,"level":2,"nodeType":"def","questionId":"545","status":"lock","title":"二叉树的边界","titleSlug":"boundary-of-binary-tree"},{"formTitle":"[546]移除盒子","frontendQuestionId":"546","leaf":true,"level":3,"nodeType":"def","questionId":"546","status":"","title":"移除盒子","titleSlug":"remove-boxes"},{"formTitle":"[547]朋友圈","frontendQuestionId":"547","leaf":true,"level":2,"nodeType":"def","questionId":"547","status":"","title":"朋友圈","titleSlug":"friend-circles"},{"formTitle":"[548]将数组分割成和相等的子数组","frontendQuestionId":"548","leaf":true,"level":2,"nodeType":"def","questionId":"548","status":"lock","title":"将数组分割成和相等的子数组","titleSlug":"split-array-with-equal-sum"},{"formTitle":"[549]二叉树中最长的连续序列","frontendQuestionId":"549","leaf":true,"level":2,"nodeType":"def","questionId":"549","status":"lock","title":"二叉树中最长的连续序列","titleSlug":"binary-tree-longest-consecutive-sequence-ii"},{"formTitle":"[550]游戏玩法分析 IV","frontendQuestionId":"550","leaf":true,"level":2,"nodeType":"def","questionId":"1182","status":"lock","title":"游戏玩法分析 IV","titleSlug":"game-play-analysis-iv"},{"formTitle":"[551]学生出勤记录 I","frontendQuestionId":"551","leaf":true,"level":1,"nodeType":"def","questionId":"551","status":"","title":"学生出勤记录 I","titleSlug":"student-attendance-record-i"},{"formTitle":"[552]学生出勤记录 II","frontendQuestionId":"552","leaf":true,"level":3,"nodeType":"def","questionId":"552","status":"","title":"学生出勤记录 II","titleSlug":"student-attendance-record-ii"},{"formTitle":"[553]最优除法","frontendQuestionId":"553","leaf":true,"level":2,"nodeType":"def","questionId":"553","status":"","title":"最优除法","titleSlug":"optimal-division"},{"formTitle":"[554]砖墙","frontendQuestionId":"554","leaf":true,"level":2,"nodeType":"def","questionId":"554","status":"","title":"砖墙","titleSlug":"brick-wall"},{"formTitle":"[555]分割连接字符串","frontendQuestionId":"555","leaf":true,"level":2,"nodeType":"def","questionId":"555","status":"lock","title":"分割连接字符串","titleSlug":"split-concatenated-strings"},{"formTitle":"[556]下一个更大元素 III","frontendQuestionId":"556","leaf":true,"level":2,"nodeType":"def","questionId":"556","status":"","title":"下一个更大元素 III","titleSlug":"next-greater-element-iii"},{"formTitle":"[557]反转字符串中的单词 III","frontendQuestionId":"557","leaf":true,"level":1,"nodeType":"def","questionId":"557","status":"","title":"反转字符串中的单词 III","titleSlug":"reverse-words-in-a-string-iii"},{"formTitle":"[558]四叉树交集","frontendQuestionId":"558","leaf":true,"level":1,"nodeType":"def","questionId":"773","status":"","title":"四叉树交集","titleSlug":"quad-tree-intersection"},{"formTitle":"[559]N叉树的最大深度","frontendQuestionId":"559","leaf":true,"level":1,"nodeType":"def","questionId":"774","status":"","title":"N叉树的最大深度","titleSlug":"maximum-depth-of-n-ary-tree"},{"formTitle":"[560]和为K的子数组","frontendQuestionId":"560","leaf":true,"level":2,"nodeType":"def","questionId":"560","status":"","title":"和为K的子数组","titleSlug":"subarray-sum-equals-k"},{"formTitle":"[561]数组拆分 I","frontendQuestionId":"561","leaf":true,"level":1,"nodeType":"def","questionId":"561","status":"","title":"数组拆分 I","titleSlug":"array-partition-i"},{"formTitle":"[562]矩阵中最长的连续1线段","frontendQuestionId":"562","leaf":true,"level":2,"nodeType":"def","questionId":"562","status":"lock","title":"矩阵中最长的连续1线段","titleSlug":"longest-line-of-consecutive-one-in-matrix"},{"formTitle":"[563]二叉树的坡度","frontendQuestionId":"563","leaf":true,"level":1,"nodeType":"def","questionId":"563","status":"","title":"二叉树的坡度","titleSlug":"binary-tree-tilt"},{"formTitle":"[564]寻找最近的回文数","frontendQuestionId":"564","leaf":true,"level":3,"nodeType":"def","questionId":"564","status":"","title":"寻找最近的回文数","titleSlug":"find-the-closest-palindrome"},{"formTitle":"[565]数组嵌套","frontendQuestionId":"565","leaf":true,"level":2,"nodeType":"def","questionId":"565","status":"","title":"数组嵌套","titleSlug":"array-nesting"},{"formTitle":"[566]重塑矩阵","frontendQuestionId":"566","leaf":true,"level":1,"nodeType":"def","questionId":"566","status":"","title":"重塑矩阵","titleSlug":"reshape-the-matrix"},{"formTitle":"[567]字符串的排列","frontendQuestionId":"567","leaf":true,"level":2,"nodeType":"def","questionId":"567","status":"","title":"字符串的排列","titleSlug":"permutation-in-string"},{"formTitle":"[568]最大休假天数","frontendQuestionId":"568","leaf":true,"level":3,"nodeType":"def","questionId":"568","status":"lock","title":"最大休假天数","titleSlug":"maximum-vacation-days"},{"formTitle":"[569]员工薪水中位数","frontendQuestionId":"569","leaf":true,"level":3,"nodeType":"def","questionId":"569","status":"lock","title":"员工薪水中位数","titleSlug":"median-employee-salary"},{"formTitle":"[570]至少有5名直接下属的经理","frontendQuestionId":"570","leaf":true,"level":2,"nodeType":"def","questionId":"570","status":"lock","title":"至少有5名直接下属的经理","titleSlug":"managers-with-at-least-5-direct-reports"},{"formTitle":"[571]给定数字的频率查询中位数","frontendQuestionId":"571","leaf":true,"level":3,"nodeType":"def","questionId":"571","status":"lock","title":"给定数字的频率查询中位数","titleSlug":"find-median-given-frequency-of-numbers"},{"formTitle":"[572]另一个树的子树","frontendQuestionId":"572","leaf":true,"level":1,"nodeType":"def","questionId":"572","status":"","title":"另一个树的子树","titleSlug":"subtree-of-another-tree"},{"formTitle":"[573]松鼠模拟","frontendQuestionId":"573","leaf":true,"level":2,"nodeType":"def","questionId":"573","status":"lock","title":"松鼠模拟","titleSlug":"squirrel-simulation"},{"formTitle":"[574]当选者","frontendQuestionId":"574","leaf":true,"level":2,"nodeType":"def","questionId":"574","status":"lock","title":"当选者","titleSlug":"winning-candidate"},{"formTitle":"[575]分糖果","frontendQuestionId":"575","leaf":true,"level":1,"nodeType":"def","questionId":"575","status":"","title":"分糖果","titleSlug":"distribute-candies"},{"formTitle":"[576]出界的路径数","frontendQuestionId":"576","leaf":true,"level":2,"nodeType":"def","questionId":"576","status":"","title":"出界的路径数","titleSlug":"out-of-boundary-paths"},{"formTitle":"[577]员工奖金","frontendQuestionId":"577","leaf":true,"level":1,"nodeType":"def","questionId":"577","status":"lock","title":"员工奖金","titleSlug":"employee-bonus"},{"formTitle":"[578]查询回答率最高的问题","frontendQuestionId":"578","leaf":true,"level":2,"nodeType":"def","questionId":"578","status":"lock","title":"查询回答率最高的问题","titleSlug":"get-highest-answer-rate-question"},{"formTitle":"[579]查询员工的累计薪水","frontendQuestionId":"579","leaf":true,"level":3,"nodeType":"def","questionId":"579","status":"lock","title":"查询员工的累计薪水","titleSlug":"find-cumulative-salary-of-an-employee"},{"formTitle":"[580]统计各专业学生人数","frontendQuestionId":"580","leaf":true,"level":2,"nodeType":"def","questionId":"580","status":"lock","title":"统计各专业学生人数","titleSlug":"count-student-number-in-departments"},{"formTitle":"[581]最短无序连续子数组","frontendQuestionId":"581","leaf":true,"level":1,"nodeType":"def","questionId":"581","status":"","title":"最短无序连续子数组","titleSlug":"shortest-unsorted-continuous-subarray"},{"formTitle":"[582]杀死进程","frontendQuestionId":"582","leaf":true,"level":2,"nodeType":"def","questionId":"582","status":"lock","title":"杀死进程","titleSlug":"kill-process"},{"formTitle":"[583]两个字符串的删除操作","frontendQuestionId":"583","leaf":true,"level":2,"nodeType":"def","questionId":"583","status":"","title":"两个字符串的删除操作","titleSlug":"delete-operation-for-two-strings"},{"formTitle":"[584]寻找用户推荐人","frontendQuestionId":"584","leaf":true,"level":1,"nodeType":"def","questionId":"584","status":"lock","title":"寻找用户推荐人","titleSlug":"find-customer-referee"},{"formTitle":"[585]2016年的投资","frontendQuestionId":"585","leaf":true,"level":2,"nodeType":"def","questionId":"585","status":"lock","title":"2016年的投资","titleSlug":"investments-in-2016"},{"formTitle":"[586]订单最多的客户","frontendQuestionId":"586","leaf":true,"level":1,"nodeType":"def","questionId":"586","status":"lock","title":"订单最多的客户","titleSlug":"customer-placing-the-largest-number-of-orders"},{"formTitle":"[587]安装栅栏","frontendQuestionId":"587","leaf":true,"level":3,"nodeType":"def","questionId":"587","status":"","title":"安装栅栏","titleSlug":"erect-the-fence"},{"formTitle":"[588]设计内存文件系统","frontendQuestionId":"588","leaf":true,"level":3,"nodeType":"def","questionId":"588","status":"lock","title":"设计内存文件系统","titleSlug":"design-in-memory-file-system"},{"formTitle":"[589]N叉树的前序遍历","frontendQuestionId":"589","leaf":true,"level":1,"nodeType":"def","questionId":"775","status":"","title":"N叉树的前序遍历","titleSlug":"n-ary-tree-preorder-traversal"},{"formTitle":"[590]N叉树的后序遍历","frontendQuestionId":"590","leaf":true,"level":1,"nodeType":"def","questionId":"776","status":"","title":"N叉树的后序遍历","titleSlug":"n-ary-tree-postorder-traversal"},{"formTitle":"[591]标签验证器","frontendQuestionId":"591","leaf":true,"level":3,"nodeType":"def","questionId":"591","status":"","title":"标签验证器","titleSlug":"tag-validator"},{"formTitle":"[592]分数加减运算","frontendQuestionId":"592","leaf":true,"level":2,"nodeType":"def","questionId":"592","status":"","title":"分数加减运算","titleSlug":"fraction-addition-and-subtraction"},{"formTitle":"[593]有效的正方形","frontendQuestionId":"593","leaf":true,"level":2,"nodeType":"def","questionId":"593","status":"","title":"有效的正方形","titleSlug":"valid-square"},{"formTitle":"[594]最长和谐子序列","frontendQuestionId":"594","leaf":true,"level":1,"nodeType":"def","questionId":"594","status":"","title":"最长和谐子序列","titleSlug":"longest-harmonious-subsequence"},{"formTitle":"[595]大的国家","frontendQuestionId":"595","leaf":true,"level":1,"nodeType":"def","questionId":"595","status":"","title":"大的国家","titleSlug":"big-countries"},{"formTitle":"[596]超过5名学生的课","frontendQuestionId":"596","leaf":true,"level":1,"nodeType":"def","questionId":"596","status":"","title":"超过5名学生的课","titleSlug":"classes-more-than-5-students"},{"formTitle":"[597]好友申请 I :总体通过率","frontendQuestionId":"597","leaf":true,"level":1,"nodeType":"def","questionId":"597","status":"lock","title":"好友申请 I :总体通过率","titleSlug":"friend-requests-i-overall-acceptance-rate"},{"formTitle":"[598]范围求和 II","frontendQuestionId":"598","leaf":true,"level":1,"nodeType":"def","questionId":"598","status":"","title":"范围求和 II","titleSlug":"range-addition-ii"},{"formTitle":"[599]两个列表的最小索引总和","frontendQuestionId":"599","leaf":true,"level":1,"nodeType":"def","questionId":"599","status":"","title":"两个列表的最小索引总和","titleSlug":"minimum-index-sum-of-two-lists"},{"formTitle":"[600]不含连续1的非负整数","frontendQuestionId":"600","leaf":true,"level":3,"nodeType":"def","questionId":"600","status":"","title":"不含连续1的非负整数","titleSlug":"non-negative-integers-without-consecutive-ones"},{"formTitle":"[601]体育馆的人流量","frontendQuestionId":"601","leaf":true,"level":3,"nodeType":"def","questionId":"601","status":"","title":"体育馆的人流量","titleSlug":"human-traffic-of-stadium"},{"formTitle":"[602]好友申请 II :谁有最多的好友","frontendQuestionId":"602","leaf":true,"level":2,"nodeType":"def","questionId":"602","status":"lock","title":"好友申请 II :谁有最多的好友","titleSlug":"friend-requests-ii-who-has-the-most-friends"},{"formTitle":"[603]连续空余座位","frontendQuestionId":"603","leaf":true,"level":1,"nodeType":"def","questionId":"603","status":"lock","title":"连续空余座位","titleSlug":"consecutive-available-seats"},{"formTitle":"[604]迭代压缩字符串","frontendQuestionId":"604","leaf":true,"level":1,"nodeType":"def","questionId":"604","status":"lock","title":"迭代压缩字符串","titleSlug":"design-compressed-string-iterator"},{"formTitle":"[605]种花问题","frontendQuestionId":"605","leaf":true,"level":1,"nodeType":"def","questionId":"605","status":"","title":"种花问题","titleSlug":"can-place-flowers"},{"formTitle":"[606]根据二叉树创建字符串","frontendQuestionId":"606","leaf":true,"level":1,"nodeType":"def","questionId":"606","status":"","title":"根据二叉树创建字符串","titleSlug":"construct-string-from-binary-tree"},{"formTitle":"[607]销售员","frontendQuestionId":"607","leaf":true,"level":1,"nodeType":"def","questionId":"607","status":"lock","title":"销售员","titleSlug":"sales-person"},{"formTitle":"[608]树节点","frontendQuestionId":"608","leaf":true,"level":2,"nodeType":"def","questionId":"608","status":"lock","title":"树节点","titleSlug":"tree-node"},{"formTitle":"[609]在系统中查找重复文件","frontendQuestionId":"609","leaf":true,"level":2,"nodeType":"def","questionId":"609","status":"","title":"在系统中查找重复文件","titleSlug":"find-duplicate-file-in-system"},{"formTitle":"[610]判断三角形","frontendQuestionId":"610","leaf":true,"level":1,"nodeType":"def","questionId":"610","status":"lock","title":"判断三角形","titleSlug":"triangle-judgement"},{"formTitle":"[611]有效三角形的个数","frontendQuestionId":"611","leaf":true,"level":2,"nodeType":"def","questionId":"611","status":"","title":"有效三角形的个数","titleSlug":"valid-triangle-number"},{"formTitle":"[612]平面上的最近距离","frontendQuestionId":"612","leaf":true,"level":2,"nodeType":"def","questionId":"612","status":"lock","title":"平面上的最近距离","titleSlug":"shortest-distance-in-a-plane"},{"formTitle":"[613]直线上的最近距离","frontendQuestionId":"613","leaf":true,"level":1,"nodeType":"def","questionId":"613","status":"lock","title":"直线上的最近距离","titleSlug":"shortest-distance-in-a-line"},{"formTitle":"[614]二级关注者","frontendQuestionId":"614","leaf":true,"level":2,"nodeType":"def","questionId":"614","status":"lock","title":"二级关注者","titleSlug":"second-degree-follower"},{"formTitle":"[615]平均工资:部门与公司比较","frontendQuestionId":"615","leaf":true,"level":3,"nodeType":"def","questionId":"615","status":"lock","title":"平均工资:部门与公司比较","titleSlug":"average-salary-departments-vs-company"},{"formTitle":"[616]给字符串添加加粗标签","frontendQuestionId":"616","leaf":true,"level":2,"nodeType":"def","questionId":"616","status":"lock","title":"给字符串添加加粗标签","titleSlug":"add-bold-tag-in-string"},{"formTitle":"[617]合并二叉树","frontendQuestionId":"617","leaf":true,"level":1,"nodeType":"def","questionId":"617","status":"","title":"合并二叉树","titleSlug":"merge-two-binary-trees"},{"formTitle":"[618]学生地理信息报告","frontendQuestionId":"618","leaf":true,"level":3,"nodeType":"def","questionId":"618","status":"lock","title":"学生地理信息报告","titleSlug":"students-report-by-geography"},{"formTitle":"[619]只出现一次的最大数字","frontendQuestionId":"619","leaf":true,"level":1,"nodeType":"def","questionId":"619","status":"lock","title":"只出现一次的最大数字","titleSlug":"biggest-single-number"},{"formTitle":"[620]有趣的电影","frontendQuestionId":"620","leaf":true,"level":1,"nodeType":"def","questionId":"620","status":"","title":"有趣的电影","titleSlug":"not-boring-movies"},{"formTitle":"[621]任务调度器","frontendQuestionId":"621","leaf":true,"level":2,"nodeType":"def","questionId":"621","status":"","title":"任务调度器","titleSlug":"task-scheduler"},{"formTitle":"[622]设计循环队列","frontendQuestionId":"622","leaf":true,"level":2,"nodeType":"def","questionId":"860","status":"","title":"设计循环队列","titleSlug":"design-circular-queue"},{"formTitle":"[623]在二叉树中增加一行","frontendQuestionId":"623","leaf":true,"level":2,"nodeType":"def","questionId":"623","status":"","title":"在二叉树中增加一行","titleSlug":"add-one-row-to-tree"},{"formTitle":"[624]数组列表中的最大距离","frontendQuestionId":"624","leaf":true,"level":1,"nodeType":"def","questionId":"624","status":"lock","title":"数组列表中的最大距离","titleSlug":"maximum-distance-in-arrays"},{"formTitle":"[625]最小因式分解","frontendQuestionId":"625","leaf":true,"level":2,"nodeType":"def","questionId":"625","status":"lock","title":"最小因式分解","titleSlug":"minimum-factorization"},{"formTitle":"[626]换座位","frontendQuestionId":"626","leaf":true,"level":2,"nodeType":"def","questionId":"626","status":"","title":"换座位","titleSlug":"exchange-seats"},{"formTitle":"[627]交换工资","frontendQuestionId":"627","leaf":true,"level":1,"nodeType":"def","questionId":"627","status":"","title":"交换工资","titleSlug":"swap-salary"},{"formTitle":"[628]三个数的最大乘积","frontendQuestionId":"628","leaf":true,"level":1,"nodeType":"def","questionId":"628","status":"","title":"三个数的最大乘积","titleSlug":"maximum-product-of-three-numbers"},{"formTitle":"[629]K个逆序对数组","frontendQuestionId":"629","leaf":true,"level":3,"nodeType":"def","questionId":"629","status":"","title":"K个逆序对数组","titleSlug":"k-inverse-pairs-array"},{"formTitle":"[630]课程表 III","frontendQuestionId":"630","leaf":true,"level":3,"nodeType":"def","questionId":"630","status":"","title":"课程表 III","titleSlug":"course-schedule-iii"},{"formTitle":"[631]设计 Excel 求和公式","frontendQuestionId":"631","leaf":true,"level":3,"nodeType":"def","questionId":"631","status":"lock","title":"设计 Excel 求和公式","titleSlug":"design-excel-sum-formula"},{"formTitle":"[632]最小区间","frontendQuestionId":"632","leaf":true,"level":3,"nodeType":"def","questionId":"632","status":"","title":"最小区间","titleSlug":"smallest-range-covering-elements-from-k-lists"},{"formTitle":"[633]平方数之和","frontendQuestionId":"633","leaf":true,"level":1,"nodeType":"def","questionId":"633","status":"","title":"平方数之和","titleSlug":"sum-of-square-numbers"},{"formTitle":"[634]寻找数组的错位排列","frontendQuestionId":"634","leaf":true,"level":2,"nodeType":"def","questionId":"634","status":"lock","title":"寻找数组的错位排列","titleSlug":"find-the-derangement-of-an-array"},{"formTitle":"[635]设计日志存储系统","frontendQuestionId":"635","leaf":true,"level":2,"nodeType":"def","questionId":"635","status":"lock","title":"设计日志存储系统","titleSlug":"design-log-storage-system"},{"formTitle":"[636]函数的独占时间","frontendQuestionId":"636","leaf":true,"level":2,"nodeType":"def","questionId":"636","status":"","title":"函数的独占时间","titleSlug":"exclusive-time-of-functions"},{"formTitle":"[637]二叉树的层平均值","frontendQuestionId":"637","leaf":true,"level":1,"nodeType":"def","questionId":"637","status":"","title":"二叉树的层平均值","titleSlug":"average-of-levels-in-binary-tree"},{"formTitle":"[638]大礼包","frontendQuestionId":"638","leaf":true,"level":2,"nodeType":"def","questionId":"638","status":"","title":"大礼包","titleSlug":"shopping-offers"},{"formTitle":"[639]解码方法 2","frontendQuestionId":"639","leaf":true,"level":3,"nodeType":"def","questionId":"639","status":"","title":"解码方法 2","titleSlug":"decode-ways-ii"},{"formTitle":"[640]求解方程","frontendQuestionId":"640","leaf":true,"level":2,"nodeType":"def","questionId":"640","status":"","title":"求解方程","titleSlug":"solve-the-equation"},{"formTitle":"[641]设计循环双端队列","frontendQuestionId":"641","leaf":true,"level":2,"nodeType":"def","questionId":"859","status":"","title":"设计循环双端队列","titleSlug":"design-circular-deque"},{"formTitle":"[642]设计搜索自动补全系统","frontendQuestionId":"642","leaf":true,"level":3,"nodeType":"def","questionId":"642","status":"lock","title":"设计搜索自动补全系统","titleSlug":"design-search-autocomplete-system"},{"formTitle":"[643]子数组最大平均数 I","frontendQuestionId":"643","leaf":true,"level":1,"nodeType":"def","questionId":"643","status":"","title":"子数组最大平均数 I","titleSlug":"maximum-average-subarray-i"},{"formTitle":"[644]最大平均子段和 II","frontendQuestionId":"644","leaf":true,"level":3,"nodeType":"def","questionId":"644","status":"lock","title":"最大平均子段和 II","titleSlug":"maximum-average-subarray-ii"},{"formTitle":"[645]错误的集合","frontendQuestionId":"645","leaf":true,"level":1,"nodeType":"def","questionId":"645","status":"","title":"错误的集合","titleSlug":"set-mismatch"},{"formTitle":"[646]最长数对链","frontendQuestionId":"646","leaf":true,"level":2,"nodeType":"def","questionId":"646","status":"","title":"最长数对链","titleSlug":"maximum-length-of-pair-chain"},{"formTitle":"[647]回文子串","frontendQuestionId":"647","leaf":true,"level":2,"nodeType":"def","questionId":"647","status":"","title":"回文子串","titleSlug":"palindromic-substrings"},{"formTitle":"[648]单词替换","frontendQuestionId":"648","leaf":true,"level":2,"nodeType":"def","questionId":"648","status":"","title":"单词替换","titleSlug":"replace-words"},{"formTitle":"[649]Dota2 参议院","frontendQuestionId":"649","leaf":true,"level":2,"nodeType":"def","questionId":"649","status":"","title":"Dota2 参议院","titleSlug":"dota2-senate"},{"formTitle":"[650]只有两个键的键盘","frontendQuestionId":"650","leaf":true,"level":2,"nodeType":"def","questionId":"650","status":"","title":"只有两个键的键盘","titleSlug":"2-keys-keyboard"},{"formTitle":"[651]4键键盘","frontendQuestionId":"651","leaf":true,"level":2,"nodeType":"def","questionId":"651","status":"lock","title":"4键键盘","titleSlug":"4-keys-keyboard"},{"formTitle":"[652]寻找重复的子树","frontendQuestionId":"652","leaf":true,"level":2,"nodeType":"def","questionId":"652","status":"","title":"寻找重复的子树","titleSlug":"find-duplicate-subtrees"},{"formTitle":"[653]两数之和 IV - 输入 BST","frontendQuestionId":"653","leaf":true,"level":1,"nodeType":"def","questionId":"653","status":"","title":"两数之和 IV - 输入 BST","titleSlug":"two-sum-iv-input-is-a-bst"},{"formTitle":"[654]最大二叉树","frontendQuestionId":"654","leaf":true,"level":2,"nodeType":"def","questionId":"654","status":"","title":"最大二叉树","titleSlug":"maximum-binary-tree"},{"formTitle":"[655]输出二叉树","frontendQuestionId":"655","leaf":true,"level":2,"nodeType":"def","questionId":"655","status":"","title":"输出二叉树","titleSlug":"print-binary-tree"},{"formTitle":"[656]金币路径","frontendQuestionId":"656","leaf":true,"level":3,"nodeType":"def","questionId":"656","status":"lock","title":"金币路径","titleSlug":"coin-path"},{"formTitle":"[657]机器人能否返回原点","frontendQuestionId":"657","leaf":true,"level":1,"nodeType":"def","questionId":"657","status":"","title":"机器人能否返回原点","titleSlug":"robot-return-to-origin"},{"formTitle":"[658]找到 K 个最接近的元素","frontendQuestionId":"658","leaf":true,"level":2,"nodeType":"def","questionId":"658","status":"","title":"找到 K 个最接近的元素","titleSlug":"find-k-closest-elements"},{"formTitle":"[659]分割数组为连续子序列","frontendQuestionId":"659","leaf":true,"level":2,"nodeType":"def","questionId":"659","status":"","title":"分割数组为连续子序列","titleSlug":"split-array-into-consecutive-subsequences"},{"formTitle":"[660]移除 9","frontendQuestionId":"660","leaf":true,"level":3,"nodeType":"def","questionId":"660","status":"lock","title":"移除 9","titleSlug":"remove-9"},{"formTitle":"[661]图片平滑器","frontendQuestionId":"661","leaf":true,"level":1,"nodeType":"def","questionId":"661","status":"","title":"图片平滑器","titleSlug":"image-smoother"},{"formTitle":"[662]二叉树最大宽度","frontendQuestionId":"662","leaf":true,"level":2,"nodeType":"def","questionId":"662","status":"","title":"二叉树最大宽度","titleSlug":"maximum-width-of-binary-tree"},{"formTitle":"[663]均匀树划分","frontendQuestionId":"663","leaf":true,"level":2,"nodeType":"def","questionId":"663","status":"lock","title":"均匀树划分","titleSlug":"equal-tree-partition"},{"formTitle":"[664]奇怪的打印机","frontendQuestionId":"664","leaf":true,"level":3,"nodeType":"def","questionId":"664","status":"","title":"奇怪的打印机","titleSlug":"strange-printer"},{"formTitle":"[665]非递减数列","frontendQuestionId":"665","leaf":true,"level":1,"nodeType":"def","questionId":"665","status":"","title":"非递减数列","titleSlug":"non-decreasing-array"},{"formTitle":"[666]路径和 IV","frontendQuestionId":"666","leaf":true,"level":2,"nodeType":"def","questionId":"666","status":"lock","title":"路径和 IV","titleSlug":"path-sum-iv"},{"formTitle":"[667]优美的排列 II","frontendQuestionId":"667","leaf":true,"level":2,"nodeType":"def","questionId":"667","status":"","title":"优美的排列 II","titleSlug":"beautiful-arrangement-ii"},{"formTitle":"[668]乘法表中第k小的数","frontendQuestionId":"668","leaf":true,"level":3,"nodeType":"def","questionId":"668","status":"","title":"乘法表中第k小的数","titleSlug":"kth-smallest-number-in-multiplication-table"},{"formTitle":"[669]修剪二叉搜索树","frontendQuestionId":"669","leaf":true,"level":1,"nodeType":"def","questionId":"669","status":"","title":"修剪二叉搜索树","titleSlug":"trim-a-binary-search-tree"},{"formTitle":"[670]最大交换","frontendQuestionId":"670","leaf":true,"level":2,"nodeType":"def","questionId":"670","status":"","title":"最大交换","titleSlug":"maximum-swap"},{"formTitle":"[671]二叉树中第二小的节点","frontendQuestionId":"671","leaf":true,"level":1,"nodeType":"def","questionId":"671","status":"","title":"二叉树中第二小的节点","titleSlug":"second-minimum-node-in-a-binary-tree"},{"formTitle":"[672]灯泡开关 Ⅱ","frontendQuestionId":"672","leaf":true,"level":2,"nodeType":"def","questionId":"672","status":"","title":"灯泡开关 Ⅱ","titleSlug":"bulb-switcher-ii"},{"formTitle":"[673]最长递增子序列的个数","frontendQuestionId":"673","leaf":true,"level":2,"nodeType":"def","questionId":"673","status":"","title":"最长递增子序列的个数","titleSlug":"number-of-longest-increasing-subsequence"},{"formTitle":"[674]最长连续递增序列","frontendQuestionId":"674","leaf":true,"level":1,"nodeType":"def","questionId":"674","status":"","title":"最长连续递增序列","titleSlug":"longest-continuous-increasing-subsequence"},{"formTitle":"[675]为高尔夫比赛砍树","frontendQuestionId":"675","leaf":true,"level":3,"nodeType":"def","questionId":"675","status":"","title":"为高尔夫比赛砍树","titleSlug":"cut-off-trees-for-golf-event"},{"formTitle":"[676]实现一个魔法字典","frontendQuestionId":"676","leaf":true,"level":2,"nodeType":"def","questionId":"676","status":"","title":"实现一个魔法字典","titleSlug":"implement-magic-dictionary"},{"formTitle":"[677]键值映射","frontendQuestionId":"677","leaf":true,"level":2,"nodeType":"def","questionId":"677","status":"","title":"键值映射","titleSlug":"map-sum-pairs"},{"formTitle":"[678]有效的括号字符串","frontendQuestionId":"678","leaf":true,"level":2,"nodeType":"def","questionId":"678","status":"","title":"有效的括号字符串","titleSlug":"valid-parenthesis-string"},{"formTitle":"[679]24 点游戏","frontendQuestionId":"679","leaf":true,"level":3,"nodeType":"def","questionId":"679","status":"","title":"24 点游戏","titleSlug":"24-game"},{"formTitle":"[680]验证回文字符串 Ⅱ","frontendQuestionId":"680","leaf":true,"level":1,"nodeType":"def","questionId":"680","status":"","title":"验证回文字符串 Ⅱ","titleSlug":"valid-palindrome-ii"},{"formTitle":"[681]最近时刻","frontendQuestionId":"681","leaf":true,"level":2,"nodeType":"def","questionId":"681","status":"lock","title":"最近时刻","titleSlug":"next-closest-time"},{"formTitle":"[682]棒球比赛","frontendQuestionId":"682","leaf":true,"level":1,"nodeType":"def","questionId":"682","status":"","title":"棒球比赛","titleSlug":"baseball-game"},{"formTitle":"[683]K 个空花盆","frontendQuestionId":"683","leaf":true,"level":3,"nodeType":"def","questionId":"683","status":"lock","title":"K 个空花盆","titleSlug":"k-empty-slots"},{"formTitle":"[684]冗余连接","frontendQuestionId":"684","leaf":true,"level":2,"nodeType":"def","questionId":"684","status":"","title":"冗余连接","titleSlug":"redundant-connection"},{"formTitle":"[685]冗余连接 II","frontendQuestionId":"685","leaf":true,"level":3,"nodeType":"def","questionId":"685","status":"","title":"冗余连接 II","titleSlug":"redundant-connection-ii"},{"formTitle":"[686]重复叠加字符串匹配","frontendQuestionId":"686","leaf":true,"level":1,"nodeType":"def","questionId":"686","status":"","title":"重复叠加字符串匹配","titleSlug":"repeated-string-match"},{"formTitle":"[687]最长同值路径","frontendQuestionId":"687","leaf":true,"level":1,"nodeType":"def","questionId":"687","status":"","title":"最长同值路径","titleSlug":"longest-univalue-path"},{"formTitle":"[688]“马”在棋盘上的概率","frontendQuestionId":"688","leaf":true,"level":2,"nodeType":"def","questionId":"688","status":"","title":"“马”在棋盘上的概率","titleSlug":"knight-probability-in-chessboard"},{"formTitle":"[689]三个无重叠子数组的最大和","frontendQuestionId":"689","leaf":true,"level":3,"nodeType":"def","questionId":"689","status":"","title":"三个无重叠子数组的最大和","titleSlug":"maximum-sum-of-3-non-overlapping-subarrays"},{"formTitle":"[690]员工的重要性","frontendQuestionId":"690","leaf":true,"level":1,"nodeType":"def","questionId":"690","status":"","title":"员工的重要性","titleSlug":"employee-importance"},{"formTitle":"[691]贴纸拼词","frontendQuestionId":"691","leaf":true,"level":3,"nodeType":"def","questionId":"691","status":"","title":"贴纸拼词","titleSlug":"stickers-to-spell-word"},{"formTitle":"[692]前K个高频单词","frontendQuestionId":"692","leaf":true,"level":2,"nodeType":"def","questionId":"692","status":"","title":"前K个高频单词","titleSlug":"top-k-frequent-words"},{"formTitle":"[693]交替位二进制数","frontendQuestionId":"693","leaf":true,"level":1,"nodeType":"def","questionId":"693","status":"","title":"交替位二进制数","titleSlug":"binary-number-with-alternating-bits"},{"formTitle":"[694]不同岛屿的数量","frontendQuestionId":"694","leaf":true,"level":2,"nodeType":"def","questionId":"694","status":"lock","title":"不同岛屿的数量","titleSlug":"number-of-distinct-islands"},{"formTitle":"[695]岛屿的最大面积","frontendQuestionId":"695","leaf":true,"level":2,"nodeType":"def","questionId":"695","status":"","title":"岛屿的最大面积","titleSlug":"max-area-of-island"},{"formTitle":"[696]计数二进制子串","frontendQuestionId":"696","leaf":true,"level":1,"nodeType":"def","questionId":"696","status":"","title":"计数二进制子串","titleSlug":"count-binary-substrings"},{"formTitle":"[697]数组的度","frontendQuestionId":"697","leaf":true,"level":1,"nodeType":"def","questionId":"697","status":"","title":"数组的度","titleSlug":"degree-of-an-array"},{"formTitle":"[698]划分为k个相等的子集","frontendQuestionId":"698","leaf":true,"level":2,"nodeType":"def","questionId":"698","status":"","title":"划分为k个相等的子集","titleSlug":"partition-to-k-equal-sum-subsets"},{"formTitle":"[699]掉落的方块","frontendQuestionId":"699","leaf":true,"level":3,"nodeType":"def","questionId":"699","status":"","title":"掉落的方块","titleSlug":"falling-squares"},{"formTitle":"[700]二叉搜索树中的搜索","frontendQuestionId":"700","leaf":true,"level":1,"nodeType":"def","questionId":"783","status":"","title":"二叉搜索树中的搜索","titleSlug":"search-in-a-binary-search-tree"},{"formTitle":"[701]二叉搜索树中的插入操作","frontendQuestionId":"701","leaf":true,"level":2,"nodeType":"def","questionId":"784","status":"","title":"二叉搜索树中的插入操作","titleSlug":"insert-into-a-binary-search-tree"},{"formTitle":"[702]搜索长度未知的有序数组","frontendQuestionId":"702","leaf":true,"level":2,"nodeType":"def","questionId":"786","status":"lock","title":"搜索长度未知的有序数组","titleSlug":"search-in-a-sorted-array-of-unknown-size"},{"formTitle":"[703]数据流中的第K大元素","frontendQuestionId":"703","leaf":true,"level":1,"nodeType":"def","questionId":"789","status":"","title":"数据流中的第K大元素","titleSlug":"kth-largest-element-in-a-stream"},{"formTitle":"[704]二分查找","frontendQuestionId":"704","leaf":true,"level":1,"nodeType":"def","questionId":"792","status":"","title":"二分查找","titleSlug":"binary-search"},{"formTitle":"[705]设计哈希集合","frontendQuestionId":"705","leaf":true,"level":1,"nodeType":"def","questionId":"816","status":"","title":"设计哈希集合","titleSlug":"design-hashset"},{"formTitle":"[706]设计哈希映射","frontendQuestionId":"706","leaf":true,"level":1,"nodeType":"def","questionId":"817","status":"","title":"设计哈希映射","titleSlug":"design-hashmap"},{"formTitle":"[707]设计链表","frontendQuestionId":"707","leaf":true,"level":2,"nodeType":"def","questionId":"838","status":"","title":"设计链表","titleSlug":"design-linked-list"},{"formTitle":"[708]循环有序列表的插入","frontendQuestionId":"708","leaf":true,"level":2,"nodeType":"def","questionId":"850","status":"lock","title":"循环有序列表的插入","titleSlug":"insert-into-a-cyclic-sorted-list"},{"formTitle":"[709]转换成小写字母","frontendQuestionId":"709","leaf":true,"level":1,"nodeType":"def","questionId":"742","status":"","title":"转换成小写字母","titleSlug":"to-lower-case"},{"formTitle":"[710]黑名单中的随机数","frontendQuestionId":"710","leaf":true,"level":3,"nodeType":"def","questionId":"894","status":"","title":"黑名单中的随机数","titleSlug":"random-pick-with-blacklist"},{"formTitle":"[711]不同岛屿的数量 II","frontendQuestionId":"711","leaf":true,"level":3,"nodeType":"def","questionId":"711","status":"lock","title":"不同岛屿的数量 II","titleSlug":"number-of-distinct-islands-ii"},{"formTitle":"[712]两个字符串的最小ASCII删除和","frontendQuestionId":"712","leaf":true,"level":2,"nodeType":"def","questionId":"712","status":"","title":"两个字符串的最小ASCII删除和","titleSlug":"minimum-ascii-delete-sum-for-two-strings"},{"formTitle":"[713]乘积小于K的子数组","frontendQuestionId":"713","leaf":true,"level":2,"nodeType":"def","questionId":"713","status":"","title":"乘积小于K的子数组","titleSlug":"subarray-product-less-than-k"},{"formTitle":"[714]买卖股票的最佳时机含手续费","frontendQuestionId":"714","leaf":true,"level":2,"nodeType":"def","questionId":"714","status":"","title":"买卖股票的最佳时机含手续费","titleSlug":"best-time-to-buy-and-sell-stock-with-transaction-fee"},{"formTitle":"[715]Range 模块","frontendQuestionId":"715","leaf":true,"level":3,"nodeType":"def","questionId":"715","status":"","title":"Range 模块","titleSlug":"range-module"},{"formTitle":"[716]最大栈","frontendQuestionId":"716","leaf":true,"level":1,"nodeType":"def","questionId":"716","status":"lock","title":"最大栈","titleSlug":"max-stack"},{"formTitle":"[717]1比特与2比特字符","frontendQuestionId":"717","leaf":true,"level":1,"nodeType":"def","questionId":"717","status":"","title":"1比特与2比特字符","titleSlug":"1-bit-and-2-bit-characters"},{"formTitle":"[718]最长重复子数组","frontendQuestionId":"718","leaf":true,"level":2,"nodeType":"def","questionId":"718","status":"","title":"最长重复子数组","titleSlug":"maximum-length-of-repeated-subarray"},{"formTitle":"[719]找出第 k 小的距离对","frontendQuestionId":"719","leaf":true,"level":3,"nodeType":"def","questionId":"719","status":"","title":"找出第 k 小的距离对","titleSlug":"find-k-th-smallest-pair-distance"},{"formTitle":"[720]词典中最长的单词","frontendQuestionId":"720","leaf":true,"level":1,"nodeType":"def","questionId":"720","status":"","title":"词典中最长的单词","titleSlug":"longest-word-in-dictionary"},{"formTitle":"[721]账户合并","frontendQuestionId":"721","leaf":true,"level":2,"nodeType":"def","questionId":"721","status":"","title":"账户合并","titleSlug":"accounts-merge"},{"formTitle":"[722]删除注释","frontendQuestionId":"722","leaf":true,"level":2,"nodeType":"def","questionId":"722","status":"","title":"删除注释","titleSlug":"remove-comments"},{"formTitle":"[723]粉碎糖果","frontendQuestionId":"723","leaf":true,"level":2,"nodeType":"def","questionId":"723","status":"lock","title":"粉碎糖果","titleSlug":"candy-crush"},{"formTitle":"[724]寻找数组的中心索引","frontendQuestionId":"724","leaf":true,"level":1,"nodeType":"def","questionId":"724","status":"","title":"寻找数组的中心索引","titleSlug":"find-pivot-index"},{"formTitle":"[725]分隔链表","frontendQuestionId":"725","leaf":true,"level":2,"nodeType":"def","questionId":"725","status":"","title":"分隔链表","titleSlug":"split-linked-list-in-parts"},{"formTitle":"[726]原子的数量","frontendQuestionId":"726","leaf":true,"level":3,"nodeType":"def","questionId":"726","status":"","title":"原子的数量","titleSlug":"number-of-atoms"},{"formTitle":"[727]最小窗口子序列","frontendQuestionId":"727","leaf":true,"level":3,"nodeType":"def","questionId":"727","status":"lock","title":"最小窗口子序列","titleSlug":"minimum-window-subsequence"},{"formTitle":"[728]自除数","frontendQuestionId":"728","leaf":true,"level":1,"nodeType":"def","questionId":"728","status":"","title":"自除数","titleSlug":"self-dividing-numbers"},{"formTitle":"[729]我的日程安排表 I","frontendQuestionId":"729","leaf":true,"level":2,"nodeType":"def","questionId":"729","status":"","title":"我的日程安排表 I","titleSlug":"my-calendar-i"},{"formTitle":"[730]统计不同回文子字符串","frontendQuestionId":"730","leaf":true,"level":3,"nodeType":"def","questionId":"730","status":"","title":"统计不同回文子字符串","titleSlug":"count-different-palindromic-subsequences"},{"formTitle":"[731]我的日程安排表 II","frontendQuestionId":"731","leaf":true,"level":2,"nodeType":"def","questionId":"731","status":"","title":"我的日程安排表 II","titleSlug":"my-calendar-ii"},{"formTitle":"[732]我的日程安排表 III","frontendQuestionId":"732","leaf":true,"level":3,"nodeType":"def","questionId":"732","status":"","title":"我的日程安排表 III","titleSlug":"my-calendar-iii"},{"formTitle":"[733]图像渲染","frontendQuestionId":"733","leaf":true,"level":1,"nodeType":"def","questionId":"733","status":"","title":"图像渲染","titleSlug":"flood-fill"},{"formTitle":"[734]句子相似性","frontendQuestionId":"734","leaf":true,"level":1,"nodeType":"def","questionId":"734","status":"lock","title":"句子相似性","titleSlug":"sentence-similarity"},{"formTitle":"[735]行星碰撞","frontendQuestionId":"735","leaf":true,"level":2,"nodeType":"def","questionId":"735","status":"","title":"行星碰撞","titleSlug":"asteroid-collision"},{"formTitle":"[736]Lisp 语法解析","frontendQuestionId":"736","leaf":true,"level":3,"nodeType":"def","questionId":"736","status":"","title":"Lisp 语法解析","titleSlug":"parse-lisp-expression"},{"formTitle":"[737]句子相似性 II","frontendQuestionId":"737","leaf":true,"level":2,"nodeType":"def","questionId":"737","status":"lock","title":"句子相似性 II","titleSlug":"sentence-similarity-ii"},{"formTitle":"[738]单调递增的数字","frontendQuestionId":"738","leaf":true,"level":2,"nodeType":"def","questionId":"738","status":"","title":"单调递增的数字","titleSlug":"monotone-increasing-digits"},{"formTitle":"[739]每日温度","frontendQuestionId":"739","leaf":true,"level":2,"nodeType":"def","questionId":"739","status":"","title":"每日温度","titleSlug":"daily-temperatures"},{"formTitle":"[740]删除与获得点数","frontendQuestionId":"740","leaf":true,"level":2,"nodeType":"def","questionId":"740","status":"","title":"删除与获得点数","titleSlug":"delete-and-earn"},{"formTitle":"[741]摘樱桃","frontendQuestionId":"741","leaf":true,"level":3,"nodeType":"def","questionId":"741","status":"","title":"摘樱桃","titleSlug":"cherry-pickup"},{"formTitle":"[742]二叉树最近的叶节点","frontendQuestionId":"742","leaf":true,"level":2,"nodeType":"def","questionId":"743","status":"lock","title":"二叉树最近的叶节点","titleSlug":"closest-leaf-in-a-binary-tree"},{"formTitle":"[743]网络延迟时间","frontendQuestionId":"743","leaf":true,"level":2,"nodeType":"def","questionId":"744","status":"","title":"网络延迟时间","titleSlug":"network-delay-time"},{"formTitle":"[744]寻找比目标字母大的最小字母","frontendQuestionId":"744","leaf":true,"level":1,"nodeType":"def","questionId":"745","status":"","title":"寻找比目标字母大的最小字母","titleSlug":"find-smallest-letter-greater-than-target"},{"formTitle":"[745]前缀和后缀搜索","frontendQuestionId":"745","leaf":true,"level":3,"nodeType":"def","questionId":"746","status":"","title":"前缀和后缀搜索","titleSlug":"prefix-and-suffix-search"},{"formTitle":"[746]使用最小花费爬楼梯","frontendQuestionId":"746","leaf":true,"level":1,"nodeType":"def","questionId":"747","status":"","title":"使用最小花费爬楼梯","titleSlug":"min-cost-climbing-stairs"},{"formTitle":"[747]至少是其他数字两倍的最大数","frontendQuestionId":"747","leaf":true,"level":1,"nodeType":"def","questionId":"748","status":"","title":"至少是其他数字两倍的最大数","titleSlug":"largest-number-at-least-twice-of-others"},{"formTitle":"[748]最短完整词","frontendQuestionId":"748","leaf":true,"level":1,"nodeType":"def","questionId":"749","status":"","title":"最短完整词","titleSlug":"shortest-completing-word"},{"formTitle":"[749]隔离病毒","frontendQuestionId":"749","leaf":true,"level":3,"nodeType":"def","questionId":"750","status":"","title":"隔离病毒","titleSlug":"contain-virus"},{"formTitle":"[750]角矩形的数量","frontendQuestionId":"750","leaf":true,"level":2,"nodeType":"def","questionId":"751","status":"lock","title":"角矩形的数量","titleSlug":"number-of-corner-rectangles"},{"formTitle":"[751]IP 到 CIDR","frontendQuestionId":"751","leaf":true,"level":1,"nodeType":"def","questionId":"752","status":"lock","title":"IP 到 CIDR","titleSlug":"ip-to-cidr"},{"formTitle":"[752]打开转盘锁","frontendQuestionId":"752","leaf":true,"level":2,"nodeType":"def","questionId":"753","status":"","title":"打开转盘锁","titleSlug":"open-the-lock"},{"formTitle":"[753]破解保险箱","frontendQuestionId":"753","leaf":true,"level":3,"nodeType":"def","questionId":"754","status":"","title":"破解保险箱","titleSlug":"cracking-the-safe"},{"formTitle":"[754]到达终点数字","frontendQuestionId":"754","leaf":true,"level":1,"nodeType":"def","questionId":"755","status":"","title":"到达终点数字","titleSlug":"reach-a-number"},{"formTitle":"[755]倒水","frontendQuestionId":"755","leaf":true,"level":2,"nodeType":"def","questionId":"756","status":"lock","title":"倒水","titleSlug":"pour-water"},{"formTitle":"[756]金字塔转换矩阵","frontendQuestionId":"756","leaf":true,"level":2,"nodeType":"def","questionId":"757","status":"","title":"金字塔转换矩阵","titleSlug":"pyramid-transition-matrix"},{"formTitle":"[757] 设置交集大小至少为2","frontendQuestionId":"757","leaf":true,"level":3,"nodeType":"def","questionId":"759","status":"","title":" 设置交集大小至少为2","titleSlug":"set-intersection-size-at-least-two"},{"formTitle":"[758]字符串中的加粗单词","frontendQuestionId":"758","leaf":true,"level":1,"nodeType":"def","questionId":"760","status":"lock","title":"字符串中的加粗单词","titleSlug":"bold-words-in-string"},{"formTitle":"[759]员工空闲时间","frontendQuestionId":"759","leaf":true,"level":3,"nodeType":"def","questionId":"761","status":"lock","title":"员工空闲时间","titleSlug":"employee-free-time"},{"formTitle":"[760]找出变位映射","frontendQuestionId":"760","leaf":true,"level":1,"nodeType":"def","questionId":"762","status":"lock","title":"找出变位映射","titleSlug":"find-anagram-mappings"},{"formTitle":"[761]特殊的二进制序列","frontendQuestionId":"761","leaf":true,"level":3,"nodeType":"def","questionId":"763","status":"","title":"特殊的二进制序列","titleSlug":"special-binary-string"},{"formTitle":"[762]二进制表示中质数个计算置位","frontendQuestionId":"762","leaf":true,"level":1,"nodeType":"def","questionId":"767","status":"","title":"二进制表示中质数个计算置位","titleSlug":"prime-number-of-set-bits-in-binary-representation"},{"formTitle":"[763]划分字母区间","frontendQuestionId":"763","leaf":true,"level":2,"nodeType":"def","questionId":"768","status":"","title":"划分字母区间","titleSlug":"partition-labels"},{"formTitle":"[764]最大加号标志","frontendQuestionId":"764","leaf":true,"level":2,"nodeType":"def","questionId":"769","status":"","title":"最大加号标志","titleSlug":"largest-plus-sign"},{"formTitle":"[765]情侣牵手","frontendQuestionId":"765","leaf":true,"level":3,"nodeType":"def","questionId":"770","status":"","title":"情侣牵手","titleSlug":"couples-holding-hands"},{"formTitle":"[766]托普利茨矩阵","frontendQuestionId":"766","leaf":true,"level":1,"nodeType":"def","questionId":"777","status":"","title":"托普利茨矩阵","titleSlug":"toeplitz-matrix"},{"formTitle":"[767]重构字符串","frontendQuestionId":"767","leaf":true,"level":2,"nodeType":"def","questionId":"778","status":"","title":"重构字符串","titleSlug":"reorganize-string"},{"formTitle":"[768]最多能完成排序的块 II","frontendQuestionId":"768","leaf":true,"level":3,"nodeType":"def","questionId":"779","status":"","title":"最多能完成排序的块 II","titleSlug":"max-chunks-to-make-sorted-ii"},{"formTitle":"[769]最多能完成排序的块","frontendQuestionId":"769","leaf":true,"level":2,"nodeType":"def","questionId":"780","status":"","title":"最多能完成排序的块","titleSlug":"max-chunks-to-make-sorted"},{"formTitle":"[770]基本计算器 IV","frontendQuestionId":"770","leaf":true,"level":3,"nodeType":"def","questionId":"781","status":"","title":"基本计算器 IV","titleSlug":"basic-calculator-iv"},{"formTitle":"[771]宝石与石头","frontendQuestionId":"771","leaf":true,"level":1,"nodeType":"def","questionId":"782","status":"","title":"宝石与石头","titleSlug":"jewels-and-stones"},{"formTitle":"[772]基本计算器 III","frontendQuestionId":"772","leaf":true,"level":3,"nodeType":"def","questionId":"785","status":"lock","title":"基本计算器 III","titleSlug":"basic-calculator-iii"},{"formTitle":"[773]滑动谜题","frontendQuestionId":"773","leaf":true,"level":3,"nodeType":"def","questionId":"787","status":"","title":"滑动谜题","titleSlug":"sliding-puzzle"},{"formTitle":"[774]最小化去加油站的最大距离","frontendQuestionId":"774","leaf":true,"level":3,"nodeType":"def","questionId":"788","status":"lock","title":"最小化去加油站的最大距离","titleSlug":"minimize-max-distance-to-gas-station"},{"formTitle":"[775]全局倒置与局部倒置","frontendQuestionId":"775","leaf":true,"level":2,"nodeType":"def","questionId":"790","status":"","title":"全局倒置与局部倒置","titleSlug":"global-and-local-inversions"},{"formTitle":"[776]拆分二叉搜索树","frontendQuestionId":"776","leaf":true,"level":2,"nodeType":"def","questionId":"791","status":"lock","title":"拆分二叉搜索树","titleSlug":"split-bst"},{"formTitle":"[777]在LR字符串中交换相邻字符","frontendQuestionId":"777","leaf":true,"level":2,"nodeType":"def","questionId":"793","status":"","title":"在LR字符串中交换相邻字符","titleSlug":"swap-adjacent-in-lr-string"},{"formTitle":"[778]水位上升的泳池中游泳","frontendQuestionId":"778","leaf":true,"level":3,"nodeType":"def","questionId":"794","status":"","title":"水位上升的泳池中游泳","titleSlug":"swim-in-rising-water"},{"formTitle":"[779]第K个语法符号","frontendQuestionId":"779","leaf":true,"level":2,"nodeType":"def","questionId":"795","status":"","title":"第K个语法符号","titleSlug":"k-th-symbol-in-grammar"},{"formTitle":"[780]到达终点","frontendQuestionId":"780","leaf":true,"level":3,"nodeType":"def","questionId":"796","status":"","title":"到达终点","titleSlug":"reaching-points"},{"formTitle":"[781]森林中的兔子","frontendQuestionId":"781","leaf":true,"level":2,"nodeType":"def","questionId":"797","status":"","title":"森林中的兔子","titleSlug":"rabbits-in-forest"},{"formTitle":"[782]变为棋盘","frontendQuestionId":"782","leaf":true,"level":3,"nodeType":"def","questionId":"798","status":"","title":"变为棋盘","titleSlug":"transform-to-chessboard"},{"formTitle":"[783]二叉搜索树结点最小距离","frontendQuestionId":"783","leaf":true,"level":1,"nodeType":"def","questionId":"799","status":"","title":"二叉搜索树结点最小距离","titleSlug":"minimum-distance-between-bst-nodes"},{"formTitle":"[784]字母大小写全排列","frontendQuestionId":"784","leaf":true,"level":1,"nodeType":"def","questionId":"800","status":"","title":"字母大小写全排列","titleSlug":"letter-case-permutation"},{"formTitle":"[785]判断二分图","frontendQuestionId":"785","leaf":true,"level":2,"nodeType":"def","questionId":"801","status":"","title":"判断二分图","titleSlug":"is-graph-bipartite"},{"formTitle":"[786]第 K 个最小的素数分数","frontendQuestionId":"786","leaf":true,"level":3,"nodeType":"def","questionId":"802","status":"","title":"第 K 个最小的素数分数","titleSlug":"k-th-smallest-prime-fraction"},{"formTitle":"[787]K 站中转内最便宜的航班","frontendQuestionId":"787","leaf":true,"level":2,"nodeType":"def","questionId":"803","status":"","title":"K 站中转内最便宜的航班","titleSlug":"cheapest-flights-within-k-stops"},{"formTitle":"[788]旋转数字","frontendQuestionId":"788","leaf":true,"level":1,"nodeType":"def","questionId":"804","status":"","title":"旋转数字","titleSlug":"rotated-digits"},{"formTitle":"[789]逃脱阻碍者","frontendQuestionId":"789","leaf":true,"level":2,"nodeType":"def","questionId":"805","status":"","title":"逃脱阻碍者","titleSlug":"escape-the-ghosts"},{"formTitle":"[790]多米诺和托米诺平铺","frontendQuestionId":"790","leaf":true,"level":2,"nodeType":"def","questionId":"806","status":"","title":"多米诺和托米诺平铺","titleSlug":"domino-and-tromino-tiling"},{"formTitle":"[791]自定义字符串排序","frontendQuestionId":"791","leaf":true,"level":2,"nodeType":"def","questionId":"807","status":"","title":"自定义字符串排序","titleSlug":"custom-sort-string"},{"formTitle":"[792]匹配子序列的单词数","frontendQuestionId":"792","leaf":true,"level":2,"nodeType":"def","questionId":"808","status":"","title":"匹配子序列的单词数","titleSlug":"number-of-matching-subsequences"},{"formTitle":"[793]阶乘函数后K个零","frontendQuestionId":"793","leaf":true,"level":3,"nodeType":"def","questionId":"809","status":"","title":"阶乘函数后K个零","titleSlug":"preimage-size-of-factorial-zeroes-function"},{"formTitle":"[794]有效的井字游戏","frontendQuestionId":"794","leaf":true,"level":2,"nodeType":"def","questionId":"810","status":"","title":"有效的井字游戏","titleSlug":"valid-tic-tac-toe-state"},{"formTitle":"[795]区间子数组个数","frontendQuestionId":"795","leaf":true,"level":2,"nodeType":"def","questionId":"811","status":"","title":"区间子数组个数","titleSlug":"number-of-subarrays-with-bounded-maximum"},{"formTitle":"[796]旋转字符串","frontendQuestionId":"796","leaf":true,"level":1,"nodeType":"def","questionId":"812","status":"","title":"旋转字符串","titleSlug":"rotate-string"},{"formTitle":"[797]所有可能的路径","frontendQuestionId":"797","leaf":true,"level":2,"nodeType":"def","questionId":"813","status":"","title":"所有可能的路径","titleSlug":"all-paths-from-source-to-target"},{"formTitle":"[798]得分最高的最小轮调","frontendQuestionId":"798","leaf":true,"level":3,"nodeType":"def","questionId":"814","status":"","title":"得分最高的最小轮调","titleSlug":"smallest-rotation-with-highest-score"},{"formTitle":"[799]香槟塔","frontendQuestionId":"799","leaf":true,"level":2,"nodeType":"def","questionId":"815","status":"","title":"香槟塔","titleSlug":"champagne-tower"},{"formTitle":"[800]相似 RGB 颜色","frontendQuestionId":"800","leaf":true,"level":1,"nodeType":"def","questionId":"818","status":"lock","title":"相似 RGB 颜色","titleSlug":"similar-rgb-color"},{"formTitle":"[801]使序列递增的最小交换次数","frontendQuestionId":"801","leaf":true,"level":2,"nodeType":"def","questionId":"819","status":"","title":"使序列递增的最小交换次数","titleSlug":"minimum-swaps-to-make-sequences-increasing"},{"formTitle":"[802]找到最终的安全状态","frontendQuestionId":"802","leaf":true,"level":2,"nodeType":"def","questionId":"820","status":"","title":"找到最终的安全状态","titleSlug":"find-eventual-safe-states"},{"formTitle":"[803]打砖块","frontendQuestionId":"803","leaf":true,"level":3,"nodeType":"def","questionId":"821","status":"","title":"打砖块","titleSlug":"bricks-falling-when-hit"},{"formTitle":"[804]唯一摩尔斯密码词","frontendQuestionId":"804","leaf":true,"level":1,"nodeType":"def","questionId":"822","status":"","title":"唯一摩尔斯密码词","titleSlug":"unique-morse-code-words"},{"formTitle":"[805]数组的均值分割","frontendQuestionId":"805","leaf":true,"level":3,"nodeType":"def","questionId":"823","status":"","title":"数组的均值分割","titleSlug":"split-array-with-same-average"},{"formTitle":"[806]写字符串需要的行数","frontendQuestionId":"806","leaf":true,"level":1,"nodeType":"def","questionId":"824","status":"","title":"写字符串需要的行数","titleSlug":"number-of-lines-to-write-string"},{"formTitle":"[807]保持城市天际线","frontendQuestionId":"807","leaf":true,"level":2,"nodeType":"def","questionId":"825","status":"","title":"保持城市天际线","titleSlug":"max-increase-to-keep-city-skyline"},{"formTitle":"[808]分汤","frontendQuestionId":"808","leaf":true,"level":2,"nodeType":"def","questionId":"826","status":"","title":"分汤","titleSlug":"soup-servings"},{"formTitle":"[809]情感丰富的文字","frontendQuestionId":"809","leaf":true,"level":2,"nodeType":"def","questionId":"827","status":"","title":"情感丰富的文字","titleSlug":"expressive-words"},{"formTitle":"[810]黑板异或游戏","frontendQuestionId":"810","leaf":true,"level":3,"nodeType":"def","questionId":"828","status":"","title":"黑板异或游戏","titleSlug":"chalkboard-xor-game"},{"formTitle":"[811]子域名访问计数","frontendQuestionId":"811","leaf":true,"level":1,"nodeType":"def","questionId":"829","status":"","title":"子域名访问计数","titleSlug":"subdomain-visit-count"},{"formTitle":"[812]最大三角形面积","frontendQuestionId":"812","leaf":true,"level":1,"nodeType":"def","questionId":"830","status":"","title":"最大三角形面积","titleSlug":"largest-triangle-area"},{"formTitle":"[813]最大平均值和的分组","frontendQuestionId":"813","leaf":true,"level":2,"nodeType":"def","questionId":"831","status":"","title":"最大平均值和的分组","titleSlug":"largest-sum-of-averages"},{"formTitle":"[814]二叉树剪枝","frontendQuestionId":"814","leaf":true,"level":2,"nodeType":"def","questionId":"832","status":"","title":"二叉树剪枝","titleSlug":"binary-tree-pruning"},{"formTitle":"[815]公交路线","frontendQuestionId":"815","leaf":true,"level":3,"nodeType":"def","questionId":"833","status":"","title":"公交路线","titleSlug":"bus-routes"},{"formTitle":"[816]模糊坐标","frontendQuestionId":"816","leaf":true,"level":2,"nodeType":"def","questionId":"834","status":"","title":"模糊坐标","titleSlug":"ambiguous-coordinates"},{"formTitle":"[817]链表组件","frontendQuestionId":"817","leaf":true,"level":2,"nodeType":"def","questionId":"835","status":"","title":"链表组件","titleSlug":"linked-list-components"},{"formTitle":"[818]赛车","frontendQuestionId":"818","leaf":true,"level":3,"nodeType":"def","questionId":"836","status":"","title":"赛车","titleSlug":"race-car"},{"formTitle":"[819]最常见的单词","frontendQuestionId":"819","leaf":true,"level":1,"nodeType":"def","questionId":"837","status":"","title":"最常见的单词","titleSlug":"most-common-word"},{"formTitle":"[820]单词的压缩编码","frontendQuestionId":"820","leaf":true,"level":2,"nodeType":"def","questionId":"839","status":"","title":"单词的压缩编码","titleSlug":"short-encoding-of-words"},{"formTitle":"[821]字符的最短距离","frontendQuestionId":"821","leaf":true,"level":1,"nodeType":"def","questionId":"841","status":"","title":"字符的最短距离","titleSlug":"shortest-distance-to-a-character"},{"formTitle":"[822]翻转卡片游戏","frontendQuestionId":"822","leaf":true,"level":2,"nodeType":"def","questionId":"842","status":"","title":"翻转卡片游戏","titleSlug":"card-flipping-game"},{"formTitle":"[823]带因子的二叉树","frontendQuestionId":"823","leaf":true,"level":2,"nodeType":"def","questionId":"843","status":"","title":"带因子的二叉树","titleSlug":"binary-trees-with-factors"},{"formTitle":"[824]山羊拉丁文","frontendQuestionId":"824","leaf":true,"level":1,"nodeType":"def","questionId":"851","status":"","title":"山羊拉丁文","titleSlug":"goat-latin"},{"formTitle":"[825]适龄的朋友","frontendQuestionId":"825","leaf":true,"level":2,"nodeType":"def","questionId":"852","status":"","title":"适龄的朋友","titleSlug":"friends-of-appropriate-ages"},{"formTitle":"[826]安排工作以达到最大收益","frontendQuestionId":"826","leaf":true,"level":2,"nodeType":"def","questionId":"853","status":"","title":"安排工作以达到最大收益","titleSlug":"most-profit-assigning-work"},{"formTitle":"[827]最大人工岛","frontendQuestionId":"827","leaf":true,"level":3,"nodeType":"def","questionId":"854","status":"","title":"最大人工岛","titleSlug":"making-a-large-island"},{"formTitle":"[828]独特字符串","frontendQuestionId":"828","leaf":true,"level":3,"nodeType":"def","questionId":"855","status":"","title":"独特字符串","titleSlug":"unique-letter-string"},{"formTitle":"[829]连续整数求和","frontendQuestionId":"829","leaf":true,"level":3,"nodeType":"def","questionId":"856","status":"","title":"连续整数求和","titleSlug":"consecutive-numbers-sum"},{"formTitle":"[830]较大分组的位置","frontendQuestionId":"830","leaf":true,"level":1,"nodeType":"def","questionId":"857","status":"","title":"较大分组的位置","titleSlug":"positions-of-large-groups"},{"formTitle":"[831]隐藏个人信息","frontendQuestionId":"831","leaf":true,"level":2,"nodeType":"def","questionId":"858","status":"","title":"隐藏个人信息","titleSlug":"masking-personal-information"},{"formTitle":"[832]翻转图像","frontendQuestionId":"832","leaf":true,"level":1,"nodeType":"def","questionId":"861","status":"","title":"翻转图像","titleSlug":"flipping-an-image"},{"formTitle":"[833]字符串中的查找与替换","frontendQuestionId":"833","leaf":true,"level":2,"nodeType":"def","questionId":"862","status":"","title":"字符串中的查找与替换","titleSlug":"find-and-replace-in-string"},{"formTitle":"[834]树中距离之和","frontendQuestionId":"834","leaf":true,"level":3,"nodeType":"def","questionId":"863","status":"","title":"树中距离之和","titleSlug":"sum-of-distances-in-tree"},{"formTitle":"[835]图像重叠","frontendQuestionId":"835","leaf":true,"level":2,"nodeType":"def","questionId":"864","status":"","title":"图像重叠","titleSlug":"image-overlap"},{"formTitle":"[836]矩形重叠","frontendQuestionId":"836","leaf":true,"level":1,"nodeType":"def","questionId":"866","status":"","title":"矩形重叠","titleSlug":"rectangle-overlap"},{"formTitle":"[837]新21点","frontendQuestionId":"837","leaf":true,"level":2,"nodeType":"def","questionId":"867","status":"","title":"新21点","titleSlug":"new-21-game"},{"formTitle":"[838]推多米诺","frontendQuestionId":"838","leaf":true,"level":2,"nodeType":"def","questionId":"868","status":"","title":"推多米诺","titleSlug":"push-dominoes"},{"formTitle":"[839]相似字符串组","frontendQuestionId":"839","leaf":true,"level":3,"nodeType":"def","questionId":"869","status":"","title":"相似字符串组","titleSlug":"similar-string-groups"},{"formTitle":"[840]矩阵中的幻方","frontendQuestionId":"840","leaf":true,"level":1,"nodeType":"def","questionId":"870","status":"","title":"矩阵中的幻方","titleSlug":"magic-squares-in-grid"},{"formTitle":"[841]钥匙和房间","frontendQuestionId":"841","leaf":true,"level":2,"nodeType":"def","questionId":"871","status":"","title":"钥匙和房间","titleSlug":"keys-and-rooms"},{"formTitle":"[842]将数组拆分成斐波那契序列","frontendQuestionId":"842","leaf":true,"level":2,"nodeType":"def","questionId":"872","status":"","title":"将数组拆分成斐波那契序列","titleSlug":"split-array-into-fibonacci-sequence"},{"formTitle":"[843]猜猜这个单词","frontendQuestionId":"843","leaf":true,"level":3,"nodeType":"def","questionId":"873","status":"","title":"猜猜这个单词","titleSlug":"guess-the-word"},{"formTitle":"[844]比较含退格的字符串","frontendQuestionId":"844","leaf":true,"level":1,"nodeType":"def","questionId":"874","status":"","title":"比较含退格的字符串","titleSlug":"backspace-string-compare"},{"formTitle":"[845]数组中的最长山脉","frontendQuestionId":"845","leaf":true,"level":2,"nodeType":"def","questionId":"875","status":"","title":"数组中的最长山脉","titleSlug":"longest-mountain-in-array"},{"formTitle":"[846]一手顺子","frontendQuestionId":"846","leaf":true,"level":2,"nodeType":"def","questionId":"876","status":"","title":"一手顺子","titleSlug":"hand-of-straights"},{"formTitle":"[847]访问所有节点的最短路径","frontendQuestionId":"847","leaf":true,"level":3,"nodeType":"def","questionId":"877","status":"","title":"访问所有节点的最短路径","titleSlug":"shortest-path-visiting-all-nodes"},{"formTitle":"[848]字母移位","frontendQuestionId":"848","leaf":true,"level":2,"nodeType":"def","questionId":"878","status":"","title":"字母移位","titleSlug":"shifting-letters"},{"formTitle":"[849]到最近的人的最大距离","frontendQuestionId":"849","leaf":true,"level":1,"nodeType":"def","questionId":"879","status":"","title":"到最近的人的最大距离","titleSlug":"maximize-distance-to-closest-person"},{"formTitle":"[850]矩形面积 II","frontendQuestionId":"850","leaf":true,"level":3,"nodeType":"def","questionId":"880","status":"","title":"矩形面积 II","titleSlug":"rectangle-area-ii"},{"formTitle":"[851]喧闹和富有","frontendQuestionId":"851","leaf":true,"level":2,"nodeType":"def","questionId":"881","status":"","title":"喧闹和富有","titleSlug":"loud-and-rich"},{"formTitle":"[852]山脉数组的峰顶索引","frontendQuestionId":"852","leaf":true,"level":1,"nodeType":"def","questionId":"882","status":"","title":"山脉数组的峰顶索引","titleSlug":"peak-index-in-a-mountain-array"},{"formTitle":"[853]车队","frontendQuestionId":"853","leaf":true,"level":2,"nodeType":"def","questionId":"883","status":"","title":"车队","titleSlug":"car-fleet"},{"formTitle":"[854]相似度为 K 的字符串","frontendQuestionId":"854","leaf":true,"level":3,"nodeType":"def","questionId":"884","status":"","title":"相似度为 K 的字符串","titleSlug":"k-similar-strings"},{"formTitle":"[855]考场就座","frontendQuestionId":"855","leaf":true,"level":2,"nodeType":"def","questionId":"885","status":"","title":"考场就座","titleSlug":"exam-room"},{"formTitle":"[856]括号的分数","frontendQuestionId":"856","leaf":true,"level":2,"nodeType":"def","questionId":"886","status":"","title":"括号的分数","titleSlug":"score-of-parentheses"},{"formTitle":"[857]雇佣 K 名工人的最低成本","frontendQuestionId":"857","leaf":true,"level":3,"nodeType":"def","questionId":"887","status":"","title":"雇佣 K 名工人的最低成本","titleSlug":"minimum-cost-to-hire-k-workers"},{"formTitle":"[858]镜面反射","frontendQuestionId":"858","leaf":true,"level":2,"nodeType":"def","questionId":"888","status":"","title":"镜面反射","titleSlug":"mirror-reflection"},{"formTitle":"[859]亲密字符串","frontendQuestionId":"859","leaf":true,"level":1,"nodeType":"def","questionId":"889","status":"","title":"亲密字符串","titleSlug":"buddy-strings"},{"formTitle":"[860]柠檬水找零","frontendQuestionId":"860","leaf":true,"level":1,"nodeType":"def","questionId":"890","status":"","title":"柠檬水找零","titleSlug":"lemonade-change"},{"formTitle":"[861]翻转矩阵后的得分","frontendQuestionId":"861","leaf":true,"level":2,"nodeType":"def","questionId":"891","status":"","title":"翻转矩阵后的得分","titleSlug":"score-after-flipping-matrix"},{"formTitle":"[862]和至少为 K 的最短子数组","frontendQuestionId":"862","leaf":true,"level":3,"nodeType":"def","questionId":"892","status":"","title":"和至少为 K 的最短子数组","titleSlug":"shortest-subarray-with-sum-at-least-k"},{"formTitle":"[863]二叉树中所有距离为 K 的结点","frontendQuestionId":"863","leaf":true,"level":2,"nodeType":"def","questionId":"893","status":"","title":"二叉树中所有距离为 K 的结点","titleSlug":"all-nodes-distance-k-in-binary-tree"},{"formTitle":"[864]获取所有钥匙的最短路径","frontendQuestionId":"864","leaf":true,"level":3,"nodeType":"def","questionId":"895","status":"","title":"获取所有钥匙的最短路径","titleSlug":"shortest-path-to-get-all-keys"},{"formTitle":"[865]具有所有最深结点的最小子树","frontendQuestionId":"865","leaf":true,"level":2,"nodeType":"def","questionId":"896","status":"","title":"具有所有最深结点的最小子树","titleSlug":"smallest-subtree-with-all-the-deepest-nodes"},{"formTitle":"[866]回文素数","frontendQuestionId":"866","leaf":true,"level":2,"nodeType":"def","questionId":"897","status":"","title":"回文素数","titleSlug":"prime-palindrome"},{"formTitle":"[867]转置矩阵","frontendQuestionId":"867","leaf":true,"level":1,"nodeType":"def","questionId":"898","status":"","title":"转置矩阵","titleSlug":"transpose-matrix"},{"formTitle":"[868]二进制间距","frontendQuestionId":"868","leaf":true,"level":1,"nodeType":"def","questionId":"899","status":"","title":"二进制间距","titleSlug":"binary-gap"},{"formTitle":"[869]重新排序得到 2 的幂","frontendQuestionId":"869","leaf":true,"level":2,"nodeType":"def","questionId":"900","status":"","title":"重新排序得到 2 的幂","titleSlug":"reordered-power-of-2"},{"formTitle":"[870]优势洗牌","frontendQuestionId":"870","leaf":true,"level":2,"nodeType":"def","questionId":"901","status":"","title":"优势洗牌","titleSlug":"advantage-shuffle"},{"formTitle":"[871]最低加油次数","frontendQuestionId":"871","leaf":true,"level":3,"nodeType":"def","questionId":"902","status":"","title":"最低加油次数","titleSlug":"minimum-number-of-refueling-stops"},{"formTitle":"[872]叶子相似的树","frontendQuestionId":"872","leaf":true,"level":1,"nodeType":"def","questionId":"904","status":"","title":"叶子相似的树","titleSlug":"leaf-similar-trees"},{"formTitle":"[873]最长的斐波那契子序列的长度","frontendQuestionId":"873","leaf":true,"level":2,"nodeType":"def","questionId":"905","status":"","title":"最长的斐波那契子序列的长度","titleSlug":"length-of-longest-fibonacci-subsequence"},{"formTitle":"[874]模拟行走机器人","frontendQuestionId":"874","leaf":true,"level":1,"nodeType":"def","questionId":"906","status":"","title":"模拟行走机器人","titleSlug":"walking-robot-simulation"},{"formTitle":"[875]爱吃香蕉的珂珂","frontendQuestionId":"875","leaf":true,"level":2,"nodeType":"def","questionId":"907","status":"","title":"爱吃香蕉的珂珂","titleSlug":"koko-eating-bananas"},{"formTitle":"[876]链表的中间结点","frontendQuestionId":"876","leaf":true,"level":1,"nodeType":"def","questionId":"908","status":"","title":"链表的中间结点","titleSlug":"middle-of-the-linked-list"},{"formTitle":"[877]石子游戏","frontendQuestionId":"877","leaf":true,"level":2,"nodeType":"def","questionId":"909","status":"","title":"石子游戏","titleSlug":"stone-game"},{"formTitle":"[878]第 N 个神奇数字","frontendQuestionId":"878","leaf":true,"level":3,"nodeType":"def","questionId":"910","status":"","title":"第 N 个神奇数字","titleSlug":"nth-magical-number"},{"formTitle":"[879]盈利计划","frontendQuestionId":"879","leaf":true,"level":3,"nodeType":"def","questionId":"911","status":"","title":"盈利计划","titleSlug":"profitable-schemes"},{"formTitle":"[880]索引处的解码字符串","frontendQuestionId":"880","leaf":true,"level":2,"nodeType":"def","questionId":"916","status":"","title":"索引处的解码字符串","titleSlug":"decoded-string-at-index"},{"formTitle":"[881]救生艇","frontendQuestionId":"881","leaf":true,"level":2,"nodeType":"def","questionId":"917","status":"","title":"救生艇","titleSlug":"boats-to-save-people"},{"formTitle":"[882]细分图中的可到达结点","frontendQuestionId":"882","leaf":true,"level":3,"nodeType":"def","questionId":"918","status":"","title":"细分图中的可到达结点","titleSlug":"reachable-nodes-in-subdivided-graph"},{"formTitle":"[883]三维形体投影面积","frontendQuestionId":"883","leaf":true,"level":1,"nodeType":"def","questionId":"919","status":"","title":"三维形体投影面积","titleSlug":"projection-area-of-3d-shapes"},{"formTitle":"[884]两句话中的不常见单词","frontendQuestionId":"884","leaf":true,"level":1,"nodeType":"def","questionId":"920","status":"","title":"两句话中的不常见单词","titleSlug":"uncommon-words-from-two-sentences"},{"formTitle":"[885]螺旋矩阵 III","frontendQuestionId":"885","leaf":true,"level":2,"nodeType":"def","questionId":"921","status":"","title":"螺旋矩阵 III","titleSlug":"spiral-matrix-iii"},{"formTitle":"[886]可能的二分法","frontendQuestionId":"886","leaf":true,"level":2,"nodeType":"def","questionId":"922","status":"","title":"可能的二分法","titleSlug":"possible-bipartition"},{"formTitle":"[887]鸡蛋掉落","frontendQuestionId":"887","leaf":true,"level":3,"nodeType":"def","questionId":"923","status":"","title":"鸡蛋掉落","titleSlug":"super-egg-drop"},{"formTitle":"[888]公平的糖果交换","frontendQuestionId":"888","leaf":true,"level":1,"nodeType":"def","questionId":"924","status":"","title":"公平的糖果交换","titleSlug":"fair-candy-swap"},{"formTitle":"[889]根据前序和后序遍历构造二叉树","frontendQuestionId":"889","leaf":true,"level":2,"nodeType":"def","questionId":"925","status":"","title":"根据前序和后序遍历构造二叉树","titleSlug":"construct-binary-tree-from-preorder-and-postorder-traversal"},{"formTitle":"[890]查找和替换模式","frontendQuestionId":"890","leaf":true,"level":2,"nodeType":"def","questionId":"926","status":"","title":"查找和替换模式","titleSlug":"find-and-replace-pattern"},{"formTitle":"[891]子序列宽度之和","frontendQuestionId":"891","leaf":true,"level":3,"nodeType":"def","questionId":"927","status":"","title":"子序列宽度之和","titleSlug":"sum-of-subsequence-widths"},{"formTitle":"[892]三维形体的表面积","frontendQuestionId":"892","leaf":true,"level":1,"nodeType":"def","questionId":"928","status":"","title":"三维形体的表面积","titleSlug":"surface-area-of-3d-shapes"},{"formTitle":"[893]特殊等价字符串组","frontendQuestionId":"893","leaf":true,"level":1,"nodeType":"def","questionId":"929","status":"","title":"特殊等价字符串组","titleSlug":"groups-of-special-equivalent-strings"},{"formTitle":"[894]所有可能的满二叉树","frontendQuestionId":"894","leaf":true,"level":2,"nodeType":"def","questionId":"930","status":"","title":"所有可能的满二叉树","titleSlug":"all-possible-full-binary-trees"},{"formTitle":"[895]最大频率栈","frontendQuestionId":"895","leaf":true,"level":3,"nodeType":"def","questionId":"931","status":"","title":"最大频率栈","titleSlug":"maximum-frequency-stack"},{"formTitle":"[896]单调数列","frontendQuestionId":"896","leaf":true,"level":1,"nodeType":"def","questionId":"932","status":"","title":"单调数列","titleSlug":"monotonic-array"},{"formTitle":"[897]递增顺序查找树","frontendQuestionId":"897","leaf":true,"level":1,"nodeType":"def","questionId":"933","status":"","title":"递增顺序查找树","titleSlug":"increasing-order-search-tree"},{"formTitle":"[898]子数组按位或操作","frontendQuestionId":"898","leaf":true,"level":2,"nodeType":"def","questionId":"934","status":"","title":"子数组按位或操作","titleSlug":"bitwise-ors-of-subarrays"},{"formTitle":"[899]有序队列","frontendQuestionId":"899","leaf":true,"level":3,"nodeType":"def","questionId":"935","status":"","title":"有序队列","titleSlug":"orderly-queue"},{"formTitle":"[900]RLE 迭代器","frontendQuestionId":"900","leaf":true,"level":2,"nodeType":"def","questionId":"936","status":"","title":"RLE 迭代器","titleSlug":"rle-iterator"},{"formTitle":"[901]股票价格跨度","frontendQuestionId":"901","leaf":true,"level":2,"nodeType":"def","questionId":"937","status":"","title":"股票价格跨度","titleSlug":"online-stock-span"},{"formTitle":"[902]最大为 N 的数字组合","frontendQuestionId":"902","leaf":true,"level":3,"nodeType":"def","questionId":"938","status":"","title":"最大为 N 的数字组合","titleSlug":"numbers-at-most-n-given-digit-set"},{"formTitle":"[903]DI 序列的有效排列","frontendQuestionId":"903","leaf":true,"level":3,"nodeType":"def","questionId":"939","status":"","title":"DI 序列的有效排列","titleSlug":"valid-permutations-for-di-sequence"},{"formTitle":"[904]水果成篮","frontendQuestionId":"904","leaf":true,"level":2,"nodeType":"def","questionId":"940","status":"","title":"水果成篮","titleSlug":"fruit-into-baskets"},{"formTitle":"[905]按奇偶排序数组","frontendQuestionId":"905","leaf":true,"level":1,"nodeType":"def","questionId":"941","status":"","title":"按奇偶排序数组","titleSlug":"sort-array-by-parity"},{"formTitle":"[906]超级回文数","frontendQuestionId":"906","leaf":true,"level":3,"nodeType":"def","questionId":"942","status":"","title":"超级回文数","titleSlug":"super-palindromes"},{"formTitle":"[907]子数组的最小值之和","frontendQuestionId":"907","leaf":true,"level":2,"nodeType":"def","questionId":"943","status":"","title":"子数组的最小值之和","titleSlug":"sum-of-subarray-minimums"},{"formTitle":"[908]最小差值 I","frontendQuestionId":"908","leaf":true,"level":1,"nodeType":"def","questionId":"944","status":"","title":"最小差值 I","titleSlug":"smallest-range-i"},{"formTitle":"[909]蛇梯棋","frontendQuestionId":"909","leaf":true,"level":2,"nodeType":"def","questionId":"945","status":"","title":"蛇梯棋","titleSlug":"snakes-and-ladders"},{"formTitle":"[910]最小差值 II","frontendQuestionId":"910","leaf":true,"level":2,"nodeType":"def","questionId":"946","status":"","title":"最小差值 II","titleSlug":"smallest-range-ii"},{"formTitle":"[911]在线选举","frontendQuestionId":"911","leaf":true,"level":2,"nodeType":"def","questionId":"947","status":"","title":"在线选举","titleSlug":"online-election"},{"formTitle":"[912]排序数组","frontendQuestionId":"912","leaf":true,"level":2,"nodeType":"def","questionId":"948","status":"","title":"排序数组","titleSlug":"sort-an-array"},{"formTitle":"[913]猫和老鼠","frontendQuestionId":"913","leaf":true,"level":3,"nodeType":"def","questionId":"949","status":"","title":"猫和老鼠","titleSlug":"cat-and-mouse"},{"formTitle":"[914]卡牌分组","frontendQuestionId":"914","leaf":true,"level":1,"nodeType":"def","questionId":"950","status":"","title":"卡牌分组","titleSlug":"x-of-a-kind-in-a-deck-of-cards"},{"formTitle":"[915]分割数组","frontendQuestionId":"915","leaf":true,"level":2,"nodeType":"def","questionId":"951","status":"","title":"分割数组","titleSlug":"partition-array-into-disjoint-intervals"},{"formTitle":"[916]单词子集","frontendQuestionId":"916","leaf":true,"level":2,"nodeType":"def","questionId":"952","status":"","title":"单词子集","titleSlug":"word-subsets"},{"formTitle":"[917]仅仅反转字母","frontendQuestionId":"917","leaf":true,"level":1,"nodeType":"def","questionId":"953","status":"","title":"仅仅反转字母","titleSlug":"reverse-only-letters"},{"formTitle":"[918]环形子数组的最大和","frontendQuestionId":"918","leaf":true,"level":2,"nodeType":"def","questionId":"954","status":"","title":"环形子数组的最大和","titleSlug":"maximum-sum-circular-subarray"},{"formTitle":"[919]完全二叉树插入器","frontendQuestionId":"919","leaf":true,"level":2,"nodeType":"def","questionId":"955","status":"","title":"完全二叉树插入器","titleSlug":"complete-binary-tree-inserter"},{"formTitle":"[920]播放列表的数量","frontendQuestionId":"920","leaf":true,"level":3,"nodeType":"def","questionId":"956","status":"","title":"播放列表的数量","titleSlug":"number-of-music-playlists"},{"formTitle":"[921]使括号有效的最少添加","frontendQuestionId":"921","leaf":true,"level":2,"nodeType":"def","questionId":"957","status":"","title":"使括号有效的最少添加","titleSlug":"minimum-add-to-make-parentheses-valid"},{"formTitle":"[922]按奇偶排序数组 II","frontendQuestionId":"922","leaf":true,"level":1,"nodeType":"def","questionId":"958","status":"","title":"按奇偶排序数组 II","titleSlug":"sort-array-by-parity-ii"},{"formTitle":"[923]三数之和的多种可能","frontendQuestionId":"923","leaf":true,"level":2,"nodeType":"def","questionId":"959","status":"","title":"三数之和的多种可能","titleSlug":"3sum-with-multiplicity"},{"formTitle":"[924]尽量减少恶意软件的传播","frontendQuestionId":"924","leaf":true,"level":3,"nodeType":"def","questionId":"960","status":"","title":"尽量减少恶意软件的传播","titleSlug":"minimize-malware-spread"},{"formTitle":"[925]长按键入","frontendQuestionId":"925","leaf":true,"level":1,"nodeType":"def","questionId":"961","status":"","title":"长按键入","titleSlug":"long-pressed-name"},{"formTitle":"[926]将字符串翻转到单调递增","frontendQuestionId":"926","leaf":true,"level":2,"nodeType":"def","questionId":"962","status":"","title":"将字符串翻转到单调递增","titleSlug":"flip-string-to-monotone-increasing"},{"formTitle":"[927]三等分","frontendQuestionId":"927","leaf":true,"level":3,"nodeType":"def","questionId":"963","status":"","title":"三等分","titleSlug":"three-equal-parts"},{"formTitle":"[928]尽量减少恶意软件的传播 II","frontendQuestionId":"928","leaf":true,"level":3,"nodeType":"def","questionId":"964","status":"","title":"尽量减少恶意软件的传播 II","titleSlug":"minimize-malware-spread-ii"},{"formTitle":"[929]独特的电子邮件地址","frontendQuestionId":"929","leaf":true,"level":1,"nodeType":"def","questionId":"965","status":"","title":"独特的电子邮件地址","titleSlug":"unique-email-addresses"},{"formTitle":"[930]和相同的二元子数组","frontendQuestionId":"930","leaf":true,"level":2,"nodeType":"def","questionId":"966","status":"","title":"和相同的二元子数组","titleSlug":"binary-subarrays-with-sum"},{"formTitle":"[931]下降路径最小和","frontendQuestionId":"931","leaf":true,"level":2,"nodeType":"def","questionId":"967","status":"","title":"下降路径最小和","titleSlug":"minimum-falling-path-sum"},{"formTitle":"[932]漂亮数组","frontendQuestionId":"932","leaf":true,"level":2,"nodeType":"def","questionId":"968","status":"","title":"漂亮数组","titleSlug":"beautiful-array"},{"formTitle":"[933]最近的请求次数","frontendQuestionId":"933","leaf":true,"level":1,"nodeType":"def","questionId":"969","status":"","title":"最近的请求次数","titleSlug":"number-of-recent-calls"},{"formTitle":"[934]最短的桥","frontendQuestionId":"934","leaf":true,"level":2,"nodeType":"def","questionId":"971","status":"","title":"最短的桥","titleSlug":"shortest-bridge"},{"formTitle":"[935]骑士拨号器","frontendQuestionId":"935","leaf":true,"level":2,"nodeType":"def","questionId":"972","status":"","title":"骑士拨号器","titleSlug":"knight-dialer"},{"formTitle":"[936]戳印序列","frontendQuestionId":"936","leaf":true,"level":3,"nodeType":"def","questionId":"973","status":"","title":"戳印序列","titleSlug":"stamping-the-sequence"},{"formTitle":"[937]重新排列日志文件","frontendQuestionId":"937","leaf":true,"level":1,"nodeType":"def","questionId":"974","status":"","title":"重新排列日志文件","titleSlug":"reorder-data-in-log-files"},{"formTitle":"[938]二叉搜索树的范围和","frontendQuestionId":"938","leaf":true,"level":1,"nodeType":"def","questionId":"975","status":"","title":"二叉搜索树的范围和","titleSlug":"range-sum-of-bst"},{"formTitle":"[939]最小面积矩形","frontendQuestionId":"939","leaf":true,"level":2,"nodeType":"def","questionId":"976","status":"","title":"最小面积矩形","titleSlug":"minimum-area-rectangle"},{"formTitle":"[940]不同的子序列 II","frontendQuestionId":"940","leaf":true,"level":3,"nodeType":"def","questionId":"977","status":"","title":"不同的子序列 II","titleSlug":"distinct-subsequences-ii"},{"formTitle":"[941]有效的山脉数组","frontendQuestionId":"941","leaf":true,"level":1,"nodeType":"def","questionId":"978","status":"","title":"有效的山脉数组","titleSlug":"valid-mountain-array"},{"formTitle":"[942]增减字符串匹配","frontendQuestionId":"942","leaf":true,"level":1,"nodeType":"def","questionId":"979","status":"","title":"增减字符串匹配","titleSlug":"di-string-match"},{"formTitle":"[943]最短超级串","frontendQuestionId":"943","leaf":true,"level":3,"nodeType":"def","questionId":"980","status":"","title":"最短超级串","titleSlug":"find-the-shortest-superstring"},{"formTitle":"[944]删列造序","frontendQuestionId":"944","leaf":true,"level":1,"nodeType":"def","questionId":"981","status":"","title":"删列造序","titleSlug":"delete-columns-to-make-sorted"},{"formTitle":"[945]使数组唯一的最小增量","frontendQuestionId":"945","leaf":true,"level":2,"nodeType":"def","questionId":"982","status":"","title":"使数组唯一的最小增量","titleSlug":"minimum-increment-to-make-array-unique"},{"formTitle":"[946]验证栈序列","frontendQuestionId":"946","leaf":true,"level":2,"nodeType":"def","questionId":"983","status":"","title":"验证栈序列","titleSlug":"validate-stack-sequences"},{"formTitle":"[947]移除最多的同行或同列石头","frontendQuestionId":"947","leaf":true,"level":2,"nodeType":"def","questionId":"984","status":"","title":"移除最多的同行或同列石头","titleSlug":"most-stones-removed-with-same-row-or-column"},{"formTitle":"[948]令牌放置","frontendQuestionId":"948","leaf":true,"level":2,"nodeType":"def","questionId":"985","status":"","title":"令牌放置","titleSlug":"bag-of-tokens"},{"formTitle":"[949]给定数字能组成的最大时间","frontendQuestionId":"949","leaf":true,"level":1,"nodeType":"def","questionId":"986","status":"","title":"给定数字能组成的最大时间","titleSlug":"largest-time-for-given-digits"},{"formTitle":"[950]按递增顺序显示卡牌","frontendQuestionId":"950","leaf":true,"level":2,"nodeType":"def","questionId":"987","status":"","title":"按递增顺序显示卡牌","titleSlug":"reveal-cards-in-increasing-order"},{"formTitle":"[951]翻转等价二叉树","frontendQuestionId":"951","leaf":true,"level":2,"nodeType":"def","questionId":"988","status":"","title":"翻转等价二叉树","titleSlug":"flip-equivalent-binary-trees"},{"formTitle":"[952]按公因数计算最大组件大小","frontendQuestionId":"952","leaf":true,"level":3,"nodeType":"def","questionId":"989","status":"","title":"按公因数计算最大组件大小","titleSlug":"largest-component-size-by-common-factor"},{"formTitle":"[953]验证外星语词典","frontendQuestionId":"953","leaf":true,"level":1,"nodeType":"def","questionId":"990","status":"","title":"验证外星语词典","titleSlug":"verifying-an-alien-dictionary"},{"formTitle":"[954]二倍数对数组","frontendQuestionId":"954","leaf":true,"level":2,"nodeType":"def","questionId":"991","status":"","title":"二倍数对数组","titleSlug":"array-of-doubled-pairs"},{"formTitle":"[955]删列造序 II","frontendQuestionId":"955","leaf":true,"level":2,"nodeType":"def","questionId":"992","status":"","title":"删列造序 II","titleSlug":"delete-columns-to-make-sorted-ii"},{"formTitle":"[956]最高的广告牌","frontendQuestionId":"956","leaf":true,"level":3,"nodeType":"def","questionId":"993","status":"","title":"最高的广告牌","titleSlug":"tallest-billboard"},{"formTitle":"[957]N 天后的牢房","frontendQuestionId":"957","leaf":true,"level":2,"nodeType":"def","questionId":"994","status":"","title":"N 天后的牢房","titleSlug":"prison-cells-after-n-days"},{"formTitle":"[958]二叉树的完全性检验","frontendQuestionId":"958","leaf":true,"level":2,"nodeType":"def","questionId":"998","status":"","title":"二叉树的完全性检验","titleSlug":"check-completeness-of-a-binary-tree"},{"formTitle":"[959]由斜杠划分区域","frontendQuestionId":"959","leaf":true,"level":2,"nodeType":"def","questionId":"999","status":"","title":"由斜杠划分区域","titleSlug":"regions-cut-by-slashes"},{"formTitle":"[960]删列造序 III","frontendQuestionId":"960","leaf":true,"level":3,"nodeType":"def","questionId":"1000","status":"","title":"删列造序 III","titleSlug":"delete-columns-to-make-sorted-iii"},{"formTitle":"[961]重复 N 次的元素","frontendQuestionId":"961","leaf":true,"level":1,"nodeType":"def","questionId":"1001","status":"","title":"重复 N 次的元素","titleSlug":"n-repeated-element-in-size-2n-array"},{"formTitle":"[962]最大宽度坡","frontendQuestionId":"962","leaf":true,"level":2,"nodeType":"def","questionId":"1002","status":"","title":"最大宽度坡","titleSlug":"maximum-width-ramp"},{"formTitle":"[963]最小面积矩形 II","frontendQuestionId":"963","leaf":true,"level":2,"nodeType":"def","questionId":"1003","status":"","title":"最小面积矩形 II","titleSlug":"minimum-area-rectangle-ii"},{"formTitle":"[964]表示数字的最少运算符","frontendQuestionId":"964","leaf":true,"level":3,"nodeType":"def","questionId":"1004","status":"","title":"表示数字的最少运算符","titleSlug":"least-operators-to-express-number"},{"formTitle":"[965]单值二叉树","frontendQuestionId":"965","leaf":true,"level":1,"nodeType":"def","questionId":"1005","status":"","title":"单值二叉树","titleSlug":"univalued-binary-tree"},{"formTitle":"[966]元音拼写检查器","frontendQuestionId":"966","leaf":true,"level":2,"nodeType":"def","questionId":"1006","status":"","title":"元音拼写检查器","titleSlug":"vowel-spellchecker"},{"formTitle":"[967]连续差相同的数字","frontendQuestionId":"967","leaf":true,"level":2,"nodeType":"def","questionId":"1007","status":"","title":"连续差相同的数字","titleSlug":"numbers-with-same-consecutive-differences"},{"formTitle":"[968]监控二叉树","frontendQuestionId":"968","leaf":true,"level":3,"nodeType":"def","questionId":"1008","status":"","title":"监控二叉树","titleSlug":"binary-tree-cameras"},{"formTitle":"[969]煎饼排序","frontendQuestionId":"969","leaf":true,"level":2,"nodeType":"def","questionId":"1009","status":"","title":"煎饼排序","titleSlug":"pancake-sorting"},{"formTitle":"[970]强整数","frontendQuestionId":"970","leaf":true,"level":1,"nodeType":"def","questionId":"1010","status":"","title":"强整数","titleSlug":"powerful-integers"},{"formTitle":"[971]翻转二叉树以匹配先序遍历","frontendQuestionId":"971","leaf":true,"level":2,"nodeType":"def","questionId":"1011","status":"","title":"翻转二叉树以匹配先序遍历","titleSlug":"flip-binary-tree-to-match-preorder-traversal"},{"formTitle":"[972]相等的有理数","frontendQuestionId":"972","leaf":true,"level":3,"nodeType":"def","questionId":"1012","status":"","title":"相等的有理数","titleSlug":"equal-rational-numbers"},{"formTitle":"[973]最接近原点的 K 个点","frontendQuestionId":"973","leaf":true,"level":2,"nodeType":"def","questionId":"1014","status":"","title":"最接近原点的 K 个点","titleSlug":"k-closest-points-to-origin"},{"formTitle":"[974]和可被 K 整除的子数组","frontendQuestionId":"974","leaf":true,"level":2,"nodeType":"def","questionId":"1016","status":"","title":"和可被 K 整除的子数组","titleSlug":"subarray-sums-divisible-by-k"},{"formTitle":"[975]奇偶跳","frontendQuestionId":"975","leaf":true,"level":3,"nodeType":"def","questionId":"1017","status":"","title":"奇偶跳","titleSlug":"odd-even-jump"},{"formTitle":"[976]三角形的最大周长","frontendQuestionId":"976","leaf":true,"level":1,"nodeType":"def","questionId":"1018","status":"","title":"三角形的最大周长","titleSlug":"largest-perimeter-triangle"},{"formTitle":"[977]有序数组的平方","frontendQuestionId":"977","leaf":true,"level":1,"nodeType":"def","questionId":"1019","status":"","title":"有序数组的平方","titleSlug":"squares-of-a-sorted-array"},{"formTitle":"[978]最长湍流子数组","frontendQuestionId":"978","leaf":true,"level":2,"nodeType":"def","questionId":"1020","status":"","title":"最长湍流子数组","titleSlug":"longest-turbulent-subarray"},{"formTitle":"[979]在二叉树中分配硬币","frontendQuestionId":"979","leaf":true,"level":2,"nodeType":"def","questionId":"1021","status":"","title":"在二叉树中分配硬币","titleSlug":"distribute-coins-in-binary-tree"},{"formTitle":"[980]不同路径 III","frontendQuestionId":"980","leaf":true,"level":3,"nodeType":"def","questionId":"1022","status":"","title":"不同路径 III","titleSlug":"unique-paths-iii"},{"formTitle":"[981]基于时间的键值存储","frontendQuestionId":"981","leaf":true,"level":2,"nodeType":"def","questionId":"1023","status":"","title":"基于时间的键值存储","titleSlug":"time-based-key-value-store"},{"formTitle":"[982]按位与为零的三元组","frontendQuestionId":"982","leaf":true,"level":3,"nodeType":"def","questionId":"1024","status":"","title":"按位与为零的三元组","titleSlug":"triples-with-bitwise-and-equal-to-zero"},{"formTitle":"[983]最低票价","frontendQuestionId":"983","leaf":true,"level":2,"nodeType":"def","questionId":"1025","status":"","title":"最低票价","titleSlug":"minimum-cost-for-tickets"},{"formTitle":"[984]不含 AAA 或 BBB 的字符串","frontendQuestionId":"984","leaf":true,"level":2,"nodeType":"def","questionId":"1026","status":"","title":"不含 AAA 或 BBB 的字符串","titleSlug":"string-without-aaa-or-bbb"},{"formTitle":"[985]查询后的偶数和","frontendQuestionId":"985","leaf":true,"level":1,"nodeType":"def","questionId":"1027","status":"","title":"查询后的偶数和","titleSlug":"sum-of-even-numbers-after-queries"},{"formTitle":"[986]区间列表的交集","frontendQuestionId":"986","leaf":true,"level":2,"nodeType":"def","questionId":"1028","status":"","title":"区间列表的交集","titleSlug":"interval-list-intersections"},{"formTitle":"[987]二叉树的垂序遍历","frontendQuestionId":"987","leaf":true,"level":2,"nodeType":"def","questionId":"1029","status":"","title":"二叉树的垂序遍历","titleSlug":"vertical-order-traversal-of-a-binary-tree"},{"formTitle":"[988]从叶结点开始的最小字符串","frontendQuestionId":"988","leaf":true,"level":2,"nodeType":"def","questionId":"1030","status":"","title":"从叶结点开始的最小字符串","titleSlug":"smallest-string-starting-from-leaf"},{"formTitle":"[989]数组形式的整数加法","frontendQuestionId":"989","leaf":true,"level":1,"nodeType":"def","questionId":"1031","status":"","title":"数组形式的整数加法","titleSlug":"add-to-array-form-of-integer"},{"formTitle":"[990]等式方程的可满足性","frontendQuestionId":"990","leaf":true,"level":2,"nodeType":"def","questionId":"1032","status":"","title":"等式方程的可满足性","titleSlug":"satisfiability-of-equality-equations"},{"formTitle":"[991]坏了的计算器","frontendQuestionId":"991","leaf":true,"level":2,"nodeType":"def","questionId":"1033","status":"","title":"坏了的计算器","titleSlug":"broken-calculator"},{"formTitle":"[992]K 个不同整数的子数组","frontendQuestionId":"992","leaf":true,"level":3,"nodeType":"def","questionId":"1034","status":"","title":"K 个不同整数的子数组","titleSlug":"subarrays-with-k-different-integers"},{"formTitle":"[993]二叉树的堂兄弟节点","frontendQuestionId":"993","leaf":true,"level":1,"nodeType":"def","questionId":"1035","status":"","title":"二叉树的堂兄弟节点","titleSlug":"cousins-in-binary-tree"},{"formTitle":"[994]腐烂的橘子","frontendQuestionId":"994","leaf":true,"level":1,"nodeType":"def","questionId":"1036","status":"","title":"腐烂的橘子","titleSlug":"rotting-oranges"},{"formTitle":"[995]K 连续位的最小翻转次数","frontendQuestionId":"995","leaf":true,"level":3,"nodeType":"def","questionId":"1037","status":"","title":"K 连续位的最小翻转次数","titleSlug":"minimum-number-of-k-consecutive-bit-flips"},{"formTitle":"[996]正方形数组的数目","frontendQuestionId":"996","leaf":true,"level":3,"nodeType":"def","questionId":"1038","status":"","title":"正方形数组的数目","titleSlug":"number-of-squareful-arrays"},{"formTitle":"[997]找到小镇的法官","frontendQuestionId":"997","leaf":true,"level":1,"nodeType":"def","questionId":"1039","status":"","title":"找到小镇的法官","titleSlug":"find-the-town-judge"},{"formTitle":"[998]最大二叉树 II","frontendQuestionId":"998","leaf":true,"level":2,"nodeType":"def","questionId":"1040","status":"","title":"最大二叉树 II","titleSlug":"maximum-binary-tree-ii"},{"formTitle":"[999]车的可用捕获量","frontendQuestionId":"999","leaf":true,"level":1,"nodeType":"def","questionId":"1041","status":"","title":"车的可用捕获量","titleSlug":"available-captures-for-rook"},{"formTitle":"[1000]合并石头的最低成本","frontendQuestionId":"1000","leaf":true,"level":3,"nodeType":"def","questionId":"1042","status":"","title":"合并石头的最低成本","titleSlug":"minimum-cost-to-merge-stones"},{"formTitle":"[1001]网格照明","frontendQuestionId":"1001","leaf":true,"level":3,"nodeType":"def","questionId":"1043","status":"","title":"网格照明","titleSlug":"grid-illumination"},{"formTitle":"[1002]查找常用字符","frontendQuestionId":"1002","leaf":true,"level":1,"nodeType":"def","questionId":"1044","status":"","title":"查找常用字符","titleSlug":"find-common-characters"},{"formTitle":"[1003]检查替换后的词是否有效","frontendQuestionId":"1003","leaf":true,"level":2,"nodeType":"def","questionId":"1045","status":"","title":"检查替换后的词是否有效","titleSlug":"check-if-word-is-valid-after-substitutions"},{"formTitle":"[1004]最大连续1的个数 III","frontendQuestionId":"1004","leaf":true,"level":2,"nodeType":"def","questionId":"1046","status":"","title":"最大连续1的个数 III","titleSlug":"max-consecutive-ones-iii"},{"formTitle":"[1005]K 次取反后最大化的数组和","frontendQuestionId":"1005","leaf":true,"level":1,"nodeType":"def","questionId":"1047","status":"","title":"K 次取反后最大化的数组和","titleSlug":"maximize-sum-of-array-after-k-negations"},{"formTitle":"[1006]笨阶乘","frontendQuestionId":"1006","leaf":true,"level":2,"nodeType":"def","questionId":"1048","status":"","title":"笨阶乘","titleSlug":"clumsy-factorial"},{"formTitle":"[1007]行相等的最少多米诺旋转","frontendQuestionId":"1007","leaf":true,"level":2,"nodeType":"def","questionId":"1049","status":"","title":"行相等的最少多米诺旋转","titleSlug":"minimum-domino-rotations-for-equal-row"},{"formTitle":"[1008]先序遍历构造二叉树","frontendQuestionId":"1008","leaf":true,"level":2,"nodeType":"def","questionId":"1050","status":"","title":"先序遍历构造二叉树","titleSlug":"construct-binary-search-tree-from-preorder-traversal"},{"formTitle":"[1009]十进制整数的反码","frontendQuestionId":"1009","leaf":true,"level":1,"nodeType":"def","questionId":"1054","status":"","title":"十进制整数的反码","titleSlug":"complement-of-base-10-integer"},{"formTitle":"[1010]总持续时间可被 60 整除的歌曲","frontendQuestionId":"1010","leaf":true,"level":1,"nodeType":"def","questionId":"1055","status":"","title":"总持续时间可被 60 整除的歌曲","titleSlug":"pairs-of-songs-with-total-durations-divisible-by-60"},{"formTitle":"[1011]在 D 天内送达包裹的能力","frontendQuestionId":"1011","leaf":true,"level":2,"nodeType":"def","questionId":"1056","status":"","title":"在 D 天内送达包裹的能力","titleSlug":"capacity-to-ship-packages-within-d-days"},{"formTitle":"[1012]至少有 1 位重复的数字","frontendQuestionId":"1012","leaf":true,"level":3,"nodeType":"def","questionId":"1057","status":"","title":"至少有 1 位重复的数字","titleSlug":"numbers-with-repeated-digits"},{"formTitle":"[1013]将数组分成和相等的三个部分","frontendQuestionId":"1013","leaf":true,"level":1,"nodeType":"def","questionId":"1062","status":"","title":"将数组分成和相等的三个部分","titleSlug":"partition-array-into-three-parts-with-equal-sum"},{"formTitle":"[1014]最佳观光组合","frontendQuestionId":"1014","leaf":true,"level":2,"nodeType":"def","questionId":"1063","status":"","title":"最佳观光组合","titleSlug":"best-sightseeing-pair"},{"formTitle":"[1015]可被 K 整除的最小整数","frontendQuestionId":"1015","leaf":true,"level":2,"nodeType":"def","questionId":"1064","status":"","title":"可被 K 整除的最小整数","titleSlug":"smallest-integer-divisible-by-k"},{"formTitle":"[1016]子串能表示从 1 到 N 数字的二进制串","frontendQuestionId":"1016","leaf":true,"level":2,"nodeType":"def","questionId":"1065","status":"","title":"子串能表示从 1 到 N 数字的二进制串","titleSlug":"binary-string-with-substrings-representing-1-to-n"},{"formTitle":"[1017]负二进制转换","frontendQuestionId":"1017","leaf":true,"level":2,"nodeType":"def","questionId":"1070","status":"","title":"负二进制转换","titleSlug":"convert-to-base-2"},{"formTitle":"[1018]可被 5 整除的二进制前缀","frontendQuestionId":"1018","leaf":true,"level":1,"nodeType":"def","questionId":"1071","status":"","title":"可被 5 整除的二进制前缀","titleSlug":"binary-prefix-divisible-by-5"},{"formTitle":"[1019]链表中的下一个更大节点","frontendQuestionId":"1019","leaf":true,"level":2,"nodeType":"def","questionId":"1072","status":"","title":"链表中的下一个更大节点","titleSlug":"next-greater-node-in-linked-list"},{"formTitle":"[1020]飞地的数量","frontendQuestionId":"1020","leaf":true,"level":2,"nodeType":"def","questionId":"1073","status":"","title":"飞地的数量","titleSlug":"number-of-enclaves"},{"formTitle":"[1021]删除最外层的括号","frontendQuestionId":"1021","leaf":true,"level":1,"nodeType":"def","questionId":"1078","status":"","title":"删除最外层的括号","titleSlug":"remove-outermost-parentheses"},{"formTitle":"[1022]从根到叶的二进制数之和","frontendQuestionId":"1022","leaf":true,"level":1,"nodeType":"def","questionId":"1079","status":"","title":"从根到叶的二进制数之和","titleSlug":"sum-of-root-to-leaf-binary-numbers"},{"formTitle":"[1023]驼峰式匹配","frontendQuestionId":"1023","leaf":true,"level":2,"nodeType":"def","questionId":"1080","status":"","title":"驼峰式匹配","titleSlug":"camelcase-matching"},{"formTitle":"[1024]视频拼接","frontendQuestionId":"1024","leaf":true,"level":2,"nodeType":"def","questionId":"1081","status":"","title":"视频拼接","titleSlug":"video-stitching"},{"formTitle":"[1025]除数博弈","frontendQuestionId":"1025","leaf":true,"level":1,"nodeType":"def","questionId":"1086","status":"","title":"除数博弈","titleSlug":"divisor-game"},{"formTitle":"[1026]节点与其祖先之间的最大差值","frontendQuestionId":"1026","leaf":true,"level":2,"nodeType":"def","questionId":"1092","status":"","title":"节点与其祖先之间的最大差值","titleSlug":"maximum-difference-between-node-and-ancestor"},{"formTitle":"[1027]最长等差数列","frontendQuestionId":"1027","leaf":true,"level":2,"nodeType":"def","questionId":"1087","status":"","title":"最长等差数列","titleSlug":"longest-arithmetic-sequence"},{"formTitle":"[1028]从先序遍历还原二叉树","frontendQuestionId":"1028","leaf":true,"level":3,"nodeType":"def","questionId":"1093","status":"","title":"从先序遍历还原二叉树","titleSlug":"recover-a-tree-from-preorder-traversal"},{"formTitle":"[1029]两地调度","frontendQuestionId":"1029","leaf":true,"level":1,"nodeType":"def","questionId":"1095","status":"","title":"两地调度","titleSlug":"two-city-scheduling"},{"formTitle":"[1030]距离顺序排列矩阵单元格","frontendQuestionId":"1030","leaf":true,"level":1,"nodeType":"def","questionId":"1094","status":"","title":"距离顺序排列矩阵单元格","titleSlug":"matrix-cells-in-distance-order"},{"formTitle":"[1031]两个非重叠子数组的最大和","frontendQuestionId":"1031","leaf":true,"level":2,"nodeType":"def","questionId":"1096","status":"","title":"两个非重叠子数组的最大和","titleSlug":"maximum-sum-of-two-non-overlapping-subarrays"},{"formTitle":"[1032]字符流","frontendQuestionId":"1032","leaf":true,"level":3,"nodeType":"def","questionId":"1097","status":"","title":"字符流","titleSlug":"stream-of-characters"},{"formTitle":"[1033]移动石子直到连续","frontendQuestionId":"1033","leaf":true,"level":1,"nodeType":"def","questionId":"1103","status":"","title":"移动石子直到连续","titleSlug":"moving-stones-until-consecutive"},{"formTitle":"[1034]边框着色","frontendQuestionId":"1034","leaf":true,"level":2,"nodeType":"def","questionId":"1104","status":"","title":"边框着色","titleSlug":"coloring-a-border"},{"formTitle":"[1035]不相交的线","frontendQuestionId":"1035","leaf":true,"level":2,"nodeType":"def","questionId":"1105","status":"","title":"不相交的线","titleSlug":"uncrossed-lines"},{"formTitle":"[1036]逃离大迷宫","frontendQuestionId":"1036","leaf":true,"level":3,"nodeType":"def","questionId":"1106","status":"","title":"逃离大迷宫","titleSlug":"escape-a-large-maze"},{"formTitle":"[1037]有效的回旋镖","frontendQuestionId":"1037","leaf":true,"level":1,"nodeType":"def","questionId":"1115","status":"","title":"有效的回旋镖","titleSlug":"valid-boomerang"},{"formTitle":"[1038]从二叉搜索树到更大和树","frontendQuestionId":"1038","leaf":true,"level":2,"nodeType":"def","questionId":"1114","status":"","title":"从二叉搜索树到更大和树","titleSlug":"binary-search-tree-to-greater-sum-tree"},{"formTitle":"[1039]多边形三角剖分的最低得分","frontendQuestionId":"1039","leaf":true,"level":2,"nodeType":"def","questionId":"1111","status":"","title":"多边形三角剖分的最低得分","titleSlug":"minimum-score-triangulation-of-polygon"},{"formTitle":"[1040]移动石子直到连续 II","frontendQuestionId":"1040","leaf":true,"level":2,"nodeType":"def","questionId":"1113","status":"","title":"移动石子直到连续 II","titleSlug":"moving-stones-until-consecutive-ii"},{"formTitle":"[1041]困于环中的机器人","frontendQuestionId":"1041","leaf":true,"level":2,"nodeType":"def","questionId":"1119","status":"","title":"困于环中的机器人","titleSlug":"robot-bounded-in-circle"},{"formTitle":"[1042]不邻接植花","frontendQuestionId":"1042","leaf":true,"level":1,"nodeType":"def","questionId":"1120","status":"","title":"不邻接植花","titleSlug":"flower-planting-with-no-adjacent"},{"formTitle":"[1043]分隔数组以得到最大和","frontendQuestionId":"1043","leaf":true,"level":2,"nodeType":"def","questionId":"1121","status":"","title":"分隔数组以得到最大和","titleSlug":"partition-array-for-maximum-sum"},{"formTitle":"[1044]最长重复子串","frontendQuestionId":"1044","leaf":true,"level":3,"nodeType":"def","questionId":"1122","status":"","title":"最长重复子串","titleSlug":"longest-duplicate-substring"},{"formTitle":"[1045]买下所有产品的客户","frontendQuestionId":"1045","leaf":true,"level":2,"nodeType":"def","questionId":"1135","status":"lock","title":"买下所有产品的客户","titleSlug":"customers-who-bought-all-products"},{"formTitle":"[1046]最后一块石头的重量","frontendQuestionId":"1046","leaf":true,"level":1,"nodeType":"def","questionId":"1127","status":"","title":"最后一块石头的重量","titleSlug":"last-stone-weight"},{"formTitle":"[1047]删除字符串中的所有相邻重复项","frontendQuestionId":"1047","leaf":true,"level":1,"nodeType":"def","questionId":"1128","status":"","title":"删除字符串中的所有相邻重复项","titleSlug":"remove-all-adjacent-duplicates-in-string"},{"formTitle":"[1048]最长字符串链","frontendQuestionId":"1048","leaf":true,"level":2,"nodeType":"def","questionId":"1129","status":"","title":"最长字符串链","titleSlug":"longest-string-chain"},{"formTitle":"[1049]最后一块石头的重量 II","frontendQuestionId":"1049","leaf":true,"level":2,"nodeType":"def","questionId":"1130","status":"","title":"最后一块石头的重量 II","titleSlug":"last-stone-weight-ii"},{"formTitle":"[1050]合作过至少三次的演员和导演","frontendQuestionId":"1050","leaf":true,"level":1,"nodeType":"def","questionId":"1136","status":"lock","title":"合作过至少三次的演员和导演","titleSlug":"actors-and-directors-who-cooperated-at-least-three-times"},{"formTitle":"[1051]高度检查器","frontendQuestionId":"1051","leaf":true,"level":1,"nodeType":"def","questionId":"1137","status":"","title":"高度检查器","titleSlug":"height-checker"},{"formTitle":"[1052]爱生气的书店老板","frontendQuestionId":"1052","leaf":true,"level":2,"nodeType":"def","questionId":"1138","status":"","title":"爱生气的书店老板","titleSlug":"grumpy-bookstore-owner"},{"formTitle":"[1053]交换一次的先前排列","frontendQuestionId":"1053","leaf":true,"level":2,"nodeType":"def","questionId":"1139","status":"","title":"交换一次的先前排列","titleSlug":"previous-permutation-with-one-swap"},{"formTitle":"[1054]距离相等的条形码","frontendQuestionId":"1054","leaf":true,"level":2,"nodeType":"def","questionId":"1140","status":"","title":"距离相等的条形码","titleSlug":"distant-barcodes"},{"formTitle":"[1055]形成字符串的最短路径","frontendQuestionId":"1055","leaf":true,"level":2,"nodeType":"def","questionId":"1051","status":"lock","title":"形成字符串的最短路径","titleSlug":"shortest-way-to-form-string"},{"formTitle":"[1056]易混淆数","frontendQuestionId":"1056","leaf":true,"level":1,"nodeType":"def","questionId":"1069","status":"lock","title":"易混淆数","titleSlug":"confusing-number"},{"formTitle":"[1057]校园自行车分配","frontendQuestionId":"1057","leaf":true,"level":2,"nodeType":"def","questionId":"1052","status":"lock","title":"校园自行车分配","titleSlug":"campus-bikes"},{"formTitle":"[1058]最小化舍入误差以满足目标","frontendQuestionId":"1058","leaf":true,"level":2,"nodeType":"def","questionId":"1053","status":"lock","title":"最小化舍入误差以满足目标","titleSlug":"minimize-rounding-error-to-meet-target"},{"formTitle":"[1059]从始点到终点的所有路径","frontendQuestionId":"1059","leaf":true,"level":2,"nodeType":"def","questionId":"511","status":"lock","title":"从始点到终点的所有路径","titleSlug":"all-paths-from-source-lead-to-destination"},{"formTitle":"[1060]有序数组中的缺失元素","frontendQuestionId":"1060","leaf":true,"level":2,"nodeType":"def","questionId":"1059","status":"lock","title":"有序数组中的缺失元素","titleSlug":"missing-element-in-sorted-array"},{"formTitle":"[1061]按字典序排列最小的等效字符串","frontendQuestionId":"1061","leaf":true,"level":2,"nodeType":"def","questionId":"1058","status":"lock","title":"按字典序排列最小的等效字符串","titleSlug":"lexicographically-smallest-equivalent-string"},{"formTitle":"[1062]最长重复子串","frontendQuestionId":"1062","leaf":true,"level":2,"nodeType":"def","questionId":"1060","status":"lock","title":"最长重复子串","titleSlug":"longest-repeating-substring"},{"formTitle":"[1063]有效子数组的数目","frontendQuestionId":"1063","leaf":true,"level":3,"nodeType":"def","questionId":"1061","status":"lock","title":"有效子数组的数目","titleSlug":"number-of-valid-subarrays"},{"formTitle":"[1064]不动点","frontendQuestionId":"1064","leaf":true,"level":1,"nodeType":"def","questionId":"1066","status":"lock","title":"不动点","titleSlug":"fixed-point"},{"formTitle":"[1065]字符串的索引对","frontendQuestionId":"1065","leaf":true,"level":1,"nodeType":"def","questionId":"1075","status":"lock","title":"字符串的索引对","titleSlug":"index-pairs-of-a-string"},{"formTitle":"[1066]校园自行车分配 II","frontendQuestionId":"1066","leaf":true,"level":2,"nodeType":"def","questionId":"1067","status":"lock","title":"校园自行车分配 II","titleSlug":"campus-bikes-ii"},{"formTitle":"[1067]范围内的数字计数","frontendQuestionId":"1067","leaf":true,"level":3,"nodeType":"def","questionId":"1068","status":"lock","title":"范围内的数字计数","titleSlug":"digit-count-in-range"},{"formTitle":"[1068]产品销售分析 I","frontendQuestionId":"1068","leaf":true,"level":1,"nodeType":"def","questionId":"1153","status":"lock","title":"产品销售分析 I","titleSlug":"product-sales-analysis-i"},{"formTitle":"[1069]产品销售分析 II","frontendQuestionId":"1069","leaf":true,"level":1,"nodeType":"def","questionId":"1154","status":"lock","title":"产品销售分析 II","titleSlug":"product-sales-analysis-ii"},{"formTitle":"[1070]产品销售分析 III","frontendQuestionId":"1070","leaf":true,"level":2,"nodeType":"def","questionId":"1155","status":"lock","title":"产品销售分析 III","titleSlug":"product-sales-analysis-iii"},{"formTitle":"[1071]字符串的最大公因子","frontendQuestionId":"1071","leaf":true,"level":1,"nodeType":"def","questionId":"1146","status":"","title":"字符串的最大公因子","titleSlug":"greatest-common-divisor-of-strings"},{"formTitle":"[1072]按列翻转得到最大值等行数","frontendQuestionId":"1072","leaf":true,"level":2,"nodeType":"def","questionId":"1147","status":"","title":"按列翻转得到最大值等行数","titleSlug":"flip-columns-for-maximum-number-of-equal-rows"},{"formTitle":"[1073]负二进制数相加","frontendQuestionId":"1073","leaf":true,"level":2,"nodeType":"def","questionId":"1148","status":"","title":"负二进制数相加","titleSlug":"adding-two-negabinary-numbers"},{"formTitle":"[1074]元素和为目标值的子矩阵数量","frontendQuestionId":"1074","leaf":true,"level":3,"nodeType":"def","questionId":"1145","status":"","title":"元素和为目标值的子矩阵数量","titleSlug":"number-of-submatrices-that-sum-to-target"},{"formTitle":"[1075]项目员工 I","frontendQuestionId":"1075","leaf":true,"level":1,"nodeType":"def","questionId":"1161","status":"lock","title":"项目员工 I","titleSlug":"project-employees-i"},{"formTitle":"[1076]项目员工II","frontendQuestionId":"1076","leaf":true,"level":1,"nodeType":"def","questionId":"1162","status":"lock","title":"项目员工II","titleSlug":"project-employees-ii"},{"formTitle":"[1077]项目员工 III","frontendQuestionId":"1077","leaf":true,"level":2,"nodeType":"def","questionId":"1163","status":"lock","title":"项目员工 III","titleSlug":"project-employees-iii"},{"formTitle":"[1078]Bigram 分词","frontendQuestionId":"1078","leaf":true,"level":1,"nodeType":"def","questionId":"1156","status":"","title":"Bigram 分词","titleSlug":"occurrences-after-bigram"},{"formTitle":"[1079]活字印刷","frontendQuestionId":"1079","leaf":true,"level":2,"nodeType":"def","questionId":"1160","status":"","title":"活字印刷","titleSlug":"letter-tile-possibilities"},{"formTitle":"[1080]根到叶路径上的不足节点","frontendQuestionId":"1080","leaf":true,"level":2,"nodeType":"def","questionId":"1157","status":"","title":"根到叶路径上的不足节点","titleSlug":"insufficient-nodes-in-root-to-leaf-paths"},{"formTitle":"[1081]不同字符的最小子序列","frontendQuestionId":"1081","leaf":true,"level":2,"nodeType":"def","questionId":"1159","status":"","title":"不同字符的最小子序列","titleSlug":"smallest-subsequence-of-distinct-characters"},{"formTitle":"[1082]销售分析 I ","frontendQuestionId":"1082","leaf":true,"level":1,"nodeType":"def","questionId":"1172","status":"lock","title":"销售分析 I ","titleSlug":"sales-analysis-i"},{"formTitle":"[1083]销售分析 II","frontendQuestionId":"1083","leaf":true,"level":1,"nodeType":"def","questionId":"1173","status":"lock","title":"销售分析 II","titleSlug":"sales-analysis-ii"},{"formTitle":"[1084]销售分析III","frontendQuestionId":"1084","leaf":true,"level":1,"nodeType":"def","questionId":"1174","status":"lock","title":"销售分析III","titleSlug":"sales-analysis-iii"},{"formTitle":"[1085]最小元素各数位之和","frontendQuestionId":"1085","leaf":true,"level":1,"nodeType":"def","questionId":"1082","status":"lock","title":"最小元素各数位之和","titleSlug":"sum-of-digits-in-the-minimum-number"},{"formTitle":"[1086]前五科的均分","frontendQuestionId":"1086","leaf":true,"level":1,"nodeType":"def","questionId":"1074","status":"lock","title":"前五科的均分","titleSlug":"high-five"},{"formTitle":"[1087]字母切换","frontendQuestionId":"1087","leaf":true,"level":2,"nodeType":"def","questionId":"1076","status":"lock","title":"字母切换","titleSlug":"brace-expansion"},{"formTitle":"[1088]易混淆数 II","frontendQuestionId":"1088","leaf":true,"level":3,"nodeType":"def","questionId":"1077","status":"lock","title":"易混淆数 II","titleSlug":"confusing-number-ii"},{"formTitle":"[1089]复写零","frontendQuestionId":"1089","leaf":true,"level":1,"nodeType":"def","questionId":"1168","status":"","title":"复写零","titleSlug":"duplicate-zeros"},{"formTitle":"[1090]受标签影响的最大值","frontendQuestionId":"1090","leaf":true,"level":2,"nodeType":"def","questionId":"1169","status":"","title":"受标签影响的最大值","titleSlug":"largest-values-from-labels"},{"formTitle":"[1091]二进制矩阵中的最短路径","frontendQuestionId":"1091","leaf":true,"level":2,"nodeType":"def","questionId":"1171","status":"","title":"二进制矩阵中的最短路径","titleSlug":"shortest-path-in-binary-matrix"},{"formTitle":"[1092]最短公共超序列","frontendQuestionId":"1092","leaf":true,"level":3,"nodeType":"def","questionId":"1170","status":"","title":"最短公共超序列","titleSlug":"shortest-common-supersequence"},{"formTitle":"[1093]大样本统计","frontendQuestionId":"1093","leaf":true,"level":2,"nodeType":"def","questionId":"1183","status":"","title":"大样本统计","titleSlug":"statistics-from-a-large-sample"},{"formTitle":"[1094]拼车","frontendQuestionId":"1094","leaf":true,"level":2,"nodeType":"def","questionId":"1184","status":"","title":"拼车","titleSlug":"car-pooling"},{"formTitle":"[1095]山脉数组中查找目标值","frontendQuestionId":"1095","leaf":true,"level":3,"nodeType":"def","questionId":"1185","status":"","title":"山脉数组中查找目标值","titleSlug":"find-in-mountain-array"},{"formTitle":"[1096]花括号展开 II","frontendQuestionId":"1096","leaf":true,"level":3,"nodeType":"def","questionId":"1188","status":"","title":"花括号展开 II","titleSlug":"brace-expansion-ii"},{"formTitle":"[1097]游戏玩法分析 V","frontendQuestionId":"1097","leaf":true,"level":3,"nodeType":"def","questionId":"1193","status":"lock","title":"游戏玩法分析 V","titleSlug":"game-play-analysis-v"},{"formTitle":"[1098]小众书籍","frontendQuestionId":"1098","leaf":true,"level":2,"nodeType":"def","questionId":"1198","status":"lock","title":"小众书籍","titleSlug":"unpopular-books"},{"formTitle":"[1099]小于 K 的两数之和","frontendQuestionId":"1099","leaf":true,"level":1,"nodeType":"def","questionId":"1083","status":"lock","title":"小于 K 的两数之和","titleSlug":"two-sum-less-than-k"},{"formTitle":"[1100]长度为 K 的无重复字符子串","frontendQuestionId":"1100","leaf":true,"level":2,"nodeType":"def","questionId":"1084","status":"lock","title":"长度为 K 的无重复字符子串","titleSlug":"find-k-length-substrings-with-no-repeated-characters"},{"formTitle":"[1101]彼此熟识的最早时间","frontendQuestionId":"1101","leaf":true,"level":2,"nodeType":"def","questionId":"1085","status":"lock","title":"彼此熟识的最早时间","titleSlug":"the-earliest-moment-when-everyone-become-friends"},{"formTitle":"[1102]得分最高的路径","frontendQuestionId":"1102","leaf":true,"level":2,"nodeType":"def","questionId":"1099","status":"lock","title":"得分最高的路径","titleSlug":"path-with-maximum-minimum-value"},{"formTitle":"[1103]分糖果 II","frontendQuestionId":"1103","leaf":true,"level":1,"nodeType":"def","questionId":"1195","status":"","title":"分糖果 II","titleSlug":"distribute-candies-to-people"},{"formTitle":"[1104]二叉树寻路","frontendQuestionId":"1104","leaf":true,"level":2,"nodeType":"def","questionId":"1194","status":"","title":"二叉树寻路","titleSlug":"path-in-zigzag-labelled-binary-tree"},{"formTitle":"[1105]填充书架","frontendQuestionId":"1105","leaf":true,"level":2,"nodeType":"def","questionId":"1196","status":"","title":"填充书架","titleSlug":"filling-bookcase-shelves"},{"formTitle":"[1106]解析布尔表达式","frontendQuestionId":"1106","leaf":true,"level":3,"nodeType":"def","questionId":"1197","status":"","title":"解析布尔表达式","titleSlug":"parsing-a-boolean-expression"},{"formTitle":"[1107]每日新用户统计","frontendQuestionId":"1107","leaf":true,"level":2,"nodeType":"def","questionId":"1204","status":"lock","title":"每日新用户统计","titleSlug":"new-users-daily-count"},{"formTitle":"[1108]IP 地址无效化","frontendQuestionId":"1108","leaf":true,"level":1,"nodeType":"def","questionId":"1205","status":"","title":"IP 地址无效化","titleSlug":"defanging-an-ip-address"},{"formTitle":"[1109]航班预订统计","frontendQuestionId":"1109","leaf":true,"level":2,"nodeType":"def","questionId":"1206","status":"","title":"航班预订统计","titleSlug":"corporate-flight-bookings"},{"formTitle":"[1110]删点成林","frontendQuestionId":"1110","leaf":true,"level":2,"nodeType":"def","questionId":"1207","status":"","title":"删点成林","titleSlug":"delete-nodes-and-return-forest"},{"formTitle":"[1111]有效括号的嵌套深度","frontendQuestionId":"1111","leaf":true,"level":2,"nodeType":"def","questionId":"1208","status":"","title":"有效括号的嵌套深度","titleSlug":"maximum-nesting-depth-of-two-valid-parentheses-strings"},{"formTitle":"[1112]Highest Grade For Each Student","frontendQuestionId":"1112","leaf":true,"level":2,"nodeType":"def","questionId":"1214","status":"lock","title":"Highest Grade For Each Student","titleSlug":"highest-grade-for-each-student"},{"formTitle":"[1113]Reported Posts","frontendQuestionId":"1113","leaf":true,"level":1,"nodeType":"def","questionId":"1215","status":"lock","title":"Reported Posts","titleSlug":"reported-posts"},{"formTitle":"[1114]按序打印","frontendQuestionId":"1114","leaf":true,"level":1,"nodeType":"def","questionId":"1203","status":"","title":"按序打印","titleSlug":"print-in-order"},{"formTitle":"[1115]交替打印FooBar","frontendQuestionId":"1115","leaf":true,"level":2,"nodeType":"def","questionId":"1187","status":"","title":"交替打印FooBar","titleSlug":"print-foobar-alternately"},{"formTitle":"[1116]打印零与奇偶数","frontendQuestionId":"1116","leaf":true,"level":2,"nodeType":"def","questionId":"1216","status":"","title":"打印零与奇偶数","titleSlug":"print-zero-even-odd"},{"formTitle":"[1117]H2O 生成","frontendQuestionId":"1117","leaf":true,"level":2,"nodeType":"def","questionId":"1186","status":"","title":"H2O 生成","titleSlug":"building-h2o"},{"formTitle":"[1118]一月有多少天","frontendQuestionId":"1118","leaf":true,"level":1,"nodeType":"def","questionId":"1088","status":"lock","title":"一月有多少天","titleSlug":"number-of-days-in-a-month"},{"formTitle":"[1119]删去字符串中的元音","frontendQuestionId":"1119","leaf":true,"level":1,"nodeType":"def","questionId":"1089","status":"lock","title":"删去字符串中的元音","titleSlug":"remove-vowels-from-a-string"},{"formTitle":"[1120]子树的最大平均值","frontendQuestionId":"1120","leaf":true,"level":2,"nodeType":"def","questionId":"1091","status":"lock","title":"子树的最大平均值","titleSlug":"maximum-average-subtree"},{"formTitle":"[1121]将数组分成几个递增序列","frontendQuestionId":"1121","leaf":true,"level":3,"nodeType":"def","questionId":"1118","status":"lock","title":"将数组分成几个递增序列","titleSlug":"divide-array-into-increasing-sequences"},{"formTitle":"[1122]数组的相对排序","frontendQuestionId":"1122","leaf":true,"level":1,"nodeType":"def","questionId":"1217","status":"","title":"数组的相对排序","titleSlug":"relative-sort-array"},{"formTitle":"[1123]最深叶节点的最近公共祖先","frontendQuestionId":"1123","leaf":true,"level":2,"nodeType":"def","questionId":"1218","status":"","title":"最深叶节点的最近公共祖先","titleSlug":"lowest-common-ancestor-of-deepest-leaves"},{"formTitle":"[1124]表现良好的最长时间段","frontendQuestionId":"1124","leaf":true,"level":2,"nodeType":"def","questionId":"1219","status":"","title":"表现良好的最长时间段","titleSlug":"longest-well-performing-interval"},{"formTitle":"[1125]最小的必要团队","frontendQuestionId":"1125","leaf":true,"level":3,"nodeType":"def","questionId":"1220","status":"","title":"最小的必要团队","titleSlug":"smallest-sufficient-team"},{"formTitle":"[1126]Active Businesses","frontendQuestionId":"1126","leaf":true,"level":2,"nodeType":"def","questionId":"1225","status":"lock","title":"Active Businesses","titleSlug":"active-businesses"},{"formTitle":"[1127]User Purchase Platform","frontendQuestionId":"1127","leaf":true,"level":3,"nodeType":"def","questionId":"1226","status":"lock","title":"User Purchase Platform","titleSlug":"user-purchase-platform"},{"formTitle":"[1128]等价多米诺骨牌对的数量","frontendQuestionId":"1128","leaf":true,"level":1,"nodeType":"def","questionId":"1227","status":"","title":"等价多米诺骨牌对的数量","titleSlug":"number-of-equivalent-domino-pairs"},{"formTitle":"[1129]颜色交替的最短路径","frontendQuestionId":"1129","leaf":true,"level":2,"nodeType":"def","questionId":"1229","status":"","title":"颜色交替的最短路径","titleSlug":"shortest-path-with-alternating-colors"},{"formTitle":"[1130]叶值的最小代价生成树","frontendQuestionId":"1130","leaf":true,"level":2,"nodeType":"def","questionId":"1228","status":"","title":"叶值的最小代价生成树","titleSlug":"minimum-cost-tree-from-leaf-values"},{"formTitle":"[1131]绝对值表达式的最大值","frontendQuestionId":"1131","leaf":true,"level":2,"nodeType":"def","questionId":"1230","status":"","title":"绝对值表达式的最大值","titleSlug":"maximum-of-absolute-value-expression"},{"formTitle":"[1132]Reported Posts II","frontendQuestionId":"1132","leaf":true,"level":2,"nodeType":"def","questionId":"1237","status":"lock","title":"Reported Posts II","titleSlug":"reported-posts-ii"},{"formTitle":"[1133]最大唯一数","frontendQuestionId":"1133","leaf":true,"level":1,"nodeType":"def","questionId":"1098","status":"lock","title":"最大唯一数","titleSlug":"largest-unique-number"},{"formTitle":"[1134]阿姆斯特朗数","frontendQuestionId":"1134","leaf":true,"level":1,"nodeType":"def","questionId":"1090","status":"lock","title":"阿姆斯特朗数","titleSlug":"armstrong-number"},{"formTitle":"[1135]最低成本联通所有城市","frontendQuestionId":"1135","leaf":true,"level":2,"nodeType":"def","questionId":"1100","status":"lock","title":"最低成本联通所有城市","titleSlug":"connecting-cities-with-minimum-cost"},{"formTitle":"[1136]平行课程","frontendQuestionId":"1136","leaf":true,"level":3,"nodeType":"def","questionId":"1101","status":"lock","title":"平行课程","titleSlug":"parallel-courses"},{"formTitle":"[1137]第 N 个泰波那契数","frontendQuestionId":"1137","leaf":true,"level":1,"nodeType":"def","questionId":"1236","status":"","title":"第 N 个泰波那契数","titleSlug":"n-th-tribonacci-number"},{"formTitle":"[1138]字母板上的路径","frontendQuestionId":"1138","leaf":true,"level":2,"nodeType":"def","questionId":"1238","status":"","title":"字母板上的路径","titleSlug":"alphabet-board-path"},{"formTitle":"[1139]最大的以 1 为边界的正方形","frontendQuestionId":"1139","leaf":true,"level":2,"nodeType":"def","questionId":"1239","status":"","title":"最大的以 1 为边界的正方形","titleSlug":"largest-1-bordered-square"},{"formTitle":"[1140]石子游戏 II","frontendQuestionId":"1140","leaf":true,"level":2,"nodeType":"def","questionId":"1240","status":"","title":"石子游戏 II","titleSlug":"stone-game-ii"},{"formTitle":"[1141]User Activity for the Past 30 Days I","frontendQuestionId":"1141","leaf":true,"level":1,"nodeType":"def","questionId":"1245","status":"lock","title":"User Activity for the Past 30 Days I","titleSlug":"user-activity-for-the-past-30-days-i"},{"formTitle":"[1142]User Activity for the Past 30 Days II","frontendQuestionId":"1142","leaf":true,"level":1,"nodeType":"def","questionId":"1246","status":"lock","title":"User Activity for the Past 30 Days II","titleSlug":"user-activity-for-the-past-30-days-ii"},{"formTitle":"[1143]最长公共子序列","frontendQuestionId":"1143","leaf":true,"level":2,"nodeType":"def","questionId":"1250","status":"","title":"最长公共子序列","titleSlug":"longest-common-subsequence"},{"formTitle":"[1144]递减元素使数组呈锯齿状","frontendQuestionId":"1144","leaf":true,"level":2,"nodeType":"def","questionId":"1247","status":"","title":"递减元素使数组呈锯齿状","titleSlug":"decrease-elements-to-make-array-zigzag"},{"formTitle":"[1145]二叉树着色游戏","frontendQuestionId":"1145","leaf":true,"level":2,"nodeType":"def","questionId":"1248","status":"","title":"二叉树着色游戏","titleSlug":"binary-tree-coloring-game"},{"formTitle":"[1146]快照数组","frontendQuestionId":"1146","leaf":true,"level":2,"nodeType":"def","questionId":"1249","status":"","title":"快照数组","titleSlug":"snapshot-array"},{"formTitle":"[1147]段式回文","frontendQuestionId":"1147","leaf":true,"level":3,"nodeType":"def","questionId":"1251","status":"","title":"段式回文","titleSlug":"longest-chunked-palindrome-decomposition"},{"formTitle":"[1148]Article Views I","frontendQuestionId":"1148","leaf":true,"level":1,"nodeType":"def","questionId":"1258","status":"lock","title":"Article Views I","titleSlug":"article-views-i"},{"formTitle":"[1149]Article Views II","frontendQuestionId":"1149","leaf":true,"level":2,"nodeType":"def","questionId":"1259","status":"lock","title":"Article Views II","titleSlug":"article-views-ii"},{"formTitle":"[1150]检查一个数是否在数组中占绝大多数","frontendQuestionId":"1150","leaf":true,"level":1,"nodeType":"def","questionId":"1102","status":"lock","title":"检查一个数是否在数组中占绝大多数","titleSlug":"check-if-a-number-is-majority-element-in-a-sorted-array"},{"formTitle":"[1151]最少交换次数来组合所有的 1","frontendQuestionId":"1151","leaf":true,"level":2,"nodeType":"def","questionId":"1107","status":"lock","title":"最少交换次数来组合所有的 1","titleSlug":"minimum-swaps-to-group-all-1s-together"},{"formTitle":"[1152]用户网站访问行为分析","frontendQuestionId":"1152","leaf":true,"level":2,"nodeType":"def","questionId":"1108","status":"lock","title":"用户网站访问行为分析","titleSlug":"analyze-user-website-visit-pattern"},{"formTitle":"[1153]字符串转化","frontendQuestionId":"1153","leaf":true,"level":3,"nodeType":"def","questionId":"1124","status":"lock","title":"字符串转化","titleSlug":"string-transforms-into-another-string"},{"formTitle":"[1154]一年中的第几天","frontendQuestionId":"1154","leaf":true,"level":1,"nodeType":"def","questionId":"1260","status":"","title":"一年中的第几天","titleSlug":"day-of-the-year"},{"formTitle":"[1155]掷骰子的N种方法","frontendQuestionId":"1155","leaf":true,"level":2,"nodeType":"def","questionId":"1263","status":"","title":"掷骰子的N种方法","titleSlug":"number-of-dice-rolls-with-target-sum"},{"formTitle":"[1156]单字符重复子串的最大长度","frontendQuestionId":"1156","leaf":true,"level":2,"nodeType":"def","questionId":"1261","status":"","title":"单字符重复子串的最大长度","titleSlug":"swap-for-longest-repeated-character-substring"},{"formTitle":"[1157]子数组中占绝大多数的元素","frontendQuestionId":"1157","leaf":true,"level":3,"nodeType":"def","questionId":"1262","status":"","title":"子数组中占绝大多数的元素","titleSlug":"online-majority-element-in-subarray"},{"formTitle":"[1158]Market Analysis I","frontendQuestionId":"1158","leaf":true,"level":2,"nodeType":"def","questionId":"1268","status":"lock","title":"Market Analysis I","titleSlug":"market-analysis-i"},{"formTitle":"[1159]Market Analysis II","frontendQuestionId":"1159","leaf":true,"level":3,"nodeType":"def","questionId":"1269","status":"lock","title":"Market Analysis II","titleSlug":"market-analysis-ii"},{"formTitle":"[1160]拼写单词","frontendQuestionId":"1160","leaf":true,"level":1,"nodeType":"def","questionId":"1112","status":"","title":"拼写单词","titleSlug":"find-words-that-can-be-formed-by-characters"},{"formTitle":"[1161]最大层内元素和","frontendQuestionId":"1161","leaf":true,"level":2,"nodeType":"def","questionId":"1116","status":"","title":"最大层内元素和","titleSlug":"maximum-level-sum-of-a-binary-tree"},{"formTitle":"[1162]地图分析","frontendQuestionId":"1162","leaf":true,"level":2,"nodeType":"def","questionId":"1117","status":"","title":"地图分析","titleSlug":"as-far-from-land-as-possible"},{"formTitle":"[1163]按字典序排在最后的子串","frontendQuestionId":"1163","leaf":true,"level":3,"nodeType":"def","questionId":"1133","status":"","title":"按字典序排在最后的子串","titleSlug":"last-substring-in-lexicographical-order"},{"formTitle":"[1164]Product Price at a Given Date","frontendQuestionId":"1164","leaf":true,"level":2,"nodeType":"def","questionId":"1278","status":"lock","title":"Product Price at a Given Date","titleSlug":"product-price-at-a-given-date"},{"formTitle":"[1165]单行键盘","frontendQuestionId":"1165","leaf":true,"level":1,"nodeType":"def","questionId":"1123","status":"lock","title":"单行键盘","titleSlug":"single-row-keyboard"},{"formTitle":"[1166]设计文件系统","frontendQuestionId":"1166","leaf":true,"level":2,"nodeType":"def","questionId":"1125","status":"lock","title":"设计文件系统","titleSlug":"design-file-system"},{"formTitle":"[1167]连接棒材的最低费用","frontendQuestionId":"1167","leaf":true,"level":2,"nodeType":"def","questionId":"1126","status":"lock","title":"连接棒材的最低费用","titleSlug":"minimum-cost-to-connect-sticks"},{"formTitle":"[1168]水资源分配优化","frontendQuestionId":"1168","leaf":true,"level":3,"nodeType":"def","questionId":"1144","status":"lock","title":"水资源分配优化","titleSlug":"optimize-water-distribution-in-a-village"},{"formTitle":"[1169]查询无效交易","frontendQuestionId":"1169","leaf":true,"level":2,"nodeType":"def","questionId":"1272","status":"","title":"查询无效交易","titleSlug":"invalid-transactions"},{"formTitle":"[1170]比较字符串最小字母出现频次","frontendQuestionId":"1170","leaf":true,"level":1,"nodeType":"def","questionId":"1273","status":"","title":"比较字符串最小字母出现频次","titleSlug":"compare-strings-by-frequency-of-the-smallest-character"},{"formTitle":"[1171]从链表中删去总和值为零的连续节点","frontendQuestionId":"1171","leaf":true,"level":2,"nodeType":"def","questionId":"1267","status":"","title":"从链表中删去总和值为零的连续节点","titleSlug":"remove-zero-sum-consecutive-nodes-from-linked-list"},{"formTitle":"[1172]餐盘栈","frontendQuestionId":"1172","leaf":true,"level":3,"nodeType":"def","questionId":"1270","status":"","title":"餐盘栈","titleSlug":"dinner-plate-stacks"},{"formTitle":"[1173]Immediate Food Delivery I","frontendQuestionId":"1173","leaf":true,"level":1,"nodeType":"def","questionId":"1291","status":"lock","title":"Immediate Food Delivery I","titleSlug":"immediate-food-delivery-i"},{"formTitle":"[1174]Immediate Food Delivery II","frontendQuestionId":"1174","leaf":true,"level":2,"nodeType":"def","questionId":"1292","status":"lock","title":"Immediate Food Delivery II","titleSlug":"immediate-food-delivery-ii"},{"formTitle":"[1175]质数排列","frontendQuestionId":"1175","leaf":true,"level":1,"nodeType":"def","questionId":"1279","status":"","title":"质数排列","titleSlug":"prime-arrangements"},{"formTitle":"[1176]健身计划评估","frontendQuestionId":"1176","leaf":true,"level":1,"nodeType":"def","questionId":"1280","status":"lock","title":"健身计划评估","titleSlug":"diet-plan-performance"},{"formTitle":"[1177]构建回文串检测","frontendQuestionId":"1177","leaf":true,"level":2,"nodeType":"def","questionId":"1281","status":"","title":"构建回文串检测","titleSlug":"can-make-palindrome-from-substring"},{"formTitle":"[1178]猜字谜","frontendQuestionId":"1178","leaf":true,"level":3,"nodeType":"def","questionId":"1282","status":"","title":"猜字谜","titleSlug":"number-of-valid-words-for-each-puzzle"},{"formTitle":"[1179]重新格式化部门表","frontendQuestionId":"1179","leaf":true,"level":1,"nodeType":"def","questionId":"1301","status":"","title":"重新格式化部门表","titleSlug":"reformat-department-table"},{"formTitle":"[1180]统计只含单一字母的子串","frontendQuestionId":"1180","leaf":true,"level":1,"nodeType":"def","questionId":"1131","status":"lock","title":"统计只含单一字母的子串","titleSlug":"count-substrings-with-only-one-distinct-letter"},{"formTitle":"[1181]前后拼接","frontendQuestionId":"1181","leaf":true,"level":2,"nodeType":"def","questionId":"1132","status":"lock","title":"前后拼接","titleSlug":"before-and-after-puzzle"},{"formTitle":"[1182]与目标颜色间的最短距离","frontendQuestionId":"1182","leaf":true,"level":2,"nodeType":"def","questionId":"1134","status":"lock","title":"与目标颜色间的最短距离","titleSlug":"shortest-distance-to-target-color"},{"formTitle":"[1183]矩阵中 1 的最大数量","frontendQuestionId":"1183","leaf":true,"level":3,"nodeType":"def","questionId":"1152","status":"lock","title":"矩阵中 1 的最大数量","titleSlug":"maximum-number-of-ones"},{"formTitle":"[1184]公交站间的距离","frontendQuestionId":"1184","leaf":true,"level":1,"nodeType":"def","questionId":"1287","status":"","title":"公交站间的距离","titleSlug":"distance-between-bus-stops"},{"formTitle":"[1185]一周中的第几天","frontendQuestionId":"1185","leaf":true,"level":1,"nodeType":"def","questionId":"1289","status":"","title":"一周中的第几天","titleSlug":"day-of-the-week"},{"formTitle":"[1186]删除一次得到子数组最大和","frontendQuestionId":"1186","leaf":true,"level":2,"nodeType":"def","questionId":"1288","status":"","title":"删除一次得到子数组最大和","titleSlug":"maximum-subarray-sum-with-one-deletion"},{"formTitle":"[1187]使数组严格递增","frontendQuestionId":"1187","leaf":true,"level":3,"nodeType":"def","questionId":"1290","status":"","title":"使数组严格递增","titleSlug":"make-array-strictly-increasing"},{"formTitle":"[1188]设计有限阻塞队列","frontendQuestionId":"1188","leaf":true,"level":2,"nodeType":"def","questionId":"1209","status":"lock","title":"设计有限阻塞队列","titleSlug":"design-bounded-blocking-queue"},{"formTitle":"[1189]“气球” 的最大数量","frontendQuestionId":"1189","leaf":true,"level":1,"nodeType":"def","questionId":"1297","status":"","title":"“气球” 的最大数量","titleSlug":"maximum-number-of-balloons"},{"formTitle":"[1190]反转每对括号间的子串","frontendQuestionId":"1190","leaf":true,"level":2,"nodeType":"def","questionId":"1298","status":"","title":"反转每对括号间的子串","titleSlug":"reverse-substrings-between-each-pair-of-parentheses"},{"formTitle":"[1191]K 次串联后最大子数组之和","frontendQuestionId":"1191","leaf":true,"level":2,"nodeType":"def","questionId":"1299","status":"","title":"K 次串联后最大子数组之和","titleSlug":"k-concatenation-maximum-sum"},{"formTitle":"[1192]查找集群内的「关键连接」","frontendQuestionId":"1192","leaf":true,"level":3,"nodeType":"def","questionId":"1300","status":"","title":"查找集群内的「关键连接」","titleSlug":"critical-connections-in-a-network"},{"formTitle":"[1193]每月交易 I","frontendQuestionId":"1193","leaf":true,"level":2,"nodeType":"def","questionId":"1317","status":"lock","title":"每月交易 I","titleSlug":"monthly-transactions-i"},{"formTitle":"[1194]锦标赛优胜者","frontendQuestionId":"1194","leaf":true,"level":3,"nodeType":"def","questionId":"1318","status":"lock","title":"锦标赛优胜者","titleSlug":"tournament-winners"},{"formTitle":"[1195]交替打印字符串","frontendQuestionId":"1195","leaf":true,"level":2,"nodeType":"def","questionId":"1316","status":"","title":"交替打印字符串","titleSlug":"fizz-buzz-multithreaded"},{"formTitle":"[1196]最多可以买到的苹果数量","frontendQuestionId":"1196","leaf":true,"level":1,"nodeType":"def","questionId":"1141","status":"lock","title":"最多可以买到的苹果数量","titleSlug":"how-many-apples-can-you-put-into-the-basket"},{"formTitle":"[1197]进击的骑士","frontendQuestionId":"1197","leaf":true,"level":2,"nodeType":"def","questionId":"1142","status":"lock","title":"进击的骑士","titleSlug":"minimum-knight-moves"},{"formTitle":"[1198]找出所有行中最小公共元素","frontendQuestionId":"1198","leaf":true,"level":2,"nodeType":"def","questionId":"1143","status":"lock","title":"找出所有行中最小公共元素","titleSlug":"find-smallest-common-element-in-all-rows"},{"formTitle":"[1199]建造街区的最短时间","frontendQuestionId":"1199","leaf":true,"level":3,"nodeType":"def","questionId":"1167","status":"lock","title":"建造街区的最短时间","titleSlug":"minimum-time-to-build-blocks"},{"formTitle":"[1200]最小绝对差","frontendQuestionId":"1200","leaf":true,"level":1,"nodeType":"def","questionId":"1306","status":"","title":"最小绝对差","titleSlug":"minimum-absolute-difference"},{"formTitle":"[1201]丑数 III","frontendQuestionId":"1201","leaf":true,"level":2,"nodeType":"def","questionId":"1307","status":"","title":"丑数 III","titleSlug":"ugly-number-iii"},{"formTitle":"[1202]交换字符串中的元素","frontendQuestionId":"1202","leaf":true,"level":2,"nodeType":"def","questionId":"1308","status":"","title":"交换字符串中的元素","titleSlug":"smallest-string-with-swaps"},{"formTitle":"[1203]项目管理","frontendQuestionId":"1203","leaf":true,"level":3,"nodeType":"def","questionId":"1309","status":"","title":"项目管理","titleSlug":"sort-items-by-groups-respecting-dependencies"},{"formTitle":"[1204]Last Person to Fit in the Elevator","frontendQuestionId":"1204","leaf":true,"level":2,"nodeType":"def","questionId":"1327","status":"lock","title":"Last Person to Fit in the Elevator","titleSlug":"last-person-to-fit-in-the-elevator"},{"formTitle":"[1205]每月交易II","frontendQuestionId":"1205","leaf":true,"level":2,"nodeType":"def","questionId":"1328","status":"lock","title":"每月交易II","titleSlug":"monthly-transactions-ii"},{"formTitle":"[1206]设计跳表","frontendQuestionId":"1206","leaf":true,"level":3,"nodeType":"def","questionId":"1337","status":"","title":"设计跳表","titleSlug":"design-skiplist"},{"formTitle":"[1207]独一无二的出现次数","frontendQuestionId":"1207","leaf":true,"level":1,"nodeType":"def","questionId":"1319","status":"","title":"独一无二的出现次数","titleSlug":"unique-number-of-occurrences"},{"formTitle":"[1208]尽可能使字符串相等","frontendQuestionId":"1208","leaf":true,"level":2,"nodeType":"def","questionId":"1321","status":"","title":"尽可能使字符串相等","titleSlug":"get-equal-substrings-within-budget"},{"formTitle":"[1209]删除字符串中的所有相邻重复项 II","frontendQuestionId":"1209","leaf":true,"level":2,"nodeType":"def","questionId":"1320","status":"","title":"删除字符串中的所有相邻重复项 II","titleSlug":"remove-all-adjacent-duplicates-in-string-ii"},{"formTitle":"[1210]穿过迷宫的最少移动次数","frontendQuestionId":"1210","leaf":true,"level":3,"nodeType":"def","questionId":"1322","status":"","title":"穿过迷宫的最少移动次数","titleSlug":"minimum-moves-to-reach-target-with-rotations"},{"formTitle":"[1211]Queries Quality and Percentage","frontendQuestionId":"1211","leaf":true,"level":1,"nodeType":"def","questionId":"1338","status":"lock","title":"Queries Quality and Percentage","titleSlug":"queries-quality-and-percentage"},{"formTitle":"[1212]Team Scores in Football Tournament","frontendQuestionId":"1212","leaf":true,"level":2,"nodeType":"def","questionId":"1339","status":"lock","title":"Team Scores in Football Tournament","titleSlug":"team-scores-in-football-tournament"},{"formTitle":"[1213]三个有序数组的交集","frontendQuestionId":"1213","leaf":true,"level":1,"nodeType":"def","questionId":"1149","status":"lock","title":"三个有序数组的交集","titleSlug":"intersection-of-three-sorted-arrays"},{"formTitle":"[1214]查找两棵二叉搜索树之和","frontendQuestionId":"1214","leaf":true,"level":2,"nodeType":"def","questionId":"1150","status":"lock","title":"查找两棵二叉搜索树之和","titleSlug":"two-sum-bsts"},{"formTitle":"[1215]步进数","frontendQuestionId":"1215","leaf":true,"level":2,"nodeType":"def","questionId":"1151","status":"lock","title":"步进数","titleSlug":"stepping-numbers"},{"formTitle":"[1216]验证回文字符串 III","frontendQuestionId":"1216","leaf":true,"level":3,"nodeType":"def","questionId":"1178","status":"lock","title":"验证回文字符串 III","titleSlug":"valid-palindrome-iii"},{"formTitle":"[1217]玩筹码","frontendQuestionId":"1217","leaf":true,"level":1,"nodeType":"def","questionId":"1329","status":"","title":"玩筹码","titleSlug":"play-with-chips"},{"formTitle":"[1218]最长定差子序列","frontendQuestionId":"1218","leaf":true,"level":2,"nodeType":"def","questionId":"1330","status":"","title":"最长定差子序列","titleSlug":"longest-arithmetic-subsequence-of-given-difference"},{"formTitle":"[1219]黄金矿工","frontendQuestionId":"1219","leaf":true,"level":2,"nodeType":"def","questionId":"1331","status":"","title":"黄金矿工","titleSlug":"path-with-maximum-gold"},{"formTitle":"[1220]统计元音字母序列的数目","frontendQuestionId":"1220","leaf":true,"level":3,"nodeType":"def","questionId":"1332","status":"","title":"统计元音字母序列的数目","titleSlug":"count-vowels-permutation"},{"formTitle":"[1221]分割平衡字符串","frontendQuestionId":"1221","leaf":true,"level":1,"nodeType":"def","questionId":"1341","status":"","title":"分割平衡字符串","titleSlug":"split-a-string-in-balanced-strings"},{"formTitle":"[1222]可以攻击国王的皇后","frontendQuestionId":"1222","leaf":true,"level":2,"nodeType":"def","questionId":"1342","status":"","title":"可以攻击国王的皇后","titleSlug":"queens-that-can-attack-the-king"},{"formTitle":"[1223]掷骰子模拟","frontendQuestionId":"1223","leaf":true,"level":2,"nodeType":"def","questionId":"1343","status":"","title":"掷骰子模拟","titleSlug":"dice-roll-simulation"},{"formTitle":"[1224]最大相等频率","frontendQuestionId":"1224","leaf":true,"level":3,"nodeType":"def","questionId":"1344","status":"","title":"最大相等频率","titleSlug":"maximum-equal-frequency"},{"formTitle":"[1225]Report Contiguous Dates","frontendQuestionId":"1225","leaf":true,"level":3,"nodeType":"def","questionId":"1357","status":"","title":"Report Contiguous Dates","titleSlug":"report-contiguous-dates"},{"formTitle":"[1226]The Dining Philosophers","frontendQuestionId":"1226","leaf":true,"level":2,"nodeType":"def","questionId":"1340","status":"","title":"The Dining Philosophers","titleSlug":"the-dining-philosophers"},{"formTitle":"[1228]等差数列中缺失的数字","frontendQuestionId":"1228","leaf":true,"level":1,"nodeType":"def","questionId":"1164","status":"lock","title":"等差数列中缺失的数字","titleSlug":"missing-number-in-arithmetic-progression"},{"formTitle":"[1229]安排会议日程","frontendQuestionId":"1229","leaf":true,"level":2,"nodeType":"def","questionId":"1165","status":"lock","title":"安排会议日程","titleSlug":"meeting-scheduler"},{"formTitle":"[1230]抛掷硬币","frontendQuestionId":"1230","leaf":true,"level":2,"nodeType":"def","questionId":"1166","status":"lock","title":"抛掷硬币","titleSlug":"toss-strange-coins"},{"formTitle":"[1231]分享巧克力","frontendQuestionId":"1231","leaf":true,"level":3,"nodeType":"def","questionId":"1192","status":"lock","title":"分享巧克力","titleSlug":"divide-chocolate"},{"formTitle":"[1232]缀点成线","frontendQuestionId":"1232","leaf":true,"level":1,"nodeType":"def","questionId":"1349","status":"","title":"缀点成线","titleSlug":"check-if-it-is-a-straight-line"},{"formTitle":"[1233]删除子文件夹","frontendQuestionId":"1233","leaf":true,"level":2,"nodeType":"def","questionId":"1350","status":"","title":"删除子文件夹","titleSlug":"remove-sub-folders-from-the-filesystem"},{"formTitle":"[1234]替换子串得到平衡字符串","frontendQuestionId":"1234","leaf":true,"level":2,"nodeType":"def","questionId":"1351","status":"","title":"替换子串得到平衡字符串","titleSlug":"replace-the-substring-for-balanced-string"},{"formTitle":"[1235]规划兼职工作","frontendQuestionId":"1235","leaf":true,"level":3,"nodeType":"def","questionId":"1352","status":"","title":"规划兼职工作","titleSlug":"maximum-profit-in-job-scheduling"},{"formTitle":"[1236]Web Crawler","frontendQuestionId":"1236","leaf":true,"level":2,"nodeType":"def","questionId":"1271","status":"lock","title":"Web Crawler","titleSlug":"web-crawler"},{"formTitle":"[LCP 1]猜数字","frontendQuestionId":"LCP 1","leaf":true,"level":1,"nodeType":"def","questionId":"100107","status":"","title":"猜数字","titleSlug":"guess-numbers"},{"formTitle":"[LCP 2]分式化简","frontendQuestionId":"LCP 2","leaf":true,"level":1,"nodeType":"def","questionId":"100092","status":"","title":"分式化简","titleSlug":"deep-dark-fraction"},{"formTitle":"[LCP 3]机器人大冒险","frontendQuestionId":"LCP 3","leaf":true,"level":2,"nodeType":"def","questionId":"100096","status":"","title":"机器人大冒险","titleSlug":"programmable-robot"},{"formTitle":"[LCP 4]覆盖","frontendQuestionId":"LCP 4","leaf":true,"level":3,"nodeType":"def","questionId":"100093","status":"","title":"覆盖","titleSlug":"broken-board-dominoes"},{"formTitle":"[LCP 5]发 LeetCoin","frontendQuestionId":"LCP 5","leaf":true,"level":3,"nodeType":"def","questionId":"100094","status":"","title":"发 LeetCoin","titleSlug":"coin-bonus"}]
\ No newline at end of file
diff --git a/algorithms/TempFilePath/leetcode/editor/cn/translation.json b/algorithms/TempFilePath/leetcode/editor/cn/translation.json
deleted file mode 100644
index f0574163..00000000
--- a/algorithms/TempFilePath/leetcode/editor/cn/translation.json
+++ /dev/null
@@ -1 +0,0 @@
-{"data":{"translations":[{"title":"\u4e24\u6570\u4e4b\u548c","question":{"questionId":"1","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u76f8\u52a0","question":{"questionId":"2","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32","question":{"questionId":"3","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u4e24\u4e2a\u6709\u5e8f\u6570\u7ec4\u7684\u4e2d\u4f4d\u6570","question":{"questionId":"4","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u56de\u6587\u5b50\u4e32","question":{"questionId":"5","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u4e24\u4e2a\u6709\u5e8f\u94fe\u8868","question":{"questionId":"21","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u5b57\u7b26\u4e32","question":{"questionId":"344","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6392\u5e8f\u6570\u7ec4\u4e2d\u7684\u91cd\u590d\u9879","question":{"questionId":"26","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6768\u8f89\u4e09\u89d2 II","question":{"questionId":"119","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6574\u6570\u53cd\u8f6c","question":{"questionId":"7","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u540e\u4e00\u4e2a\u5355\u8bcd\u7684\u957f\u5ea6","question":{"questionId":"58","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u8fdb\u5236\u6c42\u548c","question":{"questionId":"67","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f57\u9a6c\u6570\u5b57\u8f6c\u6574\u6570","question":{"questionId":"13","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d","question":{"questionId":"10","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u722c\u697c\u68af","question":{"questionId":"70","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u6570","question":{"questionId":"9","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u516c\u5171\u524d\u7f00","question":{"questionId":"14","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u5bb6\u52ab\u820d","question":{"questionId":"198","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6574\u6570\u8f6c\u7f57\u9a6c\u6570\u5b57","question":{"questionId":"12","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Z \u5b57\u5f62\u53d8\u6362","question":{"questionId":"6","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u7687\u540e","question":{"questionId":"51","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u9664\u5143\u7d20","question":{"questionId":"27","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408\u4e24\u4e2a\u8868","question":{"questionId":"175","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u5b8c\u5168\u5e73\u65b9\u6570","question":{"questionId":"367","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56db\u6570\u4e4b\u548c","question":{"questionId":"18","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u65f6\u95f4\u5dee","question":{"questionId":"539","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u56fe\u50cf","question":{"questionId":"48","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Pow(x, n)","question":{"questionId":"50","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"x \u7684\u5e73\u65b9\u6839","question":{"questionId":"69","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u6570\u4e4b\u548c","question":{"questionId":"15","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u63a5\u8fd1\u7684\u4e09\u6570\u4e4b\u548c","question":{"questionId":"16","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u6570\u72ec","question":{"questionId":"36","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408\u603b\u548c II","question":{"questionId":"40","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u8f6c\u6362\u6574\u6570 (atoi)","question":{"questionId":"8","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u63d2\u5165\u4f4d\u7f6e","question":{"questionId":"35","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7535\u8bdd\u53f7\u7801\u7684\u5b57\u6bcd\u7ec4\u5408","question":{"questionId":"17","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62ec\u53f7\u751f\u6210","question":{"questionId":"22","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u62ec\u53f7","question":{"questionId":"20","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u94fe\u8868\u7684\u5012\u6570\u7b2cN\u4e2a\u8282\u70b9","question":{"questionId":"19","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7535\u8bdd\u53f7\u7801","question":{"questionId":"193","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u6570\u7ec4\u6700\u5927\u5e73\u5747\u6570 I","question":{"questionId":"643","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c\u5341\u884c","question":{"questionId":"195","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u6b63\u65b9\u5f62","question":{"questionId":"593","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6392\u5e8f\u94fe\u8868\u4e2d\u7684\u91cd\u590d\u5143\u7d20","question":{"questionId":"83","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u8bcd\u9891","question":{"questionId":"192","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u76f8\u9664","question":{"questionId":"29","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b9e\u73b0 strStr()","question":{"questionId":"28","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f6c\u7f6e\u6587\u4ef6","question":{"questionId":"194","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u7687\u540e II","question":{"questionId":"52","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5212\u5206\u4e3ak\u4e2a\u76f8\u7b49\u7684\u5b50\u96c6","question":{"questionId":"698","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u6bcf\u4e2a\u6811\u884c\u4e2d\u627e\u6700\u5927\u503c","question":{"questionId":"515","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c47\u603b\u533a\u95f4","question":{"questionId":"228","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u6811\u5de6\u4e0b\u89d2\u7684\u503c","question":{"questionId":"513","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668","question":{"questionId":"11","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6570\u5b57","question":{"questionId":"136","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5168\u6392\u5217","question":{"questionId":"46","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76K\u4e2a\u6392\u5e8f\u94fe\u8868","question":{"questionId":"23","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2cK\u4e2a\u8bed\u6cd5\u7b26\u53f7","question":{"questionId":"795","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e24\u4ea4\u6362\u94fe\u8868\u4e2d\u7684\u8282\u70b9","question":{"questionId":"24","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u76f8\u4e58","question":{"questionId":"43","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8df3\u8dc3\u6e38\u620f","question":{"questionId":"55","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u6392\u5e8f\u6570\u7ec4\u4e2d\u67e5\u627e\u5143\u7d20\u7684\u7b2c\u4e00\u4e2a\u548c\u6700\u540e\u4e00\u4e2a\u4f4d\u7f6e","question":{"questionId":"34","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u5f02\u4f4d\u8bcd\u5206\u7ec4","question":{"questionId":"49","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u56de\u6587\u4e32","question":{"questionId":"125","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u7684\u6392\u5217","question":{"questionId":"567","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e73\u65b9\u6570\u4e4b\u548c","question":{"questionId":"633","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e11\u6570","question":{"questionId":"263","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e11\u6570 II","question":{"questionId":"264","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b8c\u7f8e\u6570","question":{"questionId":"507","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u533a\u95f4","question":{"questionId":"56","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e73\u8861\u4e8c\u53c9\u6811","question":{"questionId":"110","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u6700\u5927\u6df1\u5ea6","question":{"questionId":"104","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5feb\u4e50\u6570","question":{"questionId":"202","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u94fe\u8868","question":{"questionId":"206","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u94fe\u8868","question":{"questionId":"234","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5404\u4f4d\u76f8\u52a0","question":{"questionId":"258","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f3a\u5931\u6570\u5b57","question":{"questionId":"268","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c\u4e00\u4e2a\u9519\u8bef\u7684\u7248\u672c","question":{"questionId":"278","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u52a8\u96f6","question":{"questionId":"283","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u6570\u5b57\u5927\u5c0f","question":{"questionId":"374","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u4e2d\u7684\u7b2c\u4e00\u4e2a\u552f\u4e00\u5b57\u7b26","question":{"questionId":"387","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u8fdb\u5236\u624b\u8868","question":{"questionId":"401","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c\u4e8c\u9ad8\u7684\u85aa\u6c34","question":{"questionId":"176","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e32\u8054\u6240\u6709\u5355\u8bcd\u7684\u5b50\u4e32","question":{"questionId":"30","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u8fc7\u7ecf\u7406\u6536\u5165\u7684\u5458\u5de5","question":{"questionId":"181","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u90e8\u95e8\u5de5\u8d44\u524d\u4e09\u9ad8\u7684\u6240\u6709\u5458\u5de5","question":{"questionId":"185","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408\u603b\u548c","question":{"questionId":"39","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u901a\u914d\u7b26\u5339\u914d","question":{"questionId":"44","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62a5\u6570","question":{"questionId":"38","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u65cb\u8f6c\u6392\u5e8f\u6570\u7ec4","question":{"questionId":"33","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u6709\u6548\u62ec\u53f7","question":{"questionId":"32","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89e3\u6570\u72ec","question":{"questionId":"37","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f3a\u5931\u7684\u7b2c\u4e00\u4e2a\u6b63\u6570","question":{"questionId":"41","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63a5\u96e8\u6c34","question":{"questionId":"42","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5b50\u5e8f\u548c","question":{"questionId":"53","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0b\u4e00\u4e2a\u6392\u5217","question":{"questionId":"31","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u87ba\u65cb\u77e9\u9635","question":{"questionId":"54","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u5356\u80a1\u7968\u7684\u6700\u4f73\u65f6\u673a","question":{"questionId":"121","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u5356\u80a1\u7968\u7684\u6700\u4f73\u65f6\u673a II","question":{"questionId":"122","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u4e0d\u540c","question":{"questionId":"389","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5de6\u53f6\u5b50\u4e4b\u548c","question":{"questionId":"404","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2\u7684\u5e42","question":{"questionId":"231","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u4e2a\u4e00\u7ec4\u7ffb\u8f6c\u94fe\u8868","question":{"questionId":"25","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6574\u6570\u4e4b\u548c","question":{"questionId":"371","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bf9\u79f0\u4e8c\u53c9\u6811","question":{"questionId":"101","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Fizz Buzz","question":{"questionId":"412","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u4e24\u4e2a\u6709\u5e8f\u6570\u7ec4","question":{"questionId":"88","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2cN\u9ad8\u7684\u85aa\u6c34","question":{"questionId":"177","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u540c\u7684\u6811","question":{"questionId":"100","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73af\u5f62\u94fe\u8868","question":{"questionId":"141","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8df3\u8dc3\u6e38\u620f II","question":{"questionId":"45","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u52a0\u4e00","question":{"questionId":"66","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u94fe\u8868 II","question":{"questionId":"92","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u4ea4\u94fe\u8868","question":{"questionId":"160","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u4e4b\u548c II - \u8f93\u5165\u6709\u5e8f\u6570\u7ec4","question":{"questionId":"167","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c42\u4f17\u6570","question":{"questionId":"169","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5c42\u5e73\u5747\u503c","question":{"questionId":"637","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6768\u8f89\u4e09\u89d2","question":{"questionId":"118","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u5b57\u7b26\u4e32 II","question":{"questionId":"541","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6709\u5e8f\u6570\u7ec4\u8f6c\u6362\u4e3a\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"108","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u952e\u76d8\u884c","question":{"questionId":"500","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u62ec\u53f7\u5b57\u7b26\u4e32","question":{"questionId":"678","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u673a\u5668\u4eba\u80fd\u5426\u8fd4\u56de\u539f\u70b9","question":{"questionId":"657","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u76f8\u52a0","question":{"questionId":"415","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u636e\u4e8c\u53c9\u6811\u521b\u5efa\u5b57\u7b26\u4e32","question":{"questionId":"606","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Excel\u8868\u5217\u5e8f\u53f7","question":{"questionId":"171","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Excel\u8868\u5217\u540d\u79f0","question":{"questionId":"168","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u87ba\u65cb\u77e9\u9635 II","question":{"questionId":"59","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2ck\u4e2a\u6392\u5217","question":{"questionId":"60","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63d2\u5165\u533a\u95f4","question":{"questionId":"57","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u9519\u5b57\u7b26\u4e32","question":{"questionId":"97","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u94fe\u8868","question":{"questionId":"61","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u8def\u5f84","question":{"questionId":"62","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u8def\u5f84 II","question":{"questionId":"63","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u6570\u5b57","question":{"questionId":"65","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u8def\u5f84\u548c","question":{"questionId":"64","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b80\u5316\u8def\u5f84","question":{"questionId":"71","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f16\u8f91\u8ddd\u79bb","question":{"questionId":"72","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ba1\u6570\u8d28\u6570","question":{"questionId":"204","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u9635\u7f6e\u96f6","question":{"questionId":"73","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73af\u5f62\u94fe\u8868 II","question":{"questionId":"142","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u6808","question":{"questionId":"155","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u540c\u6784\u5b57\u7b26\u4e32","question":{"questionId":"205","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u9694\u94fe\u8868","question":{"questionId":"86","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5168\u6392\u5217 II","question":{"questionId":"47","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u96c6","question":{"questionId":"78","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u96c6 II","question":{"questionId":"90","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6233\u6c14\u7403","question":{"questionId":"312","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62fc\u63a5\u6700\u5927\u6570","question":{"questionId":"321","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u524dK\u4e2a\u9ad8\u9891\u5355\u8bcd","question":{"questionId":"692","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d26\u6237\u5408\u5e76","question":{"questionId":"721","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b58\u5728\u91cd\u590d\u5143\u7d20","question":{"questionId":"217","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b58\u5728\u91cd\u590d\u5143\u7d20 II","question":{"questionId":"219","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b58\u5728\u91cd\u590d\u5143\u7d20 III","question":{"questionId":"220","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u6700\u5c0f\u6df1\u5ea6","question":{"questionId":"111","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408","question":{"questionId":"77","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u641c\u7d22","question":{"questionId":"79","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u65cb\u8f6c\u6392\u5e8f\u6570\u7ec4 II","question":{"questionId":"81","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u683c\u96f7\u7f16\u7801","question":{"questionId":"89","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u590d\u539fIP\u5730\u5740","question":{"questionId":"93","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u6570\u7ec4\u7684\u4ea4\u96c6 II","question":{"questionId":"350","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u4e2d\u5e8f\u904d\u5386","question":{"questionId":"94","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd III","question":{"questionId":"557","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u7684\u4e8c\u53c9\u641c\u7d22\u6811 II","question":{"questionId":"95","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u7684\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"96","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"98","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6062\u590d\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"99","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u952f\u9f7f\u5f62\u5c42\u6b21\u904d\u5386","question":{"questionId":"103","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5c42\u6b21\u904d\u5386","question":{"questionId":"102","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8def\u5f84\u603b\u548c","question":{"questionId":"112","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5c42\u6b21\u904d\u5386 II","question":{"questionId":"107","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u8fde\u7eed1\u7684\u4e2a\u6570","question":{"questionId":"485","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u4e2a\u6570\u7684\u6700\u5927\u4e58\u79ef","question":{"questionId":"628","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89e3\u7801\u65b9\u6cd5","question":{"questionId":"91","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u5b57\u8f6c\u6362\u4e3a\u5341\u516d\u8fdb\u5236\u6570","question":{"questionId":"405","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6362\u5ea7\u4f4d","question":{"questionId":"626","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u91cd\u590d\u7684\u7535\u5b50\u90ae\u7bb1","question":{"questionId":"182","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u5b57\u6bcd\u5f02\u4f4d\u8bcd","question":{"questionId":"242","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u56de\u6587\u5b57\u7b26\u4e32 \u2161","question":{"questionId":"680","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u4e0d\u8ba2\u8d2d\u7684\u5ba2\u6237","question":{"questionId":"183","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u9664\u94fe\u8868\u5143\u7d20","question":{"questionId":"203","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u98a0\u5012\u4e8c\u8fdb\u5236\u4f4d","question":{"questionId":"190","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u53f3\u89c6\u56fe","question":{"questionId":"199","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u4e8c\u7ef4\u77e9\u9635","question":{"questionId":"74","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u989c\u8272\u5206\u7c7b","question":{"questionId":"75","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8def\u5f84\u603b\u548c II","question":{"questionId":"113","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6570\u5b57 II","question":{"questionId":"137","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u7684\u5b50\u5e8f\u5217","question":{"questionId":"115","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"LRU\u7f13\u5b58\u673a\u5236","question":{"questionId":"146","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f4d1\u7684\u4e2a\u6570","question":{"questionId":"191","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6587\u672c\u5de6\u53f3\u5bf9\u9f50","question":{"questionId":"68","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u8986\u76d6\u5b50\u4e32","question":{"questionId":"76","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Nim \u6e38\u620f","question":{"questionId":"292","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u89d2\u5f62\u6700\u5c0f\u8def\u5f84\u548c","question":{"questionId":"120","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u6570\u6392\u540d","question":{"questionId":"178","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u77e9\u5f62","question":{"questionId":"85","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6392\u5e8f\u6570\u7ec4\u4e2d\u7684\u91cd\u590d\u9879 II","question":{"questionId":"80","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6392\u5e8f\u94fe\u8868\u4e2d\u7684\u91cd\u590d\u5143\u7d20 II","question":{"questionId":"82","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67f1\u72b6\u56fe\u4e2d\u6700\u5927\u7684\u77e9\u5f62","question":{"questionId":"84","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u94fe\u8868\u8f6c\u6362\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"109","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u5c55\u5f00\u4e3a\u94fe\u8868","question":{"questionId":"114","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u586b\u5145\u6bcf\u4e2a\u8282\u70b9\u7684\u4e0b\u4e00\u4e2a\u53f3\u4fa7\u8282\u70b9\u6307\u9488","question":{"questionId":"116","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u4e4b\u548c IV - \u8f93\u5165 BST","question":{"questionId":"653","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6574\u6570\u8f6c\u6362\u82f1\u6587\u8868\u793a","question":{"questionId":"273","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u53d1\u7cd6\u679c","question":{"questionId":"135","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u524d\u5e8f\u4e0e\u4e2d\u5e8f\u904d\u5386\u5e8f\u5217\u6784\u9020\u4e8c\u53c9\u6811","question":{"questionId":"105","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u4e2d\u5e8f\u4e0e\u540e\u5e8f\u904d\u5386\u5e8f\u5217\u6784\u9020\u4e8c\u53c9\u6811","question":{"questionId":"106","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u90e8\u95e8\u5de5\u8d44\u6700\u9ad8\u7684\u5458\u5de5","question":{"questionId":"184","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u5356\u80a1\u7968\u7684\u6700\u4f73\u65f6\u673a III","question":{"questionId":"123","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u4e2d\u7684\u6700\u5927\u8def\u5f84\u548c","question":{"questionId":"124","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u63a5\u9f99","question":{"questionId":"127","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u63a5\u9f99 II","question":{"questionId":"126","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u8fde\u7eed\u5e8f\u5217","question":{"questionId":"128","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u88ab\u56f4\u7ed5\u7684\u533a\u57df","question":{"questionId":"130","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u56de\u6587\u4e32","question":{"questionId":"131","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u56de\u6587\u4e32 II","question":{"questionId":"132","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u514b\u9686\u56fe","question":{"questionId":"133","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6270\u4e71\u5b57\u7b26\u4e32","question":{"questionId":"87","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u586b\u5145\u6bcf\u4e2a\u8282\u70b9\u7684\u4e0b\u4e00\u4e2a\u53f3\u4fa7\u8282\u70b9\u6307\u9488 II","question":{"questionId":"117","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u52a0\u6cb9\u7ad9","question":{"questionId":"134","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u590d\u5236\u5e26\u968f\u673a\u6307\u9488\u7684\u94fe\u8868","question":{"questionId":"138","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u62c6\u5206","question":{"questionId":"139","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u62c6\u5206 II","question":{"questionId":"140","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u6392\u94fe\u8868","question":{"questionId":"143","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u524d\u5e8f\u904d\u5386","question":{"questionId":"144","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u540e\u5e8f\u904d\u5386","question":{"questionId":"145","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bf9\u94fe\u8868\u8fdb\u884c\u63d2\u5165\u6392\u5e8f","question":{"questionId":"147","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6392\u5e8f\u94fe\u8868","question":{"questionId":"148","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f4\u7ebf\u4e0a\u6700\u591a\u7684\u70b9\u6570","question":{"questionId":"149","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9006\u6ce2\u5170\u8868\u8fbe\u5f0f\u6c42\u503c","question":{"questionId":"150","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u57fa\u672c\u8ba1\u7b97\u5668","question":{"questionId":"224","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u8da3\u7684\u7535\u5f71","question":{"questionId":"620","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u95f4\u8ddd","question":{"questionId":"164","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u51fa\u73b0\u7684\u6570\u5b57","question":{"questionId":"180","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u6362\u5de5\u8d44","question":{"questionId":"627","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c42\u6839\u5230\u53f6\u5b50\u8282\u70b9\u6570\u5b57\u4e4b\u548c","question":{"questionId":"129","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u5b57\u7b26\u4e32\u91cc\u7684\u5355\u8bcd","question":{"questionId":"151","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e58\u79ef\u6700\u5927\u5b50\u5e8f\u5217","question":{"questionId":"152","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u65cb\u8f6c\u6392\u5e8f\u6570\u7ec4\u4e2d\u7684\u6700\u5c0f\u503c","question":{"questionId":"153","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u65cb\u8f6c\u6392\u5e8f\u6570\u7ec4\u4e2d\u7684\u6700\u5c0f\u503c II","question":{"questionId":"154","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u5cf0\u503c","question":{"questionId":"162","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bd4\u8f83\u7248\u672c\u53f7","question":{"questionId":"165","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u6570\u5230\u5c0f\u6570","question":{"questionId":"166","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u91cd\u590d\u7684\u7535\u5b50\u90ae\u7bb1","question":{"questionId":"196","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5927\u7684\u56fd\u5bb6","question":{"questionId":"595","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u8fc75\u540d\u5b66\u751f\u7684\u8bfe","question":{"questionId":"596","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0a\u5347\u7684\u6e29\u5ea6","question":{"questionId":"197","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f53\u80b2\u9986\u7684\u4eba\u6d41\u91cf","question":{"questionId":"601","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u884c\u7a0b\u548c\u7528\u6237","question":{"questionId":"262","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63d0\u83ab\u653b\u51fb","question":{"questionId":"495","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408\u603b\u548c III","question":{"questionId":"216","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u5c11\u662f\u5176\u4ed6\u6570\u5b57\u4e24\u500d\u7684\u6700\u5927\u6570","question":{"questionId":"748","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ed9\u8868\u8fbe\u5f0f\u6dfb\u52a0\u8fd0\u7b97\u7b26","question":{"questionId":"282","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u62c6\u5206 I","question":{"questionId":"561","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u8fed\u4ee3\u5668","question":{"questionId":"173","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u6570","question":{"questionId":"179","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u57df\u548c\u68c0\u7d22 - \u6570\u7ec4\u4e0d\u53ef\u53d8","question":{"questionId":"303","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53bb\u9664\u91cd\u590d\u5b57\u6bcd","question":{"questionId":"316","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u5bf9","question":{"questionId":"336","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u51fa\u7b2c k \u5c0f\u7684\u8ddd\u79bb\u5bf9","question":{"questionId":"719","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u201c\u9a6c\u201d\u5728\u68cb\u76d8\u4e0a\u7684\u6982\u7387","question":{"questionId":"688","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c9b\u5c7f\u6570\u91cf","question":{"questionId":"200","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9636\u4e58\u540e\u7684\u96f6","question":{"questionId":"172","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5730\u4e0b\u57ce\u6e38\u620f","question":{"questionId":"174","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u590d\u7684DNA\u5e8f\u5217","question":{"questionId":"187","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u5356\u80a1\u7968\u7684\u6700\u4f73\u65f6\u673a IV","question":{"questionId":"188","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bfe\u7a0b\u8868","question":{"questionId":"207","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u6570\u7ec4","question":{"questionId":"189","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56db\u6570\u76f8\u52a0 II","question":{"questionId":"454","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u6240\u6709\u8def\u5f84","question":{"questionId":"257","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u5b57\u8303\u56f4\u6309\u4f4d\u4e0e","question":{"questionId":"201","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b9e\u73b0 Trie (\u524d\u7f00\u6811)","question":{"questionId":"208","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u957f\u5ea6\u6700\u5c0f\u7684\u5b50\u6570\u7ec4","question":{"questionId":"209","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"3\u7684\u5e42","question":{"questionId":"326","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c49\u660e\u8ddd\u79bb","question":{"questionId":"461","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u6b63\u65b9\u5f62","question":{"questionId":"221","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bcf\u65e5\u6e29\u5ea6","question":{"questionId":"739","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81ea\u9664\u6570","question":{"questionId":"728","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u96f6\u94b1\u5151\u6362 II","question":{"questionId":"518","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bfe\u7a0b\u8868 II","question":{"questionId":"210","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6dfb\u52a0\u4e0e\u641c\u7d22\u5355\u8bcd - \u6570\u636e\u7ed3\u6784\u8bbe\u8ba1","question":{"questionId":"211","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u641c\u7d22 II","question":{"questionId":"212","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u5bb6\u52ab\u820d II","question":{"questionId":"213","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u56de\u6587\u4e32","question":{"questionId":"214","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u4e2d\u7684\u7b2cK\u4e2a\u6700\u5927\u5143\u7d20","question":{"questionId":"215","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5929\u9645\u7ebf\u95ee\u9898","question":{"questionId":"218","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u4e8c\u53c9\u6811","question":{"questionId":"617","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68c0\u6d4b\u5927\u5199\u5b57\u6bcd","question":{"questionId":"520","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c11\u79fb\u52a8\u6b21\u6570\u4f7f\u6570\u7ec4\u5143\u7d20\u76f8\u7b49 II","question":{"questionId":"462","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u6784\u5b57\u7b26\u4e32","question":{"questionId":"778","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e58\u6cd5\u8868\u4e2d\u7b2ck\u5c0f\u7684\u6570","question":{"questionId":"668","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"1\u6bd4\u7279\u4e0e2\u6bd4\u7279\u5b57\u7b26","question":{"questionId":"717","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5197\u4f59\u8fde\u63a5","question":{"questionId":"684","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u8282\u70b9\u4e2a\u6570","question":{"questionId":"222","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5197\u4f59\u8fde\u63a5 II","question":{"questionId":"685","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c\u4e09\u5927\u7684\u6570","question":{"questionId":"414","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u6570","question":{"questionId":"434","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4e8c\u53c9\u6811","question":{"questionId":"654","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9012\u589e\u7684\u4e09\u5143\u5b50\u5e8f\u5217","question":{"questionId":"334","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528\u6808\u5b9e\u73b0\u961f\u5217","question":{"questionId":"232","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5761\u5ea6","question":{"questionId":"563","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e03\u8fdb\u5236\u6570","question":{"questionId":"504","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u8fde\u7eed\u9012\u589e\u5e8f\u5217","question":{"questionId":"674","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u89c4\u5f8b","question":{"questionId":"290","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u91cd\u590d\u6570","question":{"questionId":"287","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u6570\u7ec4\u7684\u4ea4\u96c6","question":{"questionId":"349","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c34\u58f6\u95ee\u9898","question":{"questionId":"365","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d4e\u91d1\u4fe1","question":{"questionId":"383","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u96f6\u94b1\u5151\u6362","question":{"questionId":"322","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u636e\u6d41\u7684\u4e2d\u4f4d\u6570","question":{"questionId":"295","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ba1\u7b97\u53f3\u4fa7\u5c0f\u4e8e\u5f53\u524d\u5143\u7d20\u7684\u4e2a\u6570","question":{"questionId":"315","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68d2\u7403\u6bd4\u8d5b","question":{"questionId":"682","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6392\u5217\u786c\u5e01","question":{"questionId":"441","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u6570\u7ec4\u4e2d\u7684\u5355\u4e00\u5143\u7d20","question":{"questionId":"540","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ba1\u6570\u4e8c\u8fdb\u5236\u5b50\u4e32","question":{"questionId":"696","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u538b\u7f29\u5b57\u7b26\u4e32","question":{"questionId":"443","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u76f4\u5f84","question":{"questionId":"543","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u5b57\u7b26\u4e32\u4e2d\u7684\u5143\u97f3\u5b57\u6bcd","question":{"questionId":"345","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u94fe\u8868\u4e2d\u7684\u8282\u70b9","question":{"questionId":"237","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2cN\u4e2a\u6570\u5b57","question":{"questionId":"400","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u95f4\u5b50\u6570\u7ec4\u4e2a\u6570","question":{"questionId":"811","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bcd\u5178\u4e2d\u6700\u957f\u7684\u5355\u8bcd","question":{"questionId":"720","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528\u6700\u5c11\u6570\u91cf\u7684\u7bad\u5f15\u7206\u6c14\u7403","question":{"questionId":"452","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6ce8\u91ca","question":{"questionId":"722","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b66\u751f\u51fa\u52e4\u8bb0\u5f55 I","question":{"questionId":"551","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u548c\u8c10\u5b50\u5e8f\u5217","question":{"questionId":"594","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u5b57\u7b26\u4e32","question":{"questionId":"812","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u5927\u5c0f\u5199\u5168\u6392\u5217","question":{"questionId":"800","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u7ed3\u70b9\u6700\u5c0f\u8ddd\u79bb","question":{"questionId":"799","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u5851\u77e9\u9635","question":{"questionId":"566","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6570\u5b57 III","question":{"questionId":"260","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bd4\u7279\u4f4d\u8ba1\u6570","question":{"questionId":"338","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u5bb6\u52ab\u820d III","question":{"questionId":"337","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u4e8c\u53c9\u6811","question":{"questionId":"226","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6258\u666e\u5229\u8328\u77e9\u9635","question":{"questionId":"777","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u540c\u503c\u8def\u5f84","question":{"questionId":"687","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ef\u601c\u7684\u5c0f\u732a","question":{"questionId":"458","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"H\u6307\u6570","question":{"questionId":"274","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"H\u6307\u6570 II","question":{"questionId":"275","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u66ff\u4f4d\u4e8c\u8fdb\u5236\u6570","question":{"questionId":"693","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b9d\u77f3\u4e0e\u77f3\u5934","question":{"questionId":"782","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b8c\u5168\u5e73\u65b9\u6570","question":{"questionId":"279","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f7f\u7528\u6700\u5c0f\u82b1\u8d39\u722c\u697c\u68af","question":{"questionId":"747","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u66ff\u6362","question":{"questionId":"648","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6700\u8fd1\u516c\u5171\u7956\u5148","question":{"questionId":"235","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u7684\u5747\u503c\u5206\u5272","question":{"questionId":"823","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u5b57 1 \u7684\u4e2a\u6570","question":{"questionId":"233","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217","question":{"questionId":"300","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u6574\u9664\u5b50\u96c6","question":{"questionId":"368","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b9e\u73b0\u4e00\u4e2a\u9b54\u6cd5\u5b57\u5178","question":{"questionId":"676","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u552f\u4e00\u6469\u5c14\u65af\u5bc6\u7801\u8bcd","question":{"questionId":"822","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5199\u5b57\u7b26\u4e32\u9700\u8981\u7684\u884c\u6570","question":{"questionId":"824","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u6570\u7ec4\u7684\u6700\u5927\u503c","question":{"questionId":"410","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u628a\u4e8c\u53c9\u641c\u7d22\u6811\u8f6c\u6362\u4e3a\u7d2f\u52a0\u6811","question":{"questionId":"538","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u5217\u8868\u7684\u6700\u5c0f\u7d22\u5f15\u603b\u548c","question":{"questionId":"599","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u6570\u5b57","question":{"questionId":"804","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8def\u5f84\u4ea4\u53c9","question":{"questionId":"335","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u4e8c\u7ef4\u77e9\u9635 II","question":{"questionId":"240","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u53d1\u997c\u5e72","question":{"questionId":"455","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4ea4\u6362","question":{"questionId":"670","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b8c\u7f8e\u77e9\u5f62","question":{"questionId":"391","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u5f62\u9762\u79ef","question":{"questionId":"223","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63a5\u96e8\u6c34 II","question":{"questionId":"407","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u548c\u4e3aK\u7684\u5b50\u6570\u7ec4","question":{"questionId":"560","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"4\u7684\u5e42","question":{"questionId":"342","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u975e\u9012\u51cf\u6570\u5217","question":{"questionId":"665","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u57fa\u672c\u8ba1\u7b97\u5668 II","question":{"questionId":"227","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89e3\u7801\u65b9\u6cd5 2","question":{"questionId":"639","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5e8f\u5217\u5316\u4e0e\u53cd\u5e8f\u5217\u5316","question":{"questionId":"297","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230\u6240\u6709\u6570\u7ec4\u4e2d\u6d88\u5931\u7684\u6570\u5b57","question":{"questionId":"448","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u65e0\u5e8f\u8fde\u7eed\u5b50\u6570\u7ec4","question":{"questionId":"581","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u63a8\u7279","question":{"questionId":"355","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56fe\u7247\u5e73\u6ed1\u5668","question":{"questionId":"661","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c9b\u5c7f\u7684\u6700\u5927\u9762\u79ef","question":{"questionId":"695","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4fee\u526a\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"669","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u6389K\u4f4d\u6570\u5b57","question":{"questionId":"402","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u7816\u5757","question":{"questionId":"821","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u706f\u6ce1\u5f00\u5173","question":{"questionId":"319","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c42\u4f17\u6570 II","question":{"questionId":"229","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u6570\u5b57\u6e38\u620f","question":{"questionId":"299","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6574\u6570\u62c6\u5206","question":{"questionId":"343","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u56de\u6587\u4e32","question":{"questionId":"409","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u6700\u5c0f\u7edd\u5bf9\u5dee","question":{"questionId":"530","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5224\u65ad\u4e8c\u5206\u56fe","question":{"questionId":"801","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9664\u6cd5\u6c42\u503c","question":{"questionId":"399","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u7279\u6b8a\u5e8f\u5217 \u2160","question":{"questionId":"521","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7b2cK\u5c0f\u7684\u5143\u7d20","question":{"questionId":"230","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6241\u5e73\u5316\u5d4c\u5957\u5217\u8868\u8fed\u4ee3\u5668","question":{"questionId":"341","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91d1\u5b57\u5854\u8f6c\u6362\u77e9\u9635","question":{"questionId":"757","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u57fa\u56e0\u53d8\u5316","question":{"questionId":"433","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u6570\u7ec4\u7684\u4e2d\u5fc3\u7d22\u5f15","question":{"questionId":"724","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u5b57\u7684\u8865\u6570","question":{"questionId":"476","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"01 \u77e9\u9635","question":{"questionId":"542","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6574\u6570\u66ff\u6362","question":{"questionId":"397","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u636e\u8eab\u9ad8\u91cd\u5efa\u961f\u5217","question":{"questionId":"406","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79cd\u82b1\u95ee\u9898","question":{"questionId":"605","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u968f\u673a\u6570\u7d22\u5f15","question":{"questionId":"398","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u4e2d\u7b2c\u4e8c\u5c0f\u7684\u8282\u70b9","question":{"questionId":"671","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K\u4e2a\u9006\u5e8f\u5bf9\u6570\u7ec4","question":{"questionId":"629","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u4e71\u6570\u7ec4","question":{"questionId":"384","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u670b\u53cb\u5708","question":{"questionId":"547","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u6700\u8fd1\u516c\u5171\u7956\u5148","question":{"questionId":"236","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u524d K \u4e2a\u9ad8\u9891\u5143\u7d20","question":{"questionId":"347","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5168 O(1) \u7684\u6570\u636e\u7ed3\u6784","question":{"questionId":"432","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8def\u5f84\u603b\u548c III","question":{"questionId":"437","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u7cd6\u679c","question":{"questionId":"575","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u5178\u5e8f\u6392\u6570","question":{"questionId":"386","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728LR\u5b57\u7b26\u4e32\u4e2d\u4ea4\u6362\u76f8\u90bb\u5b57\u7b26","question":{"questionId":"793","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9012\u589e\u5b50\u5e8f\u5217","question":{"questionId":"491","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9752\u86d9\u8fc7\u6cb3","question":{"questionId":"403","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u56de\u6587\u6570\u4e58\u79ef","question":{"questionId":"479","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73af\u5f62\u6570\u7ec4\u5faa\u73af","question":{"questionId":"457","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u53f3\u533a\u95f4","question":{"questionId":"436","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5339\u914d\u5b50\u5e8f\u5217\u7684\u5355\u8bcd\u6570","question":{"questionId":"808","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u66ff\u6362\u540e\u7684\u6700\u957f\u91cd\u590d\u5b57\u7b26","question":{"questionId":"424","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c42\u89e3\u65b9\u7a0b","question":{"questionId":"640","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6458\u6a31\u6843","question":{"questionId":"741","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"TinyURL \u7684\u52a0\u5bc6\u4e0e\u89e3\u5bc6","question":{"questionId":"535","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u77e9\u9635\u4e2d\u7b2cK\u5c0f\u7684\u5143\u7d20","question":{"questionId":"378","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7956\u739b\u6e38\u620f","question":{"questionId":"488","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4fdd\u6301\u57ce\u5e02\u5929\u9645\u7ebf","question":{"questionId":"825","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":" \u8bbe\u7f6e\u4ea4\u96c6\u5927\u5c0f\u81f3\u5c11\u4e3a2","question":{"questionId":"759","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u76f8\u52a0 II","question":{"questionId":"445","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u9012\u589e\u5b50\u5e8f\u5217\u7684\u4e2a\u6570","question":{"questionId":"673","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76ee\u6807\u548c","question":{"questionId":"494","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u7ea7\u6b21\u65b9","question":{"questionId":"372","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f3a\u5bc6\u7801\u68c0\u9a8c\u5668","question":{"questionId":"420","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u6bd4\u76ee\u6807\u5b57\u6bcd\u5927\u7684\u6700\u5c0f\u5b57\u6bcd","question":{"questionId":"745","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u5356\u80a1\u7968\u7684\u6700\u4f73\u65f6\u673a\u542b\u624b\u7eed\u8d39","question":{"questionId":"714","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u7684\u5ea6","question":{"questionId":"697","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"LFU\u7f13\u5b58","question":{"questionId":"460","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u590d\u53e0\u52a0\u5b57\u7b26\u4e32\u5339\u914d","question":{"questionId":"686","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u6570\u7ec4","question":{"questionId":"525","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u4e8c\u53c9\u6811\u7684\u524d\u5e8f\u5e8f\u5217\u5316","question":{"questionId":"331","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u65e0\u6548\u7684\u62ec\u53f7","question":{"questionId":"301","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81ea\u5b9a\u4e49\u5b57\u7b26\u4e32\u6392\u5e8f","question":{"questionId":"807","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u591a\u80fd\u5b8c\u6210\u6392\u5e8f\u7684\u5757","question":{"questionId":"780","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u591a\u80fd\u5b8c\u6210\u6392\u5e8f\u7684\u5757 II","question":{"questionId":"779","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5212\u5206\u5b57\u6bcd\u533a\u95f4","question":{"questionId":"768","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5230\u8fbe\u7ec8\u70b9\u6570\u5b57","question":{"questionId":"755","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u539f\u5b50\u7684\u6570\u91cf","question":{"questionId":"726","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u79fb\u52a8\u6b21\u6570\u4f7f\u6570\u7ec4\u5143\u7d20\u76f8\u7b49","question":{"questionId":"453","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u5d4c\u5957","question":{"questionId":"565","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0b\u4e00\u4e2a\u66f4\u5927\u5143\u7d20 III","question":{"questionId":"556","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u706b\u67f4\u62fc\u6b63\u65b9\u5f62","question":{"questionId":"473","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9876\u7aef\u8fed\u4ee3\u5668","question":{"questionId":"284","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u6c64","question":{"questionId":"826","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9636\u4e58\u51fd\u6570\u540eK\u4e2a\u96f6","question":{"questionId":"809","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0b\u4e00\u4e2a\u66f4\u5927\u5143\u7d20 I","question":{"questionId":"496","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9519\u8bef\u7684\u96c6\u5408","question":{"questionId":"645","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u542b\u8fde\u7eed1\u7684\u975e\u8d1f\u6574\u6570","question":{"questionId":"600","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5355\u8bcd\u957f\u5ea6\u4e58\u79ef","question":{"questionId":"318","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u4e2d\u4e24\u4e2a\u6570\u7684\u6700\u5927\u5f02\u6216\u503c","question":{"questionId":"421","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u5178\u5e8f\u7684\u7b2cK\u5c0f\u6570\u5b57","question":{"questionId":"440","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b66\u751f\u51fa\u52e4\u8bb0\u5f55 II","question":{"questionId":"552","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9664\u81ea\u8eab\u4ee5\u5916\u6570\u7ec4\u7684\u4e58\u79ef","question":{"questionId":"238","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u5b50\u4e32","question":{"questionId":"647","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u4e2d\u7684K-diff\u6570\u5bf9","question":{"questionId":"532","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u4e2d\u91cd\u590d\u7684\u6570\u636e","question":{"questionId":"442","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5458\u5de5\u7684\u91cd\u8981\u6027","question":{"questionId":"690","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7532\u677f\u4e0a\u7684\u6218\u8230","question":{"questionId":"419","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u9ad8\u5ea6\u6811","question":{"questionId":"310","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u524d\u7f00\u548c\u540e\u7f00\u641c\u7d22","question":{"questionId":"746","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u4e2a\u65e0\u91cd\u53e0\u5b50\u6570\u7ec4\u7684\u6700\u5927\u548c","question":{"questionId":"689","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u56de\u6587\u5b50\u5e8f\u5217","question":{"questionId":"516","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u65cb\u9556\u7684\u6570\u91cf","question":{"questionId":"447","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65e0\u91cd\u53e0\u533a\u95f4","question":{"questionId":"435","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u82f1\u6587\u4e2d\u91cd\u5efa\u6570\u5b57","question":{"questionId":"423","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65cb\u8f6c\u51fd\u6570","question":{"questionId":"396","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u7ea7\u4e11\u6570","question":{"questionId":"313","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ba1\u7b97\u5404\u4e2a\u4f4d\u6570\u4e0d\u540c\u7684\u6570\u5b57\u4e2a\u6570","question":{"questionId":"357","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6446\u52a8\u6392\u5e8f II","question":{"questionId":"324","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5947\u602a\u7684\u6253\u5370\u673a","question":{"questionId":"664","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u57df\u540d\u8bbf\u95ee\u8ba1\u6570","question":{"questionId":"829","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6700\u5c0fASCII\u5220\u9664\u548c","question":{"questionId":"712","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u5bf9","question":{"questionId":"493","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u8fdb\u5236\u8868\u793a\u4e2d\u8d28\u6570\u4e2a\u8ba1\u7b97\u7f6e\u4f4d","question":{"questionId":"767","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0b\u4e00\u4e2a\u66f4\u5927\u5143\u7d20 II","question":{"questionId":"503","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6ed1\u52a8\u7a97\u53e3\u6700\u5927\u503c","question":{"questionId":"239","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u626b\u96f7\u6e38\u620f","question":{"questionId":"529","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u4e0e\u83b7\u5f97\u70b9\u6570","question":{"questionId":"740","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u6700\u5927\u5bbd\u5ea6","question":{"questionId":"662","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f7f\u5e8f\u5217\u9012\u589e\u7684\u6700\u5c0f\u4ea4\u6362\u6b21\u6570","question":{"questionId":"819","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"24 \u70b9\u6e38\u620f","question":{"questionId":"679","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u4e09\u89d2\u5f62\u7684\u4e2a\u6570","question":{"questionId":"611","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4efb\u52a1\u8c03\u5ea6\u5668","question":{"questionId":"621","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6807\u7b7e\u9a8c\u8bc1\u5668","question":{"questionId":"591","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9999\u69df\u5854","question":{"questionId":"815","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u533a\u95f4","question":{"questionId":"632","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53e6\u4e00\u4e2a\u6811\u7684\u5b50\u6811","question":{"questionId":"572","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u590d\u6570\u4e58\u6cd5","question":{"questionId":"537","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b89\u88c5\u6805\u680f","question":{"questionId":"587","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"O(1) \u65f6\u95f4\u63d2\u5165\u3001\u5220\u9664\u548c\u83b7\u53d6\u968f\u673a\u5143\u7d20 - \u5141\u8bb8\u91cd\u590d","question":{"questionId":"381","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e38\u6570\u65f6\u95f4\u63d2\u5165\u3001\u5220\u9664\u548c\u83b7\u53d6\u968f\u673a\u5143\u7d20","question":{"questionId":"380","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u4e8c\u53c9\u6811\u4e2d\u589e\u52a0\u4e00\u884c","question":{"questionId":"623","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u548c\u96f6","question":{"questionId":"474","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"132\u6a21\u5f0f","question":{"questionId":"456","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c9b\u5c7f\u7684\u5468\u957f","question":{"questionId":"463","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u636e\u5b57\u7b26\u51fa\u73b0\u9891\u7387\u6392\u5e8f","question":{"questionId":"451","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u590d\u7684\u5b50\u5b57\u7b26\u4e32","question":{"questionId":"459","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c49\u660e\u8ddd\u79bb\u603b\u548c","question":{"questionId":"477","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u5bf9\u540d\u6b21","question":{"questionId":"506","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u7ef4\u533a\u57df\u548c\u68c0\u7d22 - \u77e9\u9635\u4e0d\u53ef\u53d8","question":{"questionId":"304","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u89e3\u7801","question":{"questionId":"394","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"UTF-8 \u7f16\u7801\u9a8c\u8bc1","question":{"questionId":"393","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u5c11\u6709K\u4e2a\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32","question":{"questionId":"395","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5224\u65ad\u5b50\u5e8f\u5217","question":{"questionId":"392","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f51\u7edc\u5ef6\u8fdf\u65f6\u95f4","question":{"questionId":"744","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u6570\u5b57\u5927\u5c0f II","question":{"questionId":"375","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f93\u51fa\u4e8c\u53c9\u6811","question":{"questionId":"655","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u60c5\u4fa3\u7275\u624b","question":{"questionId":"770","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94fe\u8868\u968f\u673a\u8282\u70b9","question":{"questionId":"382","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4e09\u89d2\u5f62\u9762\u79ef","question":{"questionId":"830","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5e73\u5747\u503c\u548c\u7684\u5206\u7ec4","question":{"questionId":"831","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528\u961f\u5217\u5b9e\u73b0\u6808","question":{"questionId":"225","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9884\u6d4b\u8d62\u5bb6","question":{"questionId":"486","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8303\u56f4\u6c42\u548c II","question":{"questionId":"598","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u516c\u4ea4\u8def\u7ebf","question":{"questionId":"833","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56fe\u50cf\u6e32\u67d3","question":{"questionId":"733","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u548c\u6700\u5c0f\u7684K\u5bf9\u6570\u5b57","question":{"questionId":"373","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b49\u5dee\u6570\u5217\u5212\u5206","question":{"questionId":"413","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u6700\u8fd1\u7684\u56de\u6587\u6570","question":{"questionId":"564","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d5b\u8f66","question":{"questionId":"836","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5e38\u89c1\u7684\u5355\u8bcd","question":{"questionId":"837","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6784\u9020\u77e9\u5f62","question":{"questionId":"492","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u5220\u9664\u64cd\u4f5c","question":{"questionId":"583","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u526a\u679d","question":{"questionId":"832","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u4e95\u5b57\u6e38\u620f","question":{"questionId":"810","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd","question":{"questionId":"438","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u7684\u6700\u77ed\u8ddd\u79bb","question":{"questionId":"841","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bf9\u89d2\u7ebf\u904d\u5386","question":{"questionId":"498","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5947\u5076\u94fe\u8868","question":{"questionId":"328","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f9b\u6696\u5668","question":{"questionId":"475","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u884c\u661f\u78b0\u649e","question":{"questionId":"735","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e3a\u8fd0\u7b97\u8868\u8fbe\u5f0f\u8bbe\u8ba1\u4f18\u5148\u7ea7","question":{"questionId":"241","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u751f\u547d\u6e38\u620f","question":{"questionId":"289","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u9635\u4e2d\u7684\u6700\u957f\u9012\u589e\u8def\u5f84","question":{"questionId":"329","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9003\u8131\u963b\u788d\u8005","question":{"questionId":"805","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u60c5\u611f\u4e30\u5bcc\u7684\u6587\u5b57","question":{"questionId":"827","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7d2f\u52a0\u6570","question":{"questionId":"306","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u63a5\u8bcd","question":{"questionId":"472","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6211\u7684\u65e5\u7a0b\u5b89\u6392\u8868 I","question":{"questionId":"729","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6211\u7684\u65e5\u7a0b\u5b89\u6392\u8868 II","question":{"questionId":"731","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6211\u7684\u65e5\u7a0b\u5b89\u6392\u8868 III","question":{"questionId":"732","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u8282\u70b9","question":{"questionId":"450","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ea\u6709\u4e24\u4e2a\u952e\u7684\u952e\u76d8","question":{"questionId":"650","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u91cd\u590d\u5b50\u6570\u7ec4","question":{"questionId":"718","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u51fd\u6570\u7684\u72ec\u5360\u65f6\u95f4","question":{"questionId":"636","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u8981\u6c42\u8865\u9f50\u6570\u7ec4","question":{"questionId":"330","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8c03\u9012\u589e\u7684\u6570\u5b57","question":{"questionId":"738","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f73\u4e70\u5356\u80a1\u7968\u65f6\u673a\u542b\u51b7\u51bb\u671f","question":{"questionId":"309","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u901a\u8fc7\u5220\u9664\u5b57\u6bcd\u5339\u914d\u5230\u5b57\u5178\u91cc\u6700\u957f\u5355\u8bcd","question":{"questionId":"524","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f18\u9664\u6cd5","question":{"questionId":"553","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u952e\u503c\u6620\u5c04","question":{"questionId":"677","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u6574\u6570\u6c42\u548c","question":{"questionId":"856","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1IP\u5730\u5740","question":{"questionId":"468","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u53c9\u6811\u7684\u6700\u5927\u6df1\u5ea6","question":{"questionId":"774","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u53c9\u6811\u7684\u524d\u5e8f\u904d\u5386","question":{"questionId":"775","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u53c9\u6811\u7684\u540e\u5e8f\u904d\u5386","question":{"questionId":"776","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N\u53c9\u6811\u7684\u5c42\u5e8f\u904d\u5386","question":{"questionId":"764","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u636e\u6d41\u4e2d\u7684\u7b2cK\u5927\u5143\u7d20","question":{"questionId":"789","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u641c\u7d22","question":{"questionId":"783","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u56fe\u50cf","question":{"questionId":"861","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4eba\u5de5\u5c9b","question":{"questionId":"854","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u63d2\u5165\u64cd\u4f5c","question":{"questionId":"784","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u57df\u548c\u68c0\u7d22 - \u6570\u7ec4\u53ef\u4fee\u6539","question":{"questionId":"307","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u5f62\u91cd\u53e0","question":{"questionId":"866","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63a8\u591a\u7c73\u8bfa","question":{"questionId":"868","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65b021\u70b9","question":{"questionId":"867","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u4f3c\u5b57\u7b26\u4e32\u7ec4","question":{"questionId":"869","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5927\u793c\u5305","question":{"questionId":"638","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u95f4\u548c\u7684\u4e2a\u6570","question":{"questionId":"327","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u72ec\u7279\u5b57\u7b26\u4e32","question":{"questionId":"855","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f83\u5927\u5206\u7ec4\u7684\u4f4d\u7f6e","question":{"questionId":"857","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6d88\u9664\u6e38\u620f","question":{"questionId":"390","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4fc4\u7f57\u65af\u5957\u5a03\u4fe1\u5c01\u95ee\u9898","question":{"questionId":"354","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6570\u7ec4\u62c6\u5206\u6210\u6590\u6ce2\u90a3\u5951\u5e8f\u5217","question":{"questionId":"872","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u9635\u4e2d\u7684\u5e7b\u65b9","question":{"questionId":"870","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94a5\u5319\u548c\u623f\u95f4","question":{"questionId":"871","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u731c\u8fd9\u4e2a\u5355\u8bcd","question":{"questionId":"873","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9ed1\u677f\u5f02\u6216\u6e38\u620f","question":{"questionId":"828","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6446\u52a8\u5e8f\u5217","question":{"questionId":"376","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6811\u4e2d\u8ddd\u79bb\u4e4b\u548c","question":{"questionId":"863","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68ee\u6797\u4e2d\u7684\u5154\u5b50","question":{"questionId":"797","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c71\u7f8a\u62c9\u4e01\u6587","question":{"questionId":"851","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u6570\u5bf9\u94fe","question":{"questionId":"646","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u6570\u52a0\u51cf\u8fd0\u7b97","question":{"questionId":"592","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7279\u6b8a\u7684\u4e8c\u8fdb\u5236\u5e8f\u5217","question":{"questionId":"763","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6587\u4ef6\u7684\u6700\u957f\u7edd\u5bf9\u8def\u5f84","question":{"questionId":"388","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e58\u79ef\u5c0f\u4e8eK\u7684\u5b50\u6570\u7ec4","question":{"questionId":"713","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u51fa\u754c\u7684\u8def\u5f84\u6570","question":{"questionId":"576","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec4\u5408\u603b\u548c \u2163","question":{"questionId":"377","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f18\u7f8e\u7684\u6392\u5217","question":{"questionId":"526","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bd4\u8f83\u542b\u9000\u683c\u7684\u5b57\u7b26\u4e32","question":{"questionId":"874","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u4e2d\u7684\u6700\u957f\u5c71\u8109","question":{"questionId":"875","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u624b\u987a\u5b50","question":{"questionId":"876","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbf\u95ee\u6240\u6709\u8282\u70b9\u7684\u6700\u77ed\u8def\u5f84","question":{"questionId":"877","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9002\u9f84\u7684\u670b\u53cb","question":{"questionId":"852","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u7684\u5b50\u6570\u7ec4\u548c","question":{"questionId":"523","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u91cd\u590d\u7684\u5b50\u6811","question":{"questionId":"652","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u5f62\u533a\u57df\u4e0d\u8d85\u8fc7 K \u7684\u6700\u5927\u6570\u503c\u548c","question":{"questionId":"363","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u706f\u6ce1\u5f00\u5173 \u2161","question":{"questionId":"672","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u79fb\u4f4d","question":{"questionId":"878","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5230\u6700\u8fd1\u7684\u4eba\u7684\u6700\u5927\u8ddd\u79bb","question":{"questionId":"879","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u5f62\u9762\u79ef II","question":{"questionId":"880","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u55a7\u95f9\u548c\u5bcc\u6709","question":{"questionId":"881","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6211\u80fd\u8d62\u5417","question":{"questionId":"464","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c71\u8109\u6570\u7ec4\u7684\u5cf0\u9876\u7d22\u5f15","question":{"questionId":"882","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f66\u961f","question":{"questionId":"883","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u4f3c\u5ea6\u4e3a K \u7684\u5b57\u7b26\u4e32","question":{"questionId":"884","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8003\u573a\u5c31\u5ea7","question":{"questionId":"885","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7816\u5899","question":{"questionId":"554","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u7ea7\u6d17\u8863\u673a","question":{"questionId":"517","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u795e\u5947\u5b57\u7b26\u4e32","question":{"questionId":"481","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u4f17\u6570","question":{"questionId":"501","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bc6\u94a5\u683c\u5f0f\u5316","question":{"questionId":"482","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u7ad9\u4e2d\u8f6c\u5185\u6700\u4fbf\u5b9c\u7684\u822a\u73ed","question":{"questionId":"803","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4eb2\u5bc6\u5b57\u7b26\u4e32","question":{"questionId":"889","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u955c\u9762\u53cd\u5c04","question":{"questionId":"888","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62ec\u53f7\u7684\u5206\u6570","question":{"questionId":"886","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u96c7\u4f63 K \u540d\u5de5\u4eba\u7684\u6700\u4f4e\u6210\u672c","question":{"questionId":"887","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u7b49\u548c\u5b50\u96c6","question":{"questionId":"416","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e0\u6aac\u6c34\u627e\u96f6","question":{"questionId":"890","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u77e9\u9635\u540e\u7684\u5f97\u5206","question":{"questionId":"891","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u548c\u81f3\u5c11\u4e3a K \u7684\u6700\u77ed\u5b50\u6570\u7ec4","question":{"questionId":"892","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u4e2d\u6240\u6709\u8ddd\u79bb\u4e3a K \u7684\u7ed3\u70b9","question":{"questionId":"893","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f6c\u7f6e\u77e9\u9635","question":{"questionId":"898","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u83b7\u53d6\u6240\u6709\u94a5\u5319\u7684\u6700\u77ed\u8def\u5f84","question":{"questionId":"895","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5177\u6709\u6240\u6709\u6700\u6df1\u7ed3\u70b9\u7684\u6700\u5c0f\u5b50\u6811","question":{"questionId":"896","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u7d20\u6570","question":{"questionId":"897","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f18\u52bf\u6d17\u724c","question":{"questionId":"901","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u65b0\u6392\u5e8f\u5f97\u5230 2 \u7684\u5e42","question":{"questionId":"900","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u8fdb\u5236\u95f4\u8ddd","question":{"questionId":"899","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f4e\u52a0\u6cb9\u6b21\u6570","question":{"questionId":"902","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"IPO","question":{"questionId":"502","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u9664\u76d2\u5b50","question":{"questionId":"546","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56fe\u50cf\u91cd\u53e0","question":{"questionId":"864","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b89\u6392\u5de5\u4f5c\u4ee5\u8fbe\u5230\u6700\u5927\u6536\u76ca","question":{"questionId":"853","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u91cd\u590d\u4e2a\u6570","question":{"questionId":"466","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Lisp \u8bed\u6cd5\u89e3\u6790","question":{"questionId":"736","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"449","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u4e0d\u540c\u56de\u6587\u5b50\u5b57\u7b26\u4e32","question":{"questionId":"730","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u52a0\u53f7\u6807\u5fd7","question":{"questionId":"769","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6ed1\u52a8\u7a97\u53e3\u4e2d\u4f4d\u6570","question":{"questionId":"480","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9690\u85cf\u4e2a\u4eba\u4fe1\u606f","question":{"questionId":"858","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f6c\u6362\u6210\u5c0f\u5199\u5b57\u6bcd","question":{"questionId":"742","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u54c8\u5e0c\u96c6\u5408","question":{"questionId":"816","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u54c8\u5e0c\u6620\u5c04","question":{"questionId":"817","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6a21\u7cca\u5750\u6807","question":{"questionId":"834","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53f6\u5b50\u76f8\u4f3c\u7684\u6811","question":{"questionId":"904","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u7684\u6590\u6ce2\u90a3\u5951\u5b50\u5e8f\u5217\u7684\u957f\u5ea6","question":{"questionId":"905","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6a21\u62df\u884c\u8d70\u673a\u5668\u4eba","question":{"questionId":"906","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7231\u5403\u9999\u8549\u7684\u73c2\u73c2","question":{"questionId":"907","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528 Rand7() \u5b9e\u73b0 Rand10()","question":{"questionId":"903","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Dota2 \u53c2\u8bae\u9662","question":{"questionId":"649","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e3a\u9ad8\u5c14\u592b\u6bd4\u8d5b\u780d\u6811","question":{"questionId":"675","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f18\u7f8e\u7684\u6392\u5217 II","question":{"questionId":"667","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u5faa\u73af\u961f\u5217","question":{"questionId":"860","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u6570\u7ec4\u4e3a\u8fde\u7eed\u5b50\u5e8f\u5217","question":{"questionId":"659","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5b50\u6811\u5143\u7d20\u548c","question":{"questionId":"508","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6389\u843d\u7684\u65b9\u5757","question":{"questionId":"699","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u7684\u538b\u7f29\u7f16\u7801","question":{"questionId":"839","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u592a\u5e73\u6d0b\u5927\u897f\u6d0b\u6c34\u6d41\u95ee\u9898","question":{"questionId":"417","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u5206\u67e5\u627e","question":{"questionId":"792","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6570\u636e\u6d41\u53d8\u4e3a\u591a\u4e2a\u4e0d\u76f8\u4ea4\u533a\u95f4","question":{"questionId":"352","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u94fe\u8868","question":{"questionId":"838","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u5f00\u8f6c\u76d8\u9501","question":{"questionId":"753","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bfe\u7a0b\u8868 III","question":{"questionId":"630","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e26\u56e0\u5b50\u7684\u4e8c\u53c9\u6811","question":{"questionId":"843","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u65b0\u5b89\u6392\u884c\u7a0b","question":{"questionId":"332","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u7279\u6b8a\u5e8f\u5217 II","question":{"questionId":"522","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5168\u5c40\u5012\u7f6e\u4e0e\u5c40\u90e8\u5012\u7f6e","question":{"questionId":"790","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94fe\u8868\u7684\u4e2d\u95f4\u7ed3\u70b9","question":{"questionId":"908","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c N \u4e2a\u795e\u5947\u6570\u5b57","question":{"questionId":"910","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76c8\u5229\u8ba1\u5212","question":{"questionId":"911","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77f3\u5b50\u6e38\u620f","question":{"questionId":"909","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c34\u4f4d\u4e0a\u5347\u7684\u6cf3\u6c60\u4e2d\u6e38\u6cf3","question":{"questionId":"794","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9ed1\u540d\u5355\u4e2d\u7684\u968f\u673a\u6570","question":{"questionId":"894","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5efa\u7acb\u56db\u53c9\u6811","question":{"questionId":"772","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6240\u6709\u53ef\u80fd\u7684\u8def\u5f84","question":{"questionId":"813","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6ed1\u52a8\u8c1c\u9898","question":{"questionId":"787","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7834\u89e3\u4fdd\u9669\u7bb1","question":{"questionId":"754","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6551\u751f\u8247","question":{"questionId":"917","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u7ef4\u5f62\u4f53\u6295\u5f71\u9762\u79ef","question":{"questionId":"919","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7d22\u5f15\u5904\u7684\u89e3\u7801\u5b57\u7b26\u4e32","question":{"questionId":"916","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec6\u5206\u56fe\u4e2d\u7684\u53ef\u5230\u8fbe\u7ed3\u70b9","question":{"questionId":"918","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230 K \u4e2a\u6700\u63a5\u8fd1\u7684\u5143\u7d20","question":{"questionId":"658","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81ea\u7531\u4e4b\u8def","question":{"questionId":"514","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u597d\u8fdb\u5236","question":{"questionId":"483","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u53e5\u8bdd\u4e2d\u7684\u4e0d\u5e38\u89c1\u5355\u8bcd","question":{"questionId":"920","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u87ba\u65cb\u77e9\u9635 III","question":{"questionId":"921","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ef\u80fd\u7684\u4e8c\u5206\u6cd5","question":{"questionId":"922","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9e21\u86cb\u6389\u843d","question":{"questionId":"923","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6241\u5e73\u5316\u591a\u7ea7\u53cc\u5411\u94fe\u8868","question":{"questionId":"766","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73af\u7ed5\u5b57\u7b26\u4e32\u4e2d\u552f\u4e00\u7684\u5b50\u5b57\u7b26\u4e32","question":{"questionId":"467","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c K \u4e2a\u6700\u5c0f\u7684\u7d20\u6570\u5206\u6570","question":{"questionId":"802","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u6743\u91cd\u968f\u673a\u9009\u62e9","question":{"questionId":"912","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u5706\u5185\u968f\u673a\u751f\u6210\u70b9","question":{"questionId":"915","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230\u6700\u7ec8\u7684\u5b89\u5168\u72b6\u6001","question":{"questionId":"820","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u968f\u673a\u7ffb\u8f6c\u77e9\u9635","question":{"questionId":"913","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u7cfb\u7edf\u4e2d\u67e5\u627e\u91cd\u590d\u6587\u4ef6","question":{"questionId":"609","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u5faa\u73af\u53cc\u7aef\u961f\u5217","question":{"questionId":"859","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u516c\u5e73\u7684\u7cd6\u679c\u4ea4\u6362","question":{"questionId":"924","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u636e\u524d\u5e8f\u548c\u540e\u5e8f\u904d\u5386\u6784\u9020\u4e8c\u53c9\u6811","question":{"questionId":"925","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u5e8f\u5217\u5bbd\u5ea6\u4e4b\u548c","question":{"questionId":"927","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u548c\u66ff\u6362\u6a21\u5f0f","question":{"questionId":"926","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u7ef4\u5f62\u4f53\u7684\u8868\u9762\u79ef","question":{"questionId":"928","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6240\u6709\u53ef\u80fd\u7684\u6ee1\u4e8c\u53c9\u6811","question":{"questionId":"930","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7279\u6b8a\u7b49\u4ef7\u5b57\u7b26\u4e32\u7ec4","question":{"questionId":"929","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u9891\u7387\u6808","question":{"questionId":"931","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u591a\u7c73\u8bfa\u548c\u6258\u7c73\u8bfa\u5e73\u94fa","question":{"questionId":"806","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ff7\u4f60\u8bed\u6cd5\u5206\u6790\u5668","question":{"questionId":"385","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u9694\u94fe\u8868","question":{"questionId":"725","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u5361\u7247\u6e38\u620f","question":{"questionId":"842","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8c03\u6570\u5217","question":{"questionId":"932","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u6570\u7ec4\u6309\u4f4d\u6216\u64cd\u4f5c","question":{"questionId":"934","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9012\u589e\u987a\u5e8f\u67e5\u627e\u6811","question":{"questionId":"933","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u961f\u5217","question":{"questionId":"935","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5230\u8fbe\u7ec8\u70b9","question":{"questionId":"796","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94fe\u8868\u7ec4\u4ef6","question":{"questionId":"835","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"DI \u5e8f\u5217\u7684\u6709\u6548\u6392\u5217","question":{"questionId":"939","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4e3a N \u7684\u6570\u5b57\u7ec4\u5408","question":{"questionId":"938","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u80a1\u7968\u4ef7\u683c\u8de8\u5ea6","question":{"questionId":"937","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"RLE \u8fed\u4ee3\u5668","question":{"questionId":"936","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5947\u5076\u6392\u5e8f\u6570\u7ec4","question":{"questionId":"941","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d85\u7ea7\u56de\u6587\u6570","question":{"questionId":"942","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u6570\u7ec4\u7684\u6700\u5c0f\u503c\u4e4b\u548c","question":{"questionId":"943","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c34\u679c\u6210\u7bee","question":{"questionId":"940","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u5dee\u503c I","question":{"questionId":"944","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u5dee\u503c II","question":{"questionId":"946","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u86c7\u68af\u68cb","question":{"questionId":"945","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u7ebf\u9009\u4e3e","question":{"questionId":"947","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9694\u79bb\u75c5\u6bd2","question":{"questionId":"750","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u5b8c\u6574\u8bcd","question":{"questionId":"749","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5361\u724c\u5206\u7ec4","question":{"questionId":"950","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u6570\u7ec4","question":{"questionId":"951","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u5b50\u96c6","question":{"questionId":"952","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u732b\u548c\u8001\u9f20","question":{"questionId":"949","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ec5\u4ec5\u53cd\u8f6c\u5b57\u6bcd","question":{"questionId":"953","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73af\u5f62\u5b50\u6570\u7ec4\u7684\u6700\u5927\u548c","question":{"questionId":"954","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u64ad\u653e\u5217\u8868\u7684\u6570\u91cf","question":{"questionId":"956","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b8c\u5168\u4e8c\u53c9\u6811\u63d2\u5165\u5668","question":{"questionId":"955","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53d8\u4e3a\u68cb\u76d8","question":{"questionId":"798","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56db\u53c9\u6811\u4ea4\u96c6","question":{"questionId":"773","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f7f\u62ec\u53f7\u6709\u6548\u7684\u6700\u5c11\u6dfb\u52a0","question":{"questionId":"957","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5947\u5076\u6392\u5e8f\u6570\u7ec4 II","question":{"questionId":"958","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u6570\u4e4b\u548c\u7684\u591a\u79cd\u53ef\u80fd","question":{"questionId":"959","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c3d\u91cf\u51cf\u5c11\u6076\u610f\u8f6f\u4ef6\u7684\u4f20\u64ad","question":{"questionId":"960","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u975e\u91cd\u53e0\u77e9\u5f62\u4e2d\u7684\u968f\u673a\u70b9","question":{"questionId":"914","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b49\u5dee\u6570\u5217\u5212\u5206 II - \u5b50\u5e8f\u5217","question":{"questionId":"446","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Range \u6a21\u5757","question":{"questionId":"715","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u4e2d\u7684\u67e5\u627e\u4e0e\u66ff\u6362","question":{"questionId":"862","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f97\u5206\u6700\u9ad8\u7684\u6700\u5c0f\u8f6e\u8c03","question":{"questionId":"814","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d34\u7eb8\u62fc\u8bcd","question":{"questionId":"691","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u57fa\u672c\u8ba1\u7b97\u5668 IV","question":{"questionId":"781","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u957f\u6309\u952e\u5165","question":{"questionId":"961","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u7b49\u5206","question":{"questionId":"963","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u5b57\u7b26\u4e32\u7ffb\u8f6c\u5230\u5355\u8c03\u9012\u589e","question":{"questionId":"962","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c3d\u91cf\u51cf\u5c11\u6076\u610f\u8f6f\u4ef6\u7684\u4f20\u64ad II","question":{"questionId":"964","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u548c\u76f8\u540c\u7684\u4e8c\u5143\u5b50\u6570\u7ec4","question":{"questionId":"966","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0b\u964d\u8def\u5f84\u6700\u5c0f\u548c","question":{"questionId":"967","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6f02\u4eae\u6570\u7ec4","question":{"questionId":"968","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u72ec\u7279\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740","question":{"questionId":"965","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u7684\u6865","question":{"questionId":"971","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a91\u58eb\u62e8\u53f7\u5668","question":{"questionId":"972","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u8fd1\u7684\u8bf7\u6c42\u6b21\u6570","question":{"questionId":"969","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6233\u5370\u5e8f\u5217","question":{"questionId":"973","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u65b0\u6392\u5217\u65e5\u5fd7\u6587\u4ef6","question":{"questionId":"974","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u7684\u8303\u56f4\u548c","question":{"questionId":"975","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u9762\u79ef\u77e9\u5f62","question":{"questionId":"976","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u7684\u5b50\u5e8f\u5217 II","question":{"questionId":"977","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u5c71\u8109\u6570\u7ec4","question":{"questionId":"978","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u589e\u51cf\u5b57\u7b26\u4e32\u5339\u914d","question":{"questionId":"979","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u8d85\u7ea7\u4e32","question":{"questionId":"980","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u5217\u9020\u5e8f","question":{"questionId":"981","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f7f\u6570\u7ec4\u552f\u4e00\u7684\u6700\u5c0f\u589e\u91cf","question":{"questionId":"982","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u6808\u5e8f\u5217","question":{"questionId":"983","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u9664\u6700\u591a\u7684\u540c\u884c\u6216\u540c\u5217\u77f3\u5934","question":{"questionId":"984","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ee4\u724c\u653e\u7f6e","question":{"questionId":"985","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ed9\u5b9a\u6570\u5b57\u80fd\u7ec4\u6210\u7684\u6700\u5927\u65f6\u95f4","question":{"questionId":"986","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u516c\u56e0\u6570\u8ba1\u7b97\u6700\u5927\u7ec4\u4ef6\u5927\u5c0f","question":{"questionId":"989","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u9012\u589e\u987a\u5e8f\u663e\u793a\u5361\u724c","question":{"questionId":"987","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u7b49\u4ef7\u4e8c\u53c9\u6811","question":{"questionId":"988","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u5916\u661f\u8bed\u8bcd\u5178","question":{"questionId":"990","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u500d\u6570\u5bf9\u6570\u7ec4","question":{"questionId":"991","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u9ad8\u7684\u5e7f\u544a\u724c","question":{"questionId":"993","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u5217\u9020\u5e8f II","question":{"questionId":"992","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7531\u659c\u6760\u5212\u5206\u533a\u57df","question":{"questionId":"999","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"N \u5929\u540e\u7684\u7262\u623f","question":{"questionId":"994","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5b8c\u5168\u6027\u68c0\u9a8c","question":{"questionId":"998","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u5217\u9020\u5e8f III","question":{"questionId":"1000","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u590d N \u6b21\u7684\u5143\u7d20","question":{"questionId":"1001","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5bbd\u5ea6\u5761","question":{"questionId":"1002","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u9762\u79ef\u77e9\u5f62 II","question":{"questionId":"1003","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8868\u793a\u6570\u5b57\u7684\u6700\u5c11\u8fd0\u7b97\u7b26","question":{"questionId":"1004","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u503c\u4e8c\u53c9\u6811","question":{"questionId":"1005","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u5dee\u76f8\u540c\u7684\u6570\u5b57","question":{"questionId":"1007","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76d1\u63a7\u4e8c\u53c9\u6811","question":{"questionId":"1008","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5143\u97f3\u62fc\u5199\u68c0\u67e5\u5668","question":{"questionId":"1006","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f3a\u6574\u6570","question":{"questionId":"1010","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u714e\u997c\u6392\u5e8f","question":{"questionId":"1009","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u4e8c\u53c9\u6811\u4ee5\u5339\u914d\u5148\u5e8f\u904d\u5386","question":{"questionId":"1011","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u7b49\u7684\u6709\u7406\u6570","question":{"questionId":"1012","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6590\u6ce2\u90a3\u5951\u6570","question":{"questionId":"1013","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u89d2\u5f62\u7684\u6700\u5927\u5468\u957f","question":{"questionId":"1018","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u548c\u53ef\u88ab K \u6574\u9664\u7684\u5b50\u6570\u7ec4","question":{"questionId":"1016","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u63a5\u8fd1\u539f\u70b9\u7684 K \u4e2a\u70b9","question":{"questionId":"1014","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5947\u5076\u8df3","question":{"questionId":"1017","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u6570\u7ec4\u7684\u5e73\u65b9","question":{"questionId":"1019","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u6e4d\u6d41\u5b50\u6570\u7ec4","question":{"questionId":"1020","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728\u4e8c\u53c9\u6811\u4e2d\u5206\u914d\u786c\u5e01","question":{"questionId":"1021","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u8def\u5f84 III","question":{"questionId":"1022","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u4f4d\u4e0e\u4e3a\u96f6\u7684\u4e09\u5143\u7ec4","question":{"questionId":"1024","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u542b AAA \u6216 BBB \u7684\u5b57\u7b26\u4e32","question":{"questionId":"1026","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u57fa\u4e8e\u65f6\u95f4\u7684\u952e\u503c\u5b58\u50a8","question":{"questionId":"1023","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f4e\u7968\u4ef7","question":{"questionId":"1025","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u53f6\u7ed3\u70b9\u5f00\u59cb\u7684\u6700\u5c0f\u5b57\u7b26\u4e32","question":{"questionId":"1030","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u95f4\u5217\u8868\u7684\u4ea4\u96c6","question":{"questionId":"1028","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u8be2\u540e\u7684\u5076\u6570\u548c","question":{"questionId":"1027","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5782\u5e8f\u904d\u5386","question":{"questionId":"1029","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u5f62\u5f0f\u7684\u6574\u6570\u52a0\u6cd5","question":{"questionId":"1031","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b49\u5f0f\u65b9\u7a0b\u7684\u53ef\u6ee1\u8db3\u6027","question":{"questionId":"1032","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u574f\u4e86\u7684\u8ba1\u7b97\u5668","question":{"questionId":"1033","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u4e2a\u4e0d\u540c\u6574\u6570\u7684\u5b50\u6570\u7ec4","question":{"questionId":"1034","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5802\u5144\u5f1f\u8282\u70b9","question":{"questionId":"1035","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8150\u70c2\u7684\u6a58\u5b50","question":{"questionId":"1036","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u8fde\u7eed\u4f4d\u7684\u6700\u5c0f\u7ffb\u8f6c\u6b21\u6570","question":{"questionId":"1037","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6b63\u65b9\u5f62\u6570\u7ec4\u7684\u6570\u76ee","question":{"questionId":"1038","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230\u5c0f\u9547\u7684\u6cd5\u5b98","question":{"questionId":"1039","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f51\u683c\u7167\u660e","question":{"questionId":"1043","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4e8c\u53c9\u6811 II","question":{"questionId":"1040","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f66\u7684\u53ef\u7528\u6355\u83b7\u91cf","question":{"questionId":"1041","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u77f3\u5934\u7684\u6700\u4f4e\u6210\u672c","question":{"questionId":"1042","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u5e38\u7528\u5b57\u7b26","question":{"questionId":"1044","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u8fde\u7eed1\u7684\u4e2a\u6570 III","question":{"questionId":"1046","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68c0\u67e5\u66ff\u6362\u540e\u7684\u8bcd\u662f\u5426\u6709\u6548","question":{"questionId":"1045","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5148\u5e8f\u904d\u5386\u6784\u9020\u4e8c\u53c9\u6811","question":{"questionId":"1050","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u6b21\u53d6\u53cd\u540e\u6700\u5927\u5316\u7684\u6570\u7ec4\u548c","question":{"questionId":"1047","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u884c\u76f8\u7b49\u7684\u6700\u5c11\u591a\u7c73\u8bfa\u65cb\u8f6c","question":{"questionId":"1049","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b28\u9636\u4e58","question":{"questionId":"1048","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f62\u6210\u5b57\u7b26\u4e32\u7684\u6700\u77ed\u8def\u5f84","question":{"questionId":"1051","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u5316\u820d\u5165\u8bef\u5dee\u4ee5\u6ee1\u8db3\u76ee\u6807","question":{"questionId":"1053","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5341\u8fdb\u5236\u6574\u6570\u7684\u53cd\u7801","question":{"questionId":"1054","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u603b\u6301\u7eed\u65f6\u95f4\u53ef\u88ab 60 \u6574\u9664\u7684\u6b4c\u66f2","question":{"questionId":"1055","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u5c11\u6709 1 \u4f4d\u91cd\u590d\u7684\u6570\u5b57","question":{"questionId":"1057","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5728 D \u5929\u5185\u9001\u8fbe\u5305\u88f9\u7684\u80fd\u529b","question":{"questionId":"1056","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6821\u56ed\u81ea\u884c\u8f66\u5206\u914d","question":{"questionId":"1052","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u59cb\u70b9\u5230\u7ec8\u70b9\u7684\u6240\u6709\u8def\u5f84","question":{"questionId":"511","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6570\u7ec4\u5206\u6210\u548c\u76f8\u7b49\u7684\u4e09\u4e2a\u90e8\u5206","question":{"questionId":"1062","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f73\u89c2\u5149\u7ec4\u5408","question":{"questionId":"1063","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ef\u88ab K \u6574\u9664\u7684\u6700\u5c0f\u6574\u6570","question":{"questionId":"1064","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u4e32\u80fd\u8868\u793a\u4ece 1 \u5230 N \u6570\u5b57\u7684\u4e8c\u8fdb\u5236\u4e32","question":{"questionId":"1065","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u5b50\u6570\u7ec4\u7684\u6570\u76ee","question":{"questionId":"1061","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u6570\u7ec4\u4e2d\u7684\u7f3a\u5931\u5143\u7d20","question":{"questionId":"1059","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u91cd\u590d\u5b50\u4e32","question":{"questionId":"1060","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5b57\u5178\u5e8f\u6392\u5217\u6700\u5c0f\u7684\u7b49\u6548\u5b57\u7b26\u4e32","question":{"questionId":"1058","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d1f\u4e8c\u8fdb\u5236\u8f6c\u6362","question":{"questionId":"1070","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ef\u88ab 5 \u6574\u9664\u7684\u4e8c\u8fdb\u5236\u524d\u7f00","question":{"questionId":"1071","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u98de\u5730\u7684\u6570\u91cf","question":{"questionId":"1073","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94fe\u8868\u4e2d\u7684\u4e0b\u4e00\u4e2a\u66f4\u5927\u8282\u70b9","question":{"questionId":"1072","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u89c4\u5f8b II","question":{"questionId":"291","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u6700\u5916\u5c42\u7684\u62ec\u53f7","question":{"questionId":"1078","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u6839\u5230\u53f6\u7684\u4e8c\u8fdb\u5236\u6570\u4e4b\u548c","question":{"questionId":"1079","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89c6\u9891\u62fc\u63a5","question":{"questionId":"1081","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a7c\u5cf0\u5f0f\u5339\u914d","question":{"questionId":"1080","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9664\u6570\u535a\u5f08","question":{"questionId":"1086","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u7b49\u5dee\u6570\u5217","question":{"questionId":"1087","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8282\u70b9\u4e0e\u5176\u7956\u5148\u4e4b\u95f4\u7684\u6700\u5927\u5dee\u503c","question":{"questionId":"1092","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u5148\u5e8f\u904d\u5386\u8fd8\u539f\u4e8c\u53c9\u6811","question":{"questionId":"1093","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6613\u6df7\u6dc6\u6570","question":{"questionId":"1069","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0a\u4e0b\u7ffb\u8f6c\u4e8c\u53c9\u6811","question":{"questionId":"156","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5458\u5de5\u5956\u91d1","question":{"questionId":"577","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u591a\u5305\u542b\u4e24\u4e2a\u4e0d\u540c\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32","question":{"questionId":"159","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u5355\u8bcd\u8ddd\u79bb","question":{"questionId":"243","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u5355\u8bcd\u8ddd\u79bb II","question":{"questionId":"244","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u5730\u8c03\u5ea6","question":{"questionId":"1095","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u4e2a\u975e\u91cd\u53e0\u5b50\u6570\u7ec4\u7684\u6700\u5927\u548c","question":{"questionId":"1096","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u6d41","question":{"questionId":"1097","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ddd\u79bb\u987a\u5e8f\u6392\u5217\u77e9\u9635\u5355\u5143\u683c","question":{"questionId":"1094","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e2d\u5fc3\u5bf9\u79f0\u6570","question":{"questionId":"246","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e2d\u5fc3\u5bf9\u79f0\u6570 II","question":{"questionId":"247","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e2d\u5fc3\u5bf9\u79f0\u6570 III","question":{"questionId":"248","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u5355\u8bcd\u8ddd\u79bb III","question":{"questionId":"245","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f1a\u8bae\u5ba4","question":{"questionId":"252","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f1a\u8bae\u5ba4 II","question":{"questionId":"253","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528 Read4 \u8bfb\u53d6 N \u4e2a\u5b57\u7b26","question":{"questionId":"157","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528 Read4 \u8bfb\u53d6 N \u4e2a\u5b57\u7b26 II","question":{"questionId":"158","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6392\u5e8f\u6570\u7ec4","question":{"questionId":"948","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u9694\u4e3a 1 \u7684\u7f16\u8f91\u8ddd\u79bb","question":{"questionId":"161","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f3a\u5931\u7684\u533a\u95f4","question":{"questionId":"163","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e24\u6570\u4e4b\u548c III - \u6570\u636e\u7ed3\u6784\u8bbe\u8ba1","question":{"questionId":"170","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u5b57\u7b26\u4e32\u91cc\u7684\u5355\u8bcd II","question":{"questionId":"186","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65e0\u5411\u56fe\u4e2d\u8fde\u901a\u5206\u91cf\u7684\u6570\u76ee","question":{"questionId":"323","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u4f4d\u5b57\u7b26\u4e32\u5206\u7ec4","question":{"questionId":"249","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u548c\u7b49\u4e8e k \u7684\u6700\u957f\u5b50\u6570\u7ec4\u957f\u5ea6","question":{"questionId":"325","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u540c\u503c\u5b50\u6811","question":{"questionId":"250","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c55\u5f00\u4e8c\u7ef4\u5411\u91cf","question":{"questionId":"251","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56e0\u5b50\u7684\u7ec4\u5408","question":{"questionId":"254","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927 BST \u5b50\u6811","question":{"questionId":"333","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5d4c\u5957\u5217\u8868\u6743\u91cd\u548c","question":{"questionId":"339","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u591a\u5305\u542b K \u4e2a\u4e0d\u540c\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32","question":{"questionId":"340","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u524d\u5e8f\u904d\u5386\u5e8f\u5217\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"255","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7c89\u5237\u623f\u5b50","question":{"questionId":"256","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f83\u5c0f\u7684\u4e09\u6570\u4e4b\u548c","question":{"questionId":"259","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ee5\u56fe\u5224\u6811","question":{"questionId":"261","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u636e\u6d41\u4e2d\u7684\u79fb\u52a8\u5e73\u5747\u503c","question":{"questionId":"346","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8303\u56f4\u5185\u7684\u6570\u5b57\u8ba1\u6570","question":{"questionId":"1068","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u52a8\u77f3\u5b50\u76f4\u5230\u8fde\u7eed","question":{"questionId":"1103","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fb9\u6846\u7740\u8272","question":{"questionId":"1104","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u76f8\u4ea4\u7684\u7ebf","question":{"questionId":"1105","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9003\u79bb\u5927\u8ff7\u5bab","question":{"questionId":"1106","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7c89\u5237\u623f\u5b50 II","question":{"questionId":"265","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u6392\u5217","question":{"questionId":"266","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56de\u6587\u6392\u5217 II","question":{"questionId":"267","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u706b\u661f\u8bcd\u5178","question":{"questionId":"269","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u63a5\u8fd1\u7684\u4e8c\u53c9\u641c\u7d22\u6811\u503c","question":{"questionId":"270","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u7684\u7f16\u7801\u4e0e\u89e3\u7801","question":{"questionId":"271","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5224\u5b9a\u4e95\u5b57\u68cb\u80dc\u8d1f","question":{"questionId":"348","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b89\u5353\u7cfb\u7edf\u624b\u52bf\u89e3\u9501","question":{"questionId":"351","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u8ddd\u79bb\u95f4\u9694\u91cd\u6392\u5b57\u7b26\u4e32","question":{"questionId":"358","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d2a\u5403\u86c7","question":{"questionId":"353","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f4\u7ebf\u955c\u50cf","question":{"questionId":"356","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65e5\u5fd7\u901f\u7387\u9650\u5236\u5668","question":{"questionId":"359","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u5e8f\u8f6c\u5316\u6570\u7ec4","question":{"questionId":"360","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f70\u70b8\u654c\u4eba","question":{"questionId":"361","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6572\u51fb\u8ba1\u6570\u5668","question":{"questionId":"362","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u52a0\u6743\u5d4c\u5957\u5e8f\u5217\u548c II","question":{"questionId":"364","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u5b8c\u5168\u4e8c\u53c9\u6811\u7684\u53f6\u5b50\u8282\u70b9","question":{"questionId":"366","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ed9\u5355\u94fe\u8868\u52a0\u4e00","question":{"questionId":"369","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u533a\u95f4\u52a0\u6cd5","question":{"questionId":"370","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7535\u8bdd\u76ee\u5f55\u7ba1\u7406\u7cfb\u7edf","question":{"questionId":"379","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u5355\u8bcd\u7f29\u5199","question":{"questionId":"408","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u7279\u5f02\u5355\u8bcd\u7f29\u5199","question":{"questionId":"411","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u9635\u4e2d\u6700\u957f\u7684\u8fde\u7eed1\u7ebf\u6bb5","question":{"questionId":"562","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u63a5\u8fd1\u7684\u4e8c\u53c9\u641c\u7d22\u6811\u503c II","question":{"questionId":"272","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6805\u680f\u6d82\u8272","question":{"questionId":"276","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u4e2d\u6700\u957f\u7684\u8fde\u7eed\u5e8f\u5217","question":{"questionId":"549","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u5bfb\u540d\u4eba","question":{"questionId":"277","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6446\u52a8\u6392\u5e8f","question":{"questionId":"280","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u952f\u9f7f\u8fed\u4ee3\u5668","question":{"questionId":"281","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6570\u7ec4\u5206\u5272\u6210\u548c\u76f8\u7b49\u7684\u5b50\u6570\u7ec4","question":{"questionId":"548","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u987a\u5e8f\u540e\u7ee7","question":{"questionId":"285","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5899\u4e0e\u95e8","question":{"questionId":"286","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f53\u9009\u8005","question":{"questionId":"574","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u6e38\u620f","question":{"questionId":"293","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ffb\u8f6c\u6e38\u620f II","question":{"questionId":"294","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f73\u7684\u78b0\u5934\u5730\u70b9","question":{"questionId":"296","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u7684\u552f\u4e00\u7f29\u5199","question":{"questionId":"288","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c9b\u5c7f\u6570\u91cf II","question":{"questionId":"305","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c4f\u5e55\u53ef\u663e\u793a\u53e5\u5b50\u7684\u6570\u91cf","question":{"questionId":"418","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u5355\u8bcd\u65b9\u5757","question":{"questionId":"422","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u65b9\u5757","question":{"questionId":"425","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u4e8c\u53c9\u641c\u7d22\u6811\u8f6c\u5316\u4e3a\u6392\u5e8f\u7684\u53cc\u5411\u94fe\u8868","question":{"questionId":"758","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316 N \u53c9\u6811","question":{"questionId":"765","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u6700\u957f\u8fde\u7eed\u5e8f\u5217","question":{"questionId":"298","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5305\u542b\u5168\u90e8\u9ed1\u8272\u50cf\u7d20\u7684\u6700\u5c0f\u77e9\u5f62","question":{"questionId":"302","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c11\u4ea4\u6362\u6b21\u6570\u6765\u7ec4\u5408\u6240\u6709\u7684 1","question":{"questionId":"1107","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u52a8\u77f3\u5b50\u76f4\u5230\u8fde\u7eed II","question":{"questionId":"1113","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u4e8c\u53c9\u641c\u7d22\u6811\u5230\u66f4\u5927\u548c\u6811","question":{"questionId":"1114","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06 N \u53c9\u6811\u7f16\u7801\u4e3a\u4e8c\u53c9\u6811","question":{"questionId":"771","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u591a\u8fb9\u5f62\u4e09\u89d2\u5256\u5206\u7684\u6700\u4f4e\u5f97\u5206","question":{"questionId":"1111","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u5143\u8868\u8fbe\u5f0f\u89e3\u6790\u5668","question":{"questionId":"439","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e8f\u5217\u91cd\u5efa","question":{"questionId":"444","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u8fde\u63a5\u5b57\u7b26\u4e32","question":{"questionId":"555","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u516c\u8def\u6d41\u91cf","question":{"questionId":"1110","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5458\u5de5\u85aa\u6c34\u4e2d\u4f4d\u6570","question":{"questionId":"569","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u677e\u9f20\u6a21\u62df","question":{"questionId":"573","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u8be2\u5458\u5de5\u7684\u7d2f\u8ba1\u85aa\u6c34","question":{"questionId":"579","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u81f3\u5c11\u67095\u540d\u76f4\u63a5\u4e0b\u5c5e\u7684\u7ecf\u7406","question":{"questionId":"570","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ed9\u5b9a\u6570\u5b57\u7684\u9891\u7387\u67e5\u8be2\u4e2d\u4f4d\u6570","question":{"questionId":"571","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u8be2\u56de\u7b54\u7387\u6700\u9ad8\u7684\u95ee\u9898","question":{"questionId":"578","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u7684\u56de\u65cb\u9556","question":{"questionId":"1115","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u7684\u7d22\u5f15\u5bf9","question":{"questionId":"1075","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u4f11\u5047\u5929\u6570","question":{"questionId":"568","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7a00\u758f\u77e9\u9635\u7684\u4e58\u6cd5","question":{"questionId":"311","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u7ef4\u533a\u57df\u548c\u68c0\u7d22 - \u53ef\u53d8","question":{"questionId":"308","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5217\u4e3e\u5355\u8bcd\u7684\u5168\u90e8\u7f29\u5199","question":{"questionId":"320","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79bb\u5efa\u7b51\u7269\u6700\u8fd1\u7684\u8ddd\u79bb","question":{"questionId":"317","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u5782\u76f4\u904d\u5386","question":{"questionId":"314","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ff7\u5bab","question":{"questionId":"490","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b64\u72ec\u50cf\u7d20 I","question":{"questionId":"531","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b64\u72ec\u50cf\u7d20 II","question":{"questionId":"533","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f18\u8d26\u5355\u5e73\u8861","question":{"questionId":"465","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u51f8\u591a\u8fb9\u5f62","question":{"questionId":"469","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f16\u7801\u6700\u77ed\u957f\u5ea6\u7684\u5b57\u7b26\u4e32","question":{"questionId":"471","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u6392\u5217","question":{"questionId":"484","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b66\u751f\u5730\u7406\u4fe1\u606f\u62a5\u544a","question":{"questionId":"618","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u56e0\u5f0f\u5206\u89e3","question":{"questionId":"625","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u5404\u4e13\u4e1a\u5b66\u751f\u4eba\u6570","question":{"questionId":"580","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u6570\u7ec4\u7684\u9519\u4f4d\u6392\u5217","question":{"questionId":"634","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u8fde\u7eed1\u7684\u4e2a\u6570 II","question":{"questionId":"487","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u626b\u5730\u673a\u5668\u4eba","question":{"questionId":"865","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ff7\u5bab II","question":{"questionId":"505","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ff7\u5bab III","question":{"questionId":"499","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u641c\u7d22\u6811\u4e2d\u7684\u4e2d\u5e8f\u540e\u7ee7 II","question":{"questionId":"509","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u8bcd\u7f29\u5199","question":{"questionId":"527","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u5b57\u7b26\u4e32\u751f\u6210\u4e8c\u53c9\u6811","question":{"questionId":"536","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6740\u6b7b\u8fdb\u7a0b","question":{"questionId":"582","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u7528\u6237\u63a8\u8350\u4eba","question":{"questionId":"584","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2016\u5e74\u7684\u6295\u8d44","question":{"questionId":"585","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ba2\u5355\u6700\u591a\u7684\u5ba2\u6237","question":{"questionId":"586","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u5185\u5b58\u6587\u4ef6\u7cfb\u7edf","question":{"questionId":"588","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f93\u51fa\u6bd4\u8d5b\u5339\u914d\u5bf9","question":{"questionId":"544","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7684\u8fb9\u754c","question":{"questionId":"545","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u597d\u53cb\u7533\u8bf7 I \uff1a\u603b\u4f53\u901a\u8fc7\u7387","question":{"questionId":"597","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u597d\u53cb\u7533\u8bf7 II \uff1a\u8c01\u6709\u6700\u591a\u7684\u597d\u53cb","question":{"questionId":"602","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u7eed\u7a7a\u4f59\u5ea7\u4f4d","question":{"questionId":"603","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fed\u4ee3\u538b\u7f29\u5b57\u7b26\u4e32","question":{"questionId":"604","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9500\u552e\u5458","question":{"questionId":"607","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6811\u8282\u70b9","question":{"questionId":"608","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5224\u65ad\u4e09\u89d2\u5f62","question":{"questionId":"610","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e73\u9762\u4e0a\u7684\u6700\u8fd1\u8ddd\u79bb","question":{"questionId":"612","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f4\u7ebf\u4e0a\u7684\u6700\u8fd1\u8ddd\u79bb","question":{"questionId":"613","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u7ea7\u5173\u6ce8\u8005","question":{"questionId":"614","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e73\u5747\u5de5\u8d44\uff1a\u90e8\u95e8\u4e0e\u516c\u53f8\u6bd4\u8f83","question":{"questionId":"615","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ed9\u5b57\u7b26\u4e32\u6dfb\u52a0\u52a0\u7c97\u6807\u7b7e","question":{"questionId":"616","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6700\u5927\u6570\u5b57","question":{"questionId":"619","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u5217\u8868\u4e2d\u7684\u6700\u5927\u8ddd\u79bb","question":{"questionId":"624","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u7a97\u53e3\u5b50\u5e8f\u5217","question":{"questionId":"727","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u6808","question":{"questionId":"716","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7c89\u788e\u7cd6\u679c","question":{"questionId":"723","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"4\u952e\u952e\u76d8","question":{"questionId":"651","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5e73\u5747\u5b50\u6bb5\u548c II","question":{"questionId":"644","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5747\u5300\u6811\u5212\u5206","question":{"questionId":"663","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u79fb\u9664 9","question":{"questionId":"660","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91d1\u5e01\u8def\u5f84","question":{"questionId":"656","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53e5\u5b50\u76f8\u4f3c\u6027","question":{"questionId":"734","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53e5\u5b50\u76f8\u4f3c\u6027 II","question":{"questionId":"737","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u6700\u8fd1\u7684\u53f6\u8282\u70b9","question":{"questionId":"743","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8def\u5f84\u548c IV","question":{"questionId":"666","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u8fd1\u65f6\u523b","question":{"questionId":"681","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u4e2a\u7a7a\u82b1\u76c6","question":{"questionId":"683","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u91cd\u590d\u5b50\u4e32","question":{"questionId":"1122","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u9694\u6570\u7ec4\u4ee5\u5f97\u5230\u6700\u5927\u548c","question":{"questionId":"1121","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u5c9b\u5c7f\u7684\u6570\u91cf","question":{"questionId":"694","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56f0\u4e8e\u73af\u4e2d\u7684\u673a\u5668\u4eba","question":{"questionId":"1119","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u5c9b\u5c7f\u7684\u6570\u91cf II","question":{"questionId":"711","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u90bb\u63a5\u690d\u82b1","question":{"questionId":"1120","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89d2\u77e9\u5f62\u7684\u6570\u91cf","question":{"questionId":"751","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"IP \u5230 CIDR","question":{"questionId":"752","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u641c\u7d22\u957f\u5ea6\u672a\u77e5\u7684\u6709\u5e8f\u6570\u7ec4","question":{"questionId":"786","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5faa\u73af\u6709\u5e8f\u5217\u8868\u7684\u63d2\u5165","question":{"questionId":"850","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1 Excel \u6c42\u548c\u516c\u5f0f","question":{"questionId":"631","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u65e5\u5fd7\u5b58\u50a8\u7cfb\u7edf","question":{"questionId":"635","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u641c\u7d22\u81ea\u52a8\u8865\u5168\u7cfb\u7edf","question":{"questionId":"642","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5012\u6c34","question":{"questionId":"756","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u4e2d\u7684\u52a0\u7c97\u5355\u8bcd","question":{"questionId":"760","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5458\u5de5\u7a7a\u95f2\u65f6\u95f4","question":{"questionId":"761","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u51fa\u53d8\u4f4d\u6620\u5c04","question":{"questionId":"762","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u57fa\u672c\u8ba1\u7b97\u5668 III","question":{"questionId":"785","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u5316\u53bb\u52a0\u6cb9\u7ad9\u7684\u6700\u5927\u8ddd\u79bb","question":{"questionId":"788","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62c6\u5206\u4e8c\u53c9\u641c\u7d22\u6811","question":{"questionId":"791","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u76f8\u4f3c RGB \u989c\u8272","question":{"questionId":"818","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u540e\u4e00\u5757\u77f3\u5934\u7684\u91cd\u91cf","question":{"questionId":"1127","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u540e\u4e00\u5757\u77f3\u5934\u7684\u91cd\u91cf II","question":{"questionId":"1130","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709\u76f8\u90bb\u91cd\u590d\u9879","question":{"questionId":"1128","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u5b57\u7b26\u4e32\u94fe","question":{"questionId":"1129","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9ad8\u5ea6\u68c0\u67e5\u5668","question":{"questionId":"1137","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u6362\u4e00\u6b21\u7684\u5148\u524d\u6392\u5217","question":{"questionId":"1139","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8ddd\u79bb\u76f8\u7b49\u7684\u6761\u5f62\u7801","question":{"questionId":"1140","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7231\u751f\u6c14\u7684\u4e66\u5e97\u8001\u677f","question":{"questionId":"1138","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c0f\u4e8e K \u7684\u4e24\u6570\u4e4b\u548c","question":{"questionId":"1083","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u52a8\u70b9","question":{"questionId":"1066","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6821\u56ed\u81ea\u884c\u8f66\u5206\u914d II","question":{"questionId":"1067","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5217\u7ffb\u8f6c\u5f97\u5230\u6700\u5927\u503c\u7b49\u884c\u6570","question":{"questionId":"1147","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d1f\u4e8c\u8fdb\u5236\u6570\u76f8\u52a0","question":{"questionId":"1148","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5143\u7d20\u548c\u4e3a\u76ee\u6807\u503c\u7684\u5b50\u77e9\u9635\u6570\u91cf","question":{"questionId":"1145","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u7684\u6700\u5927\u516c\u56e0\u5b50","question":{"questionId":"1146","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u4f5c\u8fc7\u81f3\u5c11\u4e09\u6b21\u7684\u6f14\u5458\u548c\u5bfc\u6f14","question":{"questionId":"1136","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e70\u4e0b\u6240\u6709\u4ea7\u54c1\u7684\u5ba2\u6237","question":{"questionId":"1135","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0d\u540c\u5b57\u7b26\u7684\u6700\u5c0f\u5b50\u5e8f\u5217","question":{"questionId":"1159","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"Bigram \u5206\u8bcd","question":{"questionId":"1156","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6d3b\u5b57\u5370\u5237","question":{"questionId":"1160","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u5230\u53f6\u8def\u5f84\u4e0a\u7684\u4e0d\u8db3\u8282\u70b9","question":{"questionId":"1157","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u590d\u5199\u96f6","question":{"questionId":"1168","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53d7\u6807\u7b7e\u5f71\u54cd\u7684\u6700\u5927\u503c","question":{"questionId":"1169","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u77ed\u516c\u5171\u8d85\u5e8f\u5217","question":{"questionId":"1170","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u8fdb\u5236\u77e9\u9635\u4e2d\u7684\u6700\u77ed\u8def\u5f84","question":{"questionId":"1171","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u5143\u7d20\u5404\u6570\u4f4d\u4e4b\u548c","question":{"questionId":"1082","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u524d\u4e94\u79d1\u7684\u5747\u5206","question":{"questionId":"1074","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u5207\u6362","question":{"questionId":"1076","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6613\u6df7\u6dc6\u6570 II","question":{"questionId":"1077","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u53ea\u542b\u5355\u4e00\u5b57\u6bcd\u7684\u5b50\u4e32","question":{"questionId":"1131","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u4e24\u68f5\u4e8c\u53c9\u641c\u7d22\u6811\u4e4b\u548c","question":{"questionId":"1150","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62fc\u8f66","question":{"questionId":"1184","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5927\u6837\u672c\u7edf\u8ba1","question":{"questionId":"1183","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c71\u8109\u6570\u7ec4\u4e2d\u67e5\u627e\u76ee\u6807\u503c","question":{"questionId":"1185","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u82b1\u62ec\u53f7\u5c55\u5f00 II","question":{"questionId":"1188","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f97\u5206\u6700\u9ad8\u7684\u8def\u5f84","question":{"questionId":"1099","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u957f\u5ea6\u4e3a K \u7684\u65e0\u91cd\u590d\u5b57\u7b26\u5b50\u4e32","question":{"questionId":"1084","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f7c\u6b64\u719f\u8bc6\u7684\u6700\u65e9\u65f6\u95f4","question":{"questionId":"1085","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u5bfb\u8def","question":{"questionId":"1194","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89e3\u6790\u5e03\u5c14\u8868\u8fbe\u5f0f","question":{"questionId":"1197","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u7cd6\u679c II","question":{"questionId":"1195","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u586b\u5145\u4e66\u67b6","question":{"questionId":"1196","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"IP \u5730\u5740\u65e0\u6548\u5316","question":{"questionId":"1205","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u822a\u73ed\u9884\u8ba2\u7edf\u8ba1","question":{"questionId":"1206","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u70b9\u6210\u6797","question":{"questionId":"1207","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u516d\u9898","question":{"questionId":"100008","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u4e00\u9898","question":{"questionId":"100003","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u4e8c\u9898","question":{"questionId":"100004","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u4e09\u9898","question":{"questionId":"100005","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u56db\u9898","question":{"questionId":"100006","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u7b2c\u4e94\u9898","question":{"questionId":"100007","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u4e00\u9898","question":{"questionId":"100009","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u4e8c\u9898","question":{"questionId":"100010","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u4e09\u9898","question":{"questionId":"100011","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u56db\u9898","question":{"questionId":"100012","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u4e94\u9898","question":{"questionId":"100013","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u7b2c\u516d\u9898","question":{"questionId":"100014","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u4e00\u9898","question":{"questionId":"100015","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u4e8c\u9898","question":{"questionId":"100016","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u4e09\u9898","question":{"questionId":"100017","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u56db\u9898","question":{"questionId":"100018","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u4e94\u9898","question":{"questionId":"100019","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u7b2c\u516d\u9898","question":{"questionId":"100020","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e09\u4e2a\u6709\u5e8f\u6570\u7ec4\u7684\u4ea4\u96c6","question":{"questionId":"1149","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u53d8\u6362","question":{"questionId":"1175","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6709\u6548\u62ec\u53f7\u7684\u5d4c\u5957\u6df1\u5ea6","question":{"questionId":"1208","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u4e00\u9898","question":{"questionId":"100002","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u4e8c\u9898","question":{"questionId":"100021","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u4e09\u9898","question":{"questionId":"100022","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u56db\u9898","question":{"questionId":"100023","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u4e94\u9898","question":{"questionId":"100024","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4 \u521d\u8d5b\u7b2c\u516d\u9898","question":{"questionId":"100025","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e00\u9898","question":{"questionId":"100026","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e8c\u9898","question":{"questionId":"100027","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e09\u9898","question":{"questionId":"100028","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u56db\u9898","question":{"questionId":"100029","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e94\u9898","question":{"questionId":"100030","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u516d\u9898","question":{"questionId":"100031","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e00\u9898","question":{"questionId":"100032","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e8c\u9898","question":{"questionId":"100033","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e09\u9898","question":{"questionId":"100034","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u56db\u9898","question":{"questionId":"100035","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u4e94\u9898","question":{"questionId":"100036","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u9ad8\u4e2d\u7ec4 \u521d\u8d5b\u7b2c\u516d\u9898","question":{"questionId":"100037","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u6708\u6709\u591a\u5c11\u5929","question":{"questionId":"1088","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u53bb\u5b57\u7b26\u4e32\u4e2d\u7684\u5143\u97f3","question":{"questionId":"1089","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u6811\u7684\u6700\u5927\u5e73\u5747\u503c","question":{"questionId":"1091","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c06\u6570\u7ec4\u5206\u6210\u51e0\u4e2a\u9012\u589e\u5e8f\u5217","question":{"questionId":"1118","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u6df1\u53f6\u8282\u70b9\u7684\u6700\u8fd1\u516c\u5171\u7956\u5148","question":{"questionId":"1218","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8868\u73b0\u826f\u597d\u7684\u6700\u957f\u65f6\u95f4\u6bb5","question":{"questionId":"1219","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u7684\u76f8\u5bf9\u6392\u5e8f","question":{"questionId":"1217","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u7684\u5fc5\u8981\u56e2\u961f","question":{"questionId":"1220","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5e8f\u6253\u5370","question":{"questionId":"1203","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"H2O \u751f\u6210","question":{"questionId":"1186","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u66ff\u6253\u5370FooBar","question":{"questionId":"1187","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5efa\u9020\u8857\u533a\u7684\u6700\u77ed\u65f6\u95f4","question":{"questionId":"1167","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6253\u5370\u96f6\u4e0e\u5947\u5076\u6570","question":{"questionId":"1216","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b49\u4ef7\u591a\u7c73\u8bfa\u9aa8\u724c\u5bf9\u7684\u6570\u91cf","question":{"questionId":"1227","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u989c\u8272\u4ea4\u66ff\u7684\u6700\u77ed\u8def\u5f84","question":{"questionId":"1229","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edd\u5bf9\u503c\u8868\u8fbe\u5f0f\u7684\u6700\u5927\u503c","question":{"questionId":"1230","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53f6\u503c\u7684\u6700\u5c0f\u4ee3\u4ef7\u751f\u6210\u6811","question":{"questionId":"1228","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u552f\u4e00\u6570","question":{"questionId":"1098","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u963f\u59c6\u65af\u7279\u6717\u6570","question":{"questionId":"1090","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u7684\u4ee5 1 \u4e3a\u8fb9\u754c\u7684\u6b63\u65b9\u5f62","question":{"questionId":"1239","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b2c N \u4e2a\u6cf0\u6ce2\u90a3\u5951\u6570","question":{"questionId":"1236","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u677f\u4e0a\u7684\u8def\u5f84","question":{"questionId":"1238","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u4f4e\u6210\u672c\u8054\u901a\u6240\u6709\u57ce\u5e02","question":{"questionId":"1100","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77f3\u5b50\u6e38\u620f II","question":{"questionId":"1240","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e73\u884c\u8bfe\u7a0b","question":{"questionId":"1101","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u78b0\u649e\u6b21\u6570","question":{"questionId":"100038","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u6bcd\u8def\u5f84","question":{"questionId":"100058","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53bb\u9664\u91cd\u590d\u5b57\u6bcd","question":{"questionId":"100057","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8868\u73b0\u826f\u597d\u7684\u6700\u957f\u65f6\u95f4\u6bb5","question":{"questionId":"100056","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89e3\u7801\u65b9\u6cd5","question":{"questionId":"100054","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6708\u7403\u8f66","question":{"questionId":"100053","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9012\u51cf\u5143\u7d20\u4f7f\u6570\u7ec4\u5448\u952f\u9f7f\u72b6","question":{"questionId":"1247","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e8c\u53c9\u6811\u7740\u8272\u6e38\u620f","question":{"questionId":"1248","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5feb\u7167\u6570\u7ec4","question":{"questionId":"1249","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bb5\u5f0f\u56de\u6587","question":{"questionId":"1251","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e00\u9898","question":{"questionId":"100039","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e8c\u9898","question":{"questionId":"100040","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e09\u9898","question":{"questionId":"100041","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u56db\u9898","question":{"questionId":"100042","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e94\u9898","question":{"questionId":"100043","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u7b2c\u516d\u9898","question":{"questionId":"100044","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u5c0f\u5b66\u7ec4\u73b0\u573a\u8d5b \u8eab\u4efd\u9a8c\u8bc1\u9898","question":{"questionId":"100052","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e00\u9898","question":{"questionId":"100045","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e8c\u9898","question":{"questionId":"100046","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e09\u9898","question":{"questionId":"100047","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u56db\u9898","question":{"questionId":"100048","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u4e94\u9898","question":{"questionId":"100049","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u7b2c\u516d\u9898","question":{"questionId":"100050","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"2019 \u5e74\u4e0a\u6d77\u5e02\u521b\u610f\u7f16\u7a0b\u4e0e\u667a\u80fd\u8bbe\u8ba1\u5927\u8d5b \u7b97\u6cd5\u7f16\u7a0b \u521d\u4e2d\u7ec4\u73b0\u573a\u8d5b \u8eab\u4efd\u9a8c\u8bc1\u9898","question":{"questionId":"100051","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b57\u7b26\u4e32\u8f6c\u5316","question":{"questionId":"1124","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68c0\u67e5\u4e00\u4e2a\u6570\u662f\u5426\u5728\u6570\u7ec4\u4e2d\u5360\u7edd\u5927\u591a\u6570","question":{"questionId":"1102","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7528\u6237\u7f51\u7ad9\u8bbf\u95ee\u884c\u4e3a\u5206\u6790","question":{"questionId":"1108","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u5e74\u4e2d\u7684\u7b2c\u51e0\u5929","question":{"questionId":"1260","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u5b57\u7b26\u91cd\u590d\u5b50\u4e32\u7684\u6700\u5927\u957f\u5ea6","question":{"questionId":"1261","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63b7\u9ab0\u5b50\u7684N\u79cd\u65b9\u6cd5","question":{"questionId":"1263","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b50\u6570\u7ec4\u4e2d\u5360\u7edd\u5927\u591a\u6570\u7684\u5143\u7d20","question":{"questionId":"1262","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c9b\u5c7f\u7684\u6700\u5927\u9762\u79ef","question":{"questionId":"100072","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"LRU \u5185\u5b58\u673a\u5236","question":{"questionId":"100069","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u519b\u961f\u77e9\u9635","question":{"questionId":"100071","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6570\u7ec4\u76f8\u5bf9\u6392\u5e8f","question":{"questionId":"100068","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8c03\u5e45AM","question":{"questionId":"100073","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u8303\u56f4","question":{"questionId":"100074","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u7684\u5b50\u5e8f\u5217","question":{"questionId":"100075","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fd8\u539fIPv4\u5730\u5740","question":{"questionId":"100076","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d44\u8baf\u4fdd\u62a4","question":{"questionId":"100077","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8131\u6c27\u6838\u7cd6\u6838\u9178","question":{"questionId":"100078","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u94fe\u8868\u7ec4\u4ef6","question":{"questionId":"100079","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u996e\u6c34\u673a\u6c34\u6e29","question":{"questionId":"100080","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u88c5\u76d2\u5b50","question":{"questionId":"100070","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5730\u56fe\u5206\u6790","question":{"questionId":"1117","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u62fc\u5199\u5355\u8bcd","question":{"questionId":"1112","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5c42\u5185\u5143\u7d20\u548c","question":{"questionId":"1116","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6309\u5b57\u5178\u5e8f\u6392\u5728\u6700\u540e\u7684\u5b50\u4e32","question":{"questionId":"1133","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u751f\u6210\u62ec\u5f27","question":{"questionId":"100081","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea7\u54c1\u9500\u552e\u5206\u6790 II","question":{"questionId":"1154","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9500\u552e\u5206\u6790 I ","question":{"questionId":"1172","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c0f\u4f17\u4e66\u7c4d","question":{"questionId":"1198","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9879\u76ee\u5458\u5de5 III","question":{"questionId":"1163","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7ec6\u83cc\u4f53","question":{"questionId":"100082","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u68cb\u76d8","question":{"questionId":"100083","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u544a\u8b66","question":{"questionId":"100084","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b66\u4e60\u82f1\u8bed\u5355\u8bcd","question":{"questionId":"100085","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u5230\u53bf\u57ce\u7684\u79d8\u5bc6\u53f8\u6cd5\u4eba\u5458","question":{"questionId":"100086","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e50\u9ad8\u79ef\u6728\u65b9\u5f62\u62fc\u56fe","question":{"questionId":"100087","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u8de8\u5ea6\u6c42\u89e3","question":{"questionId":"100088","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6d88\u606f\u53d1\u9001\u673a","question":{"questionId":"100089","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6839\u636e\u4f53\u91cd\u91cd\u5efa\u961f\u5217","question":{"questionId":"100090","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5355\u884c\u952e\u76d8","question":{"questionId":"1123","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fde\u63a5\u68d2\u6750\u7684\u6700\u4f4e\u8d39\u7528","question":{"questionId":"1126","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6c34\u8d44\u6e90\u5206\u914d\u4f18\u5316","question":{"questionId":"1144","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u6587\u4ef6\u7cfb\u7edf","question":{"questionId":"1125","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9910\u76d8\u6808","question":{"questionId":"1270","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u8be2\u65e0\u6548\u4ea4\u6613","question":{"questionId":"1272","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bd4\u8f83\u5b57\u7b26\u4e32\u6700\u5c0f\u5b57\u6bcd\u51fa\u73b0\u9891\u6b21","question":{"questionId":"1273","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ece\u94fe\u8868\u4e2d\u5220\u53bb\u603b\u548c\u503c\u4e3a\u96f6\u7684\u8fde\u7eed\u8282\u70b9","question":{"questionId":"1267","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u529b\u6263\u8c61\u68cb\u5b66\u5802","question":{"questionId":"100091","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5f0f\u5316\u7b80","question":{"questionId":"100092","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8986\u76d6","question":{"questionId":"100093","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53d1 LeetCoin","question":{"questionId":"100094","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5e38\u91cf\u5b57\u7b26\u4e32\u7684\u7f16\u8bd1\u4f18\u5316","question":{"questionId":"100095","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u673a\u5668\u4eba\u5927\u5192\u9669","question":{"questionId":"100096","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u53d1\u5b50\u5f39","question":{"questionId":"100097","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8865\u5168\u6570\u5b57\u533a\u57df","question":{"questionId":"100098","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u627e\u7b26\u5408\u67d0\u8981\u6c42\u7684\u6700\u957f\u65f6\u95f4\u6bb5","question":{"questionId":"100099","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5bfb\u6c42\u81ea\u52a8\u9a7e\u9a76\u6a21\u62df\u77e9\u9635\u4e2d\u6700\u957f\u7684\u8fde\u7eed\u4e3a 1 \u7684\u8def\u6bb5","question":{"questionId":"100100","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53d8\u8d28\u7684\u67ff\u5b50","question":{"questionId":"100101","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8f6f\u4ef6License\u5e8f\u5217\u53f7\u683c\u5f0f\u5316","question":{"questionId":"100102","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8d28\u6570\u6392\u5217","question":{"questionId":"1279","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5065\u8eab\u8ba1\u5212\u8bc4\u4f30","question":{"questionId":"1280","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u5b57\u8c1c","question":{"questionId":"1282","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6784\u5efa\u56de\u6587\u4e32\u68c0\u6d4b","question":{"questionId":"1281","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6e38\u620f\u73a9\u6cd5\u5206\u6790 I","question":{"questionId":"1179","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea7\u54c1\u9500\u552e\u5206\u6790 I","question":{"questionId":"1153","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u524d\u540e\u62fc\u63a5","question":{"questionId":"1132","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e0e\u76ee\u6807\u989c\u8272\u95f4\u7684\u6700\u77ed\u8ddd\u79bb","question":{"questionId":"1134","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u77e9\u9635\u4e2d 1 \u7684\u6700\u5927\u6570\u91cf","question":{"questionId":"1152","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u5468\u4e2d\u7684\u7b2c\u51e0\u5929","question":{"questionId":"1289","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u516c\u4ea4\u7ad9\u95f4\u7684\u8ddd\u79bb","question":{"questionId":"1287","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u4e00\u6b21\u5f97\u5230\u5b50\u6570\u7ec4\u6700\u5927\u548c","question":{"questionId":"1288","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f7f\u6570\u7ec4\u4e25\u683c\u9012\u589e","question":{"questionId":"1290","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6590\u6ce2\u90a3\u5951\u6570\u5217","question":{"questionId":"100103","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5168\u6392\u5217","question":{"questionId":"100104","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u56f4\u6210\u4e00\u5708","question":{"questionId":"100105","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9879\u76ee\u5458\u5de5 I","question":{"questionId":"1161","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6392\u5e8f","question":{"questionId":"100106","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u731c\u6570\u5b57","question":{"questionId":"100107","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u67e5\u627e\u96c6\u7fa4\u5185\u7684\u300c\u5173\u952e\u8fde\u63a5\u300d","question":{"questionId":"1300","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"K \u6b21\u4e32\u8054\u540e\u6700\u5927\u5b50\u6570\u7ec4\u4e4b\u548c","question":{"questionId":"1299","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53cd\u8f6c\u6bcf\u5bf9\u62ec\u53f7\u95f4\u7684\u5b50\u4e32","question":{"questionId":"1298","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u201c\u6c14\u7403\u201d \u7684\u6700\u5927\u6570\u91cf","question":{"questionId":"1297","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6e38\u620f\u73a9\u6cd5\u5206\u6790 II","question":{"questionId":"1180","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9500\u552e\u5206\u6790 II","question":{"questionId":"1173","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9879\u76ee\u5458\u5de5II","question":{"questionId":"1162","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9500\u552e\u5206\u6790III","question":{"questionId":"1174","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e11\u6570 III","question":{"questionId":"1307","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u7edd\u5bf9\u5dee","question":{"questionId":"1306","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u591a\u53ef\u4ee5\u4e70\u5230\u7684\u82f9\u679c\u6570\u91cf","question":{"questionId":"1141","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8fdb\u51fb\u7684\u9a91\u58eb","question":{"questionId":"1142","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u627e\u51fa\u6240\u6709\u884c\u4e2d\u6700\u5c0f\u516c\u5171\u5143\u7d20","question":{"questionId":"1143","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9879\u76ee\u7ba1\u7406","question":{"questionId":"1309","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u5143\u7d20","question":{"questionId":"1308","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6e38\u620f\u73a9\u6cd5\u5206\u6790 III","question":{"questionId":"1181","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bcf\u6708\u4ea4\u6613 I","question":{"questionId":"1317","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u80a1\u7968\u5e02\u573a","question":{"questionId":"100109","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4f20\u8f93\u6570\u636e\u6700\u591a\u7684\u7ad9\u70b9","question":{"questionId":"100064","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u5b57\u7b26\u4e32\u5b50\u96c6","question":{"questionId":"100066","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6587\u672c\u5355\u8bcd\u538b\u7f29\u7b97\u6cd5","question":{"questionId":"100110","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u670d\u52a1\u5668\u901a\u4fe1","question":{"questionId":"100111","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"IP\u5730\u5740\u5230CIDR\u8f6c\u6362","question":{"questionId":"100112","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":" TOP5\u7f51\u5740\u8bbf\u95ee\u5e73\u5747\u6b21\u6570","question":{"questionId":"100113","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u65e5\u5fd7\u7cfb\u7edf","question":{"questionId":"100114","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6e38\u620f\u73a9\u6cd5\u5206\u6790 IV","question":{"questionId":"1182","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217","question":{"questionId":"1250","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea4\u66ff\u6253\u5370\u5b57\u7b26\u4e32","question":{"questionId":"1316","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709\u76f8\u90bb\u91cd\u590d\u9879 II","question":{"questionId":"1320","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5c3d\u53ef\u80fd\u4f7f\u5b57\u7b26\u4e32\u76f8\u7b49","question":{"questionId":"1321","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u72ec\u4e00\u65e0\u4e8c\u7684\u51fa\u73b0\u6b21\u6570","question":{"questionId":"1319","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7a7f\u8fc7\u8ff7\u5bab\u7684\u6700\u5c11\u79fb\u52a8\u6b21\u6570","question":{"questionId":"1322","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4ea7\u54c1\u9500\u552e\u5206\u6790 III","question":{"questionId":"1155","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5c0f\u4ea4\u6362\u6b21\u6570\u4f7f\u5f97\u6570\u7ec4\u6709\u5e8f","question":{"questionId":"100065","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6b65\u8fdb\u6570","question":{"questionId":"1151","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9a8c\u8bc1\u56de\u6587\u5b57\u7b26\u4e32 III","question":{"questionId":"1178","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u957f\u5b9a\u5dee\u5b50\u5e8f\u5217","question":{"questionId":"1330","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7edf\u8ba1\u5143\u97f3\u5b57\u6bcd\u5e8f\u5217\u7684\u6570\u76ee","question":{"questionId":"1332","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9ec4\u91d1\u77ff\u5de5","question":{"questionId":"1331","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u73a9\u7b79\u7801","question":{"questionId":"1329","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u8df3\u8868","question":{"questionId":"1337","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u9526\u6807\u8d5b\u4f18\u80dc\u8005","question":{"questionId":"1318","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bcf\u6708\u4ea4\u6613II","question":{"questionId":"1328","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6e38\u620f\u73a9\u6cd5\u5206\u6790 V","question":{"questionId":"1193","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u91cd\u65b0\u683c\u5f0f\u5316\u90e8\u95e8\u8868","question":{"questionId":"1301","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5f3a\u5236\u5173\u95ed\u8fdb\u7a0b","question":{"questionId":"100116","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u4e00\u4e2a\u5185\u5b58\u7cfb\u7edf","question":{"questionId":"100117","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4e00\u7ec4\u5bc4\u5b58\u5668\u5468\u671f\u53d8\u5316","question":{"questionId":"100119","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u670d\u52a1\u5668\u91cd\u65b0\u6392\u5217","question":{"questionId":"100120","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u5272\u5e73\u8861\u5b57\u7b26\u4e32","question":{"questionId":"1341","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u53ef\u4ee5\u653b\u51fb\u56fd\u738b\u7684\u7687\u540e","question":{"questionId":"1342","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u63b7\u9ab0\u5b50\u6a21\u62df","question":{"questionId":"1343","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6700\u5927\u76f8\u7b49\u9891\u7387","question":{"questionId":"1344","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5408\u5e76\u4efb\u52a1\u4f18\u5148\u7ea7\u5217\u8868","question":{"questionId":"100121","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u4fe1\u5143\u503c\u5207\u7247","question":{"questionId":"100122","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5076\u6570\u4f4d\u7684\u6570\u5b57","question":{"questionId":"100123","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u66ff\u6362\u5b50\u4e32\u5f97\u5230\u5e73\u8861\u5b57\u7b26\u4e32","question":{"questionId":"1351","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5220\u9664\u5b50\u6587\u4ef6\u5939","question":{"questionId":"1350","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7f00\u70b9\u6210\u7ebf","question":{"questionId":"1349","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u6bcf\u65e5\u65b0\u7528\u6237\u7edf\u8ba1","question":{"questionId":"1204","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u8bbe\u8ba1\u6709\u9650\u963b\u585e\u961f\u5217","question":{"questionId":"1209","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u89c4\u5212\u517c\u804c\u5de5\u4f5c","question":{"questionId":"1352","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5206\u4eab\u5de7\u514b\u529b","question":{"questionId":"1192","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u5b89\u6392\u4f1a\u8bae\u65e5\u7a0b","question":{"questionId":"1165","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u629b\u63b7\u786c\u5e01","question":{"questionId":"1166","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u7b49\u5dee\u6570\u5217\u4e2d\u7f3a\u5931\u7684\u6570\u5b57","question":{"questionId":"1164","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"},{"title":"\u534e\u4e3a\u667a\u6167\u4ea4\u901a","question":{"questionId":"100124","__typename":"QuestionNode"},"__typename":"AppliedTranslationNode"}]}}
\ No newline at end of file
diff --git a/algorithms/algorithm-common/pom.xml b/algorithms/algorithm-common/pom.xml
new file mode 100644
index 00000000..3afe2696
--- /dev/null
+++ b/algorithms/algorithm-common/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ algorithms
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ algorithm-common
+
+
+
\ No newline at end of file
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtils.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtils.java
new file mode 100644
index 00000000..893e41f3
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtils.java
@@ -0,0 +1,97 @@
+package cn.lastwhisper.leetcode.common.array;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author lastwhisper
+ * @date 2020/2/4
+ */
+public class ArrayUtils {
+
+ /**
+ * {"ab","cd"}=>
+ * 创建二维字符数组
+ */
+ public static char[][] createCharArrays(String[] arr) {
+ int m = arr.length, n = arr[0].length();
+ char[][] chars = new char[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ chars[i][j] = arr[i].charAt(j);
+ }
+ }
+ return chars;
+ }
+
+ /**
+ * {{"a","b","c","d"}}=>
+ * 创建二维字符数组
+ */
+ public static char[][] createCharArrays(String[][] arr) {
+ int m = arr.length, n = arr[0].length;
+ char[][] chars = new char[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ chars[i][j] = arr[i][j].charAt(0);
+ }
+ }
+ return chars;
+ }
+
+ /**
+ * 创建二维数组
+ */
+ public static int[][] createIntArrays(String[] arr) {
+ int m = arr.length, n = arr[0].length();
+ int[][] ints = new int[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ ints[i][j] = arr[i].charAt(j) - '0';
+ }
+ }
+ return ints;
+ }
+
+
+ /**
+ * 创建list
+ */
+ public static List> createList(int[][] arrays) {
+ List> lists = new ArrayList<>(arrays.length);
+ for (int[] array : arrays) {
+ List list = new ArrayList<>(array.length);
+ for (int num : array) {
+ list.add(num);
+ }
+ lists.add(list);
+ }
+ return lists;
+ }
+
+
+ /**
+ * 生成无序数组
+ * @param length 生成数组的长度
+ * @param region 生成数字的范围
+ */
+ public static int[] generateArrByRandom(int length, int region) {
+ int[] arr = new int[length];
+ for (int i = 0; i < length; i++) {
+ arr[i] = (int) (Math.random() * region); // region=8000000 生成一个[0,8000000) 的一个数
+ }
+ return arr;
+ }
+
+ /**
+ * 生成n~0倒序数组
+ */
+ public static int[] generateArrByOrder(int n) {
+ int[] arr = new int[n];
+ for (int i = n - 1; i > 0; i--) {
+ arr[i] = i + 1;
+ }
+ return arr;
+ }
+}
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtils.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtils.java
new file mode 100644
index 00000000..01c2d3ce
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtils.java
@@ -0,0 +1,289 @@
+package cn.lastwhisper.leetcode.common.linkedlist;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 操作链表工具类
+ * @author lastwhisper
+ * @date 1/7/2020
+ */
+public class LinkedListUtils {
+
+ /**
+ * 创建单链表
+ */
+ public static ListNode createListNode(int... arr) {
+ if (arr == null) {
+ return null;
+ }
+ ListNode head = new ListNode(arr[0]);
+ ListNode current = head;
+
+ for (int i = 1; i < arr.length; i++) {
+ current.next = new ListNode(arr[i]);
+ current = current.next;
+ }
+ return head;
+ }
+
+ /**
+ * 创建环形链表
+ * 应用题目:https://leetcode-cn.com/problems/linked-list-cycle/
+ * @param pos 成环位置
+ * @param arr 链表元素
+ */
+ public static ListNode createLoopListNode(int pos, int... arr) {
+ if (arr == null) {
+ return null;
+ }
+ ListNode head = new ListNode(arr[0]);
+ ListNode current = head;
+ // 锚点,记录成环的位置
+ ListNode anchor = null;
+ if (pos == 0) {
+ anchor = head;
+ }
+ for (int i = 1; i < arr.length; i++) {
+ current.next = new ListNode(arr[i]);
+ // 记录成环位置
+ if (pos == i) {
+ if (pos == arr.length - 1) {
+ anchor = current;
+ } else {
+ anchor = current.next;
+ }
+ }
+ current = current.next;
+ }
+ current.next = anchor;
+ return head;
+ }
+
+ /**
+ * 创建两个相交链表
+ * 应用题目:https://leetcode-cn.com/problems/intersection-of-two-linked-lists/
+ * @param intersectVal 相交点的值
+ * @param listA 链表A元素数组
+ * @param listB 链表B元素数组
+ * @param skipA 链表A相交前节点数
+ * @param skipB 链表B相交前节点数
+ */
+ public static List createIntersectListNode(
+ int intersectVal, int[] listA, int[] listB, int skipA, int skipB) {
+ List listNodes = new ArrayList<>(2);
+
+ ListNode listNodeA = new ListNode(listA[0]);
+ ListNode currentA = listNodeA;
+ ListNode listNodeB = new ListNode(listB[0]);
+ ListNode currentB = listNodeB;
+
+ for (int i = 1; i < skipA; i++) {
+ currentA.next = new ListNode(listA[i]);
+ currentA = currentA.next;
+ }
+
+ for (int i = 1; i < skipB; i++) {
+ currentB.next = new ListNode(listB[i]);
+ currentB = currentB.next;
+ }
+
+ ListNode intersectListNode = new ListNode(listA[skipA]);
+ ListNode currentIntersect = intersectListNode;
+
+ for (int i = skipA + 1; i < listA.length; i++) {
+ currentIntersect.next = new ListNode(listA[i]);
+ currentIntersect = currentIntersect.next;
+ }
+
+ currentA.next = intersectListNode;
+ currentB.next = intersectListNode;
+
+ listNodes.add(listNodeA);
+ listNodes.add(listNodeB);
+
+ return listNodes;
+ }
+
+ private static ListNode createListNode(String arr) {
+ if (arr == null) {
+ return null;
+ }
+ ListNode head = new ListNode(arr.charAt(0) - '0');
+ ListNode current = head;
+
+ for (int i = 1; i < arr.length(); i++) {
+ current.next = new ListNode(arr.charAt(i) - '0');
+ current = current.next;
+ }
+ return head;
+ }
+
+ /**
+ * 反序创建链表
+ */
+ private static ListNode createReverseListNode(String arr) {
+ if (arr == null) {
+ return null;
+ }
+
+ ListNode head = new ListNode(arr.charAt(arr.length() - 1) - '0');
+ ListNode current = head;
+
+ for (int i = arr.length() - 2; i >= 0; i--) {
+ current.next = new ListNode(arr.charAt(i) - '0');
+ current = current.next;
+ }
+ return head;
+ }
+
+ /**
+ * 两个字符串整数相加
+ */
+ public String add(String a, String b) {
+ StringBuilder sb = new StringBuilder();
+ // 进位
+ int carry = 0;
+ int aIndex = a.length() - 1, bIndex = b.length() - 1;
+
+ while (aIndex >= 0 || bIndex >= 0) {
+ int x, y, sum;
+ x = aIndex >= 0 ? a.charAt(aIndex) - '0' : 0;
+ y = bIndex >= 0 ? b.charAt(bIndex) - '0' : 0;
+
+ sum = carry + x + y;
+ carry = sum / 10;
+ sb.append(sum % 10);
+
+ aIndex--;
+ bIndex--;
+ }
+
+ if (carry > 0) {
+ sb.append(carry);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 打印单链表
+ */
+ public static void printListNode(String msg, ListNode head) {
+ System.out.println(msg + appendVal(head));
+ }
+
+ /**
+ * 打印单链表
+ */
+ public static void printListNode(ListNode head) {
+ System.out.println(appendVal(head));
+ }
+
+ private static String appendVal(ListNode head) {
+ StringBuilder sb = new StringBuilder();
+ ListNode current = head;
+ while (current != null) {
+ sb.append(current.val);
+ sb.append("->");
+ current = current.next;
+ }
+ sb.append("NULL");
+ return sb.toString();
+ }
+
+ /**
+ * 反转链表
+ */
+ public static ListNode reverseListNode(ListNode head) {
+ ListNode prev = null;
+ ListNode current = head;
+ ListNode next = null;
+
+ while (current != null) {
+ next = current.next;
+
+ current.next = prev;
+ prev = current;
+ current = next;
+ }
+ return prev;
+ }
+
+ /**
+ * 交替合并两个链表,返回新的链表
+ */
+ public static ListNode alterNoteMerge(ListNode l1, ListNode l2) {
+
+ return null;
+ }
+
+ /**
+ * 交替合并两个链表,到第一个链表
+ * https://leetcode-cn.com/problems/reorder-list
+ */
+ public static void alterNoteMergeOne(ListNode firstHead, ListNode secondHead) {
+ ListNode firstNext;
+ ListNode secondNext;
+
+ while (secondHead != null) {
+ // 1.记录两个链表的next节点
+ firstNext = firstHead.next;
+ secondNext = secondHead.next;
+ // 2.将链表1的当前节点指向链表2的当前节点,链表2的当前节点指向链表1的下一个节点
+ // 左链表:1->2->3 右链表:5->4
+ // 合并后的链表1:1->5->2
+ firstHead.next = secondHead;
+ secondHead.next = firstNext;
+ // 3.将之前保存的next更新为当前节点,继续循环
+ firstHead = firstNext;
+ secondHead = secondNext;
+ // 防止奇数节点链表成环 https://leetcode-cn.com/problems/reorder-list/
+ if (secondHead == null) {
+ firstHead.next = null;
+ }
+ }
+ }
+
+ /**
+ * 找到链表中间的前一个节点
+ */
+ public static ListNode middleBeforeNode(ListNode head) {
+ ListNode fast = head;
+ ListNode slow = head;
+ while (fast.next != null && fast.next.next != null) {
+ fast = fast.next.next;
+ slow = slow.next;
+ }
+ return slow;
+ }
+
+ /**
+ * 找到链表中间的一个节点
+ * https://leetcode-cn.com/problems/middle-of-the-linked-list/
+ */
+ public static ListNode middleNode(ListNode head) {
+ ListNode fast = head;
+ ListNode slow = head;
+ while (fast != null && fast.next != null) {
+ fast = fast.next.next;
+ slow = slow.next;
+ }
+ return slow;
+ }
+
+ public static void main(String[] args) {
+ //printListNode(createListNode(1, 2, 3, 4, 5, 6, 7));
+ //ListNode headLoop = createLoopListNode(0, 4, 5, 6);
+ //ListNode centerLoop = createLoopListNode(1, 4, 5, 6);
+
+ int intersectVal = 8, skipA = 2, skipB = 3;
+ int[] listA = {4, 1, 8, 4, 5};
+ int[] listB = {5, 0, 1, 8, 4, 5};
+ List intersectListNode = createIntersectListNode(intersectVal, listA, listB, skipA, skipB);
+ for (ListNode listNode : intersectListNode) {
+ printListNode(listNode);
+ }
+
+ }
+}
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java
new file mode 100644
index 00000000..4d78a4b2
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java
@@ -0,0 +1,11 @@
+package cn.lastwhisper.leetcode.common.linkedlist;
+
+public class ListNode {
+ public int val;
+ public ListNode next;
+
+ public ListNode(int x) {
+ val = x;
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtils.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtils.java
new file mode 100644
index 00000000..9bc15820
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtils.java
@@ -0,0 +1,93 @@
+package cn.lastwhisper.leetcode.common.print;
+
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * 打印工具类
+ * @author lastwhisper
+ * @date 2020/2/1
+ */
+public class PrintUtils {
+
+ /**
+ * 层次打印二维数组
+ */
+ public static void printLists(List> lists) {
+ System.out.println("[");
+ int counter1 = 1;
+ for (List list : lists) {
+ System.out.print("\t[\"");
+ int counter2 = 1;
+ for (Integer i : list) {
+ if (counter2 != list.size()) {
+ System.out.print(i + "\",\"");
+ } else {
+ System.out.print(i);
+ }
+ counter2++;
+ }
+ if (counter1 != lists.size()) {
+ System.out.print("\"],\n");
+ } else {
+ System.out.print("\"]\n");
+ }
+ counter1++;
+ }
+ System.out.println("]");
+ }
+
+ public static void printStringLists(List> lists) {
+ System.out.println("[");
+ int counter1 = 1;
+ for (List list : lists) {
+ System.out.print("\t[\"");
+ int counter2 = 1;
+ for (String i : list) {
+ if (counter2 != list.size()) {
+ System.out.print(i + "\",\"");
+ } else {
+ System.out.print(i );
+ }
+ counter2++;
+ }
+ if (counter1 != lists.size()) {
+ System.out.print("\"],\n");
+ } else {
+ System.out.print("\"]\n");
+ }
+ counter1++;
+ }
+ System.out.println("]");
+ }
+
+ /**
+ * 打印数组
+ */
+ public static void printList(Collection> collection) {
+ System.out.println(collection2String(collection));
+ }
+
+ /**
+ * 将Collection扁平化迭代成String
+ */
+ public static String collection2String(Collection> collection) {
+ StringBuilder sb = new StringBuilder();
+ try {
+ sb.append("[\"");
+ int counter = 1;
+ for (Object object : collection) {
+ sb.append(object);
+ if (counter != collection.size()) {
+ sb.append("\",\"");
+ }
+ counter++;
+ }
+ sb.append("\"]");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return sb.toString();
+ }
+}
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeNode.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeNode.java
new file mode 100644
index 00000000..273e04b9
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeNode.java
@@ -0,0 +1,11 @@
+package cn.lastwhisper.leetcode.common.tree;
+
+public class TreeNode {
+ public int val;
+ public TreeNode left;
+ public TreeNode right;
+
+ public TreeNode(int x) {
+ val = x;
+ }
+}
\ No newline at end of file
diff --git a/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeUtils.java b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeUtils.java
new file mode 100644
index 00000000..89ec67f7
--- /dev/null
+++ b/algorithms/algorithm-common/src/main/java/cn/lastwhisper/leetcode/common/tree/TreeUtils.java
@@ -0,0 +1,259 @@
+package cn.lastwhisper.leetcode.common.tree;
+
+import javafx.util.Pair;
+
+import java.util.*;
+
+import static cn.lastwhisper.leetcode.common.print.PrintUtils.printLists;
+
+
+/**
+ * 树相关工具类
+ * @author lastwhisper
+ * @date 1/16/2020
+ */
+public class TreeUtils {
+
+ /**
+ * 根据数组创建二叉树
+ * 一、[5,4,8,11,null,13,4,7,2,null,null,null,1]
+ * 5
+ * / \
+ * 4 8
+ * / / \
+ * 11 13 4
+ * / \ \
+ * 7 2 1
+ * 二、[1,null,2,3]
+ * 1
+ * \
+ * 2
+ * /
+ * 3
+ * https://blog.csdn.net/lenfranky/article/details/84444816
+ * @param array 数组
+ */
+ public static TreeNode createTree(Integer... array) {
+ if (array.length == 0) return new TreeNode(0);
+ Deque nodeQueue = new LinkedList<>();
+ // 创建一个根节点
+ TreeNode root = new TreeNode(array[0]);
+ nodeQueue.offer(root);
+ TreeNode current;
+ // 记录当前行节点的数量(注意不一定是2的幂,而是上一行中非空节点的数量乘2)
+ int lineNodeNum = 2;
+ // 记录当前行中数字在数组中的开始位置
+ int startIndex = 1;
+ // 记录数组中剩余的元素的数量
+ int restLength = array.length - 1;
+
+ while (restLength > 0) {
+ // 只有最后一行可以不满,其余行必须是满的
+// // 若输入的数组的数量是错误的,直接跳出程序
+// if (restLength < lineNodeNum) {
+// System.out.println("Wrong Input!");
+// return new TreeNode(0);
+// }
+ for (int i = startIndex; i < startIndex + lineNodeNum; i = i + 2) {
+ // 说明已经将nums中的数字用完,此时应停止遍历,并可以直接返回root
+ if (i == array.length) return root;
+ current = nodeQueue.poll();
+ if (array[i] != null) {
+ current.left = new TreeNode(array[i]);
+ nodeQueue.offer(current.left);
+ }
+ // 同上,说明已经将nums中的数字用完,此时应停止遍历,并可以直接返回root
+ if (i + 1 == array.length) return root;
+ if (array[i + 1] != null) {
+ current.right = new TreeNode(array[i + 1]);
+ nodeQueue.offer(current.right);
+ }
+ }
+ startIndex += lineNodeNum;
+ restLength -= lineNodeNum;
+ lineNodeNum = nodeQueue.size() * 2;
+ }
+
+ return root;
+ }
+
+ /**
+ * 二叉树层次遍历
+ */
+ public static List> levelOrder(TreeNode root) {
+ List> result = new ArrayList<>();
+ if (root == null)
+ return result;
+
+ Queue queue = new LinkedList<>();
+ queue.add(root);
+ while (!queue.isEmpty()) {
+ // 遍历每层的数据
+ int size = queue.size();
+ List list = new ArrayList<>();
+ while (size > 0) {
+ root = queue.poll();
+ list.add(root.val);
+ if (root.left != null) {
+ queue.add(root.left);
+ }
+ if (root.right != null) {
+ queue.add(root.right);
+ }
+ size--;
+ }
+ result.add(list);
+ }
+ return result;
+ }
+
+ /**
+ * 相同的树
+ *
+ *
+ * 输入: 1 1
+ * / \ / \
+ * 2 3 2 3
+ *
+ * [1,2,3], [1,2,3]
+ *
+ * 输出: true
+ */
+ public static boolean isSameTree(TreeNode p, TreeNode q) {
+ LinkedList queue = new LinkedList<>();
+ queue.add(p);
+ queue.add(q);
+ while (!queue.isEmpty()) {
+ p = queue.poll();
+ q = queue.poll();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ queue.add(p.left);
+ queue.add(q.left);
+ queue.add(p.right);
+ queue.add(q.right);
+ }
+ return true;
+ }
+
+ /**
+ * 完全二叉树的左子树或右子树的高度
+ *
+ * @param root 根节点的左子树或右子树
+ * @return int 高度
+ */
+ private int countLevel(TreeNode root) {
+ int level = 0;
+ while (root != null) {
+ level++;
+ root = root.left;
+ }
+ return level;
+ }
+
+ /**
+ * 所有节点之和
+ *
+ * @param root
+ * @return int
+ */
+ public int sumOfLeaves(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ return sumOfLeaves(root.left) + sumOfLeaves(root.right) + root.val;
+ }
+
+ /**
+ * 二叉树根节点至叶子节点的最高高度
+ *
+ * @param root 根节点
+ * @return int 高度
+ */
+ public int maxDepth(TreeNode root) {
+ LinkedList> stack = new LinkedList<>();
+ if (root != null) {
+ stack.push(new Pair<>(root, 0));
+ }
+ int maxDepth = 0;
+ // stack模拟递归系统栈
+ while (!stack.isEmpty()) {
+ Pair pair = stack.poll();
+ root = pair.getKey();
+ Integer height = pair.getValue();
+ // dfs过程中更新最大深度
+ maxDepth = Math.max(maxDepth, height);
+ if (root != null) {
+ stack.push(new Pair<>(root.right, height + 1));
+ stack.push(new Pair<>(root.left, height + 1));
+ }
+ }
+ return maxDepth;
+ }
+
+ /**
+ * 二叉树根节点至叶子节点的最小高度
+ *
+ * @param root 根节点
+ * @return int 高度
+ */
+ public int minDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ LinkedList> queue = new LinkedList<>();
+ queue.add(new Pair<>(root, 1));
+
+ // 当前深度
+ int currentDepth = 0;
+ Pair pair = null;
+ while (!queue.isEmpty()) {
+ pair = queue.poll();
+ root = pair.getKey();
+ currentDepth = pair.getValue();
+ // 找到层中第一个叶子节点
+ if (root.left == null && root.right == null) {
+ break;
+ }
+ if (root.left != null) {
+ queue.add(new Pair<>(root.left, currentDepth + 1));
+ }
+ if (root.right != null) {
+ queue.add(new Pair<>(root.right, currentDepth + 1));
+ }
+
+ }
+ return currentDepth;
+ }
+
+ /**
+ * 反转二叉树
+ *
+ * @param root 根节点
+ */
+ public TreeNode invertTree(TreeNode root) {
+ if (root == null)
+ return null;
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = root.left;
+ root.left = invertTree(root.right);
+ root.right = invertTree(tempNode);
+ return root;
+ }
+
+ /**
+ * 输出二叉树层次遍历的结果
+ */
+ public static void printLevelOrder(TreeNode root) {
+ printLists(levelOrder(root));
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(1, null, 2, 3));
+ //printLevelOrder(createTree(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1));
+ //printLevelOrder(createTree(1,2,3,null,4,5,null));
+ }
+}
diff --git a/algorithms/algorithm/pom.xml b/algorithms/algorithm/pom.xml
index 216ffb65..88f18783 100644
--- a/algorithms/algorithm/pom.xml
+++ b/algorithms/algorithm/pom.xml
@@ -4,12 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
algorithms
- lastwhisper
+ cn.lastwhisper
1.0-SNAPSHOT
4.0.0
- cn.lastwhisper
algorithm
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/bf/BF.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/bf/BF.java
deleted file mode 100644
index 313a5f45..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/bf/BF.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package cn.lastwhisper.bf;
-
-/**
- * BF算法
- * @author cn.lastwhisper
- */
-public class BF {
- public static void main(String[] args) {
- String str1 = "硅硅谷 尚硅谷你尚硅 尚硅谷你尚硅谷你尚硅你好";
- String str2 = "尚硅谷你尚硅你";
- int search = search(str1, str2, 0);
- //int search = search1(str1, str2, 0);
- System.out.println(search);
- }
-
-
- public static int search(String txt, String pat, int pos) {
- int m = pat.length();
- int n = txt.length();
- for (int i = 0; i < n - m; i++) {
- int j;
- for (j = 0; j < m; j++) {
- if (txt.charAt(i + j) != pat.charAt(j)) {
- break;
- }
- }
- if (j == m) {
- return i;
- }
- }
- return n;
- }
-
- /**
- * @param txt 主串
- * @param pat 子串
- * @param pos 匹配起始位置
- * @return int
- */
- public static int search1(String txt, String pat, int pos) {
- char[] txtChar = txt.toCharArray();
- char[] patChar = pat.toCharArray();
- // 主串指针
- int i = pos;
- // 子串指针
- int j = 0;
-
- while (i < txtChar.length && j < patChar.length) {
- if (txtChar[i] == patChar[j]) {
- i++;
- j++;
- } else {
- //没有匹配成功
- i = i - j + 1;
- j = 0;
- }
- }
- if (j == patChar.length) {
- return i - j;
- }
- return -1;
- }
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/bloomfilter/BloomFilter.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/bloomfilter/BloomFilter.java
new file mode 100644
index 00000000..a6eca615
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/bloomfilter/BloomFilter.java
@@ -0,0 +1,74 @@
+package cn.lastwhisper.bloomfilter;
+
+import java.io.Serializable;
+import java.util.BitSet;
+import java.util.Random;
+
+/**
+ * 原文:https://www.iteye.com/blog/imtinx-1290636
+ * Long类型元素的布隆过滤器
+ */
+class BloomFilter implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final int ELEM_NUM = 1000; // 欲容纳的元素个数
+ private static final double PERCENTAGE = 0.001; // 希望的误差率
+ private int hashNum; // hash函数的数量
+ private int size; // 位向量的长度
+ private BitSet bitVector; // 位向量
+
+ public BloomFilter() {
+ size = (int) Math.abs(ELEM_NUM * Math.log(PERCENTAGE)
+ / (Math.log(2) * Math.log(2))) + 1;
+ hashNum = (int) (Math.log(2) * ((double) size / ELEM_NUM));
+ bitVector = new BitSet(size);
+ }
+
+ /**
+ * 查找元素是否在集合中
+ */
+ public boolean search(Long elem) {
+ boolean flag = true;
+ int temp;
+ Random random = new Random(elem);
+ for (int i = 0; i < hashNum; i++) {
+ temp = random.nextInt(size);
+ if (!bitVector.get(temp)) {// 元素不在集合中
+ bitVector.set(temp);
+ flag = false;
+ }
+ }
+ return flag;
+ }
+
+ /**
+ * 获取位向量的长度
+ */
+ public int size() {
+ return bitVector.size();
+ }
+
+
+ public int getHashNum() {
+ return hashNum;
+ }
+
+ public void setHashNum(int hashNum) {
+ this.hashNum = hashNum;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
+
+ public BitSet getBitVector() {
+ return bitVector;
+ }
+
+ public void setBitVector(BitSet bitVector) {
+ this.bitVector = bitVector;
+ }
+}
\ No newline at end of file
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/consistenthash/ConsistentHash.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/consistenthash/ConsistentHash.java
new file mode 100644
index 00000000..f718c144
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/consistenthash/ConsistentHash.java
@@ -0,0 +1,71 @@
+package cn.lastwhisper.consistenthash;
+
+import java.util.Collection;
+import java.util.Objects;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * https://www.iteye.com/blog/imtinx-1290696
+ *
+ */
+class ConsistentHash {
+ /**
+ * 计算使用的hash函数,推荐使用MD5
+ */
+ private final Objects hashFunction;
+ /**
+ * 虚拟节点的倍数
+ */
+ private final int numberOfReplicas;
+ /**
+ * cache节点环
+ */
+ private final SortedMap circle = new TreeMap();
+ public ConsistentHash(Objects hashFunction, int numberOfReplicas,
+ Collection nodes) {
+ this.hashFunction = hashFunction;
+ this.numberOfReplicas = numberOfReplicas;
+ for (T node : nodes) {
+ add(node);
+ }
+ }
+ /**
+ * @description 添加ceche服务器节点
+ * @param node 服务器节点,可以用服务器的IP表示
+ * @add date 2011-10-30
+ */
+ public void add(T node) {
+ for (int i = 0; i < numberOfReplicas; i++) {
+ circle.put(hashFunction.hash(node.toString() + i), node);
+ }
+ }
+ /**
+ * @description 删除服务器节点
+ * @param node 服务器节点,可以用服务器的IP表示
+ * @add date 2011-10-30
+ */
+ public void remove(T node) {
+ for (int i = 0; i < numberOfReplicas; i++) {
+ circle.remove(hashFunction.hash(node.toString() + i));
+ }
+ }
+ /**
+ * @description 获取对象对应的cache服务器
+ * @param key 需要存储的对象
+ * @return 目标cache服务器
+ * @add date 2011-10-30
+ */
+ public T get(Object key) {
+ if (circle.isEmpty()) {
+ return null;
+ }
+ int hash = hashFunction.hash(key);
+ if (!circle.containsKey(hash)) {
+ //顺时针查找最近的节点
+ SortedMap tailMap = circle.tailMap(hash);
+ hash = tailMap.isEmpty() ? circle.firstKey() : tailMap.firstKey();
+ }
+ return circle.get(hash);
+ }
+}
\ No newline at end of file
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/dynamic/KnapsackProblem.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/dynamic/KnapsackProblem.java
deleted file mode 100644
index 788aa085..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/dynamic/KnapsackProblem.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package cn.lastwhisper.dynamic;
-
-/**
- * 背包问题
- * @author cn.lastwhisper
- */
-public class KnapsackProblem {
- public static void main(String[] args) {
- //物品的重量
- int[] weight = {1, 4, 3};
- //物品的价值
- int[] value = {1500, 3000, 2000};
- //背包的容量
- int capacity = 4;
- // 物品的个数
- int n = value.length;
-
- // v[i][j]表示在前i个物品中能够装入容量为j的背包中的最大价值
- // v[i][j]的有效值是从下标1开始
- int[][] v = new int[n + 1][capacity + 1];
- //为了记录放入商品的情况,我们定一个二维数组
- int[][] path = new int[n + 1][capacity + 1];
- // 初始化数组
- // 第一列全为0
- for (int i = 0; i < v.length; i++) {
- v[i][0] = 0;
- }
- // 第一行全为0
- for (int i = 0; i < v[0].length; i++) {
- v[0][i] = 0;
- }
-
- // i表示当前物品 吉他、音响、电脑
- for (int i = 1; i < v.length; i++) {
- // j表示当前背包容量 1,2,3,4...
- for (int j = 1; j < v[0].length; j++) {
- // 当前物品容量大于当前背包容量,使用上一个单元格的装入策略
- if (weight[i - 1] > j) {
- v[i][j] = v[i - 1][j];
- } else {
- // 当前物品容量小于当前背包容量时,说明可以放的下物品,
- // 需要比较“上一个物品(i - 1)容量(j)时的最大价值的装入策略”与
- // “当前物品的价值+上一个物品(i - 1)容量(j-weight[i],其中weight[i]是当前物品重量)时的最大价值的装入策略”
- //v[i][j] = Math.max(v[i - 1][j], value[i - 1] + v[i - 1][j - weight[i - 1]]);
-
- // 为了记录商品存入背包的情况,不能直接使用上面的写法,需要改写为if-else
- if (v[i - 1][j] < value[i - 1] + v[i - 1][j - weight[i - 1]]) {
- v[i][j] = value[i - 1] + v[i - 1][j - weight[i - 1]];
- path[i][j] = 1;
- } else {
- v[i][j] = v[i - 1][j];
- }
- }
- }
- }
-
- System.out.println("最大价值:"+v[n][capacity]);
- // 行
- int i = path.length - 1;
- // 列
- int j = path[0].length - 1;
- while (i > 0 && j > 0) {
- if (path[i][j] == 1) {
- System.out.printf("第%d个商品放入到背包\n", i);
- j -= weight[i - 1];
- }
- i--;
- }
-
-
- }
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd1.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd1.java
new file mode 100644
index 00000000..07d2014b
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd1.java
@@ -0,0 +1,43 @@
+package cn.lastwhisper.gcdlcm;
+
+import org.junit.Assert;
+
+/**
+ * 最小公倍数
+ * @author lastwhisper
+ * @date 2020/3/12
+ */
+class Gcd1 {
+
+ /**
+ * (1)辗转相除法
+ * 有两整数a和b:
+ * ① a%b得余数c
+ * ② 若c=0,则b即为两数的最大公约数
+ * ③ 若c≠0,则a=b,b=c,再回去执行①
+ *
+ * 例如求27和15的最大公约数过程为:
+ * 27÷15 余12
+ * 15÷12 余3
+ * 12÷3 余0 因此,3即为最大公约数
+ */
+ public int gcd(int a, int b) {
+ int m=a,n=b;
+ if (b > a) {
+ int temp = a;a = b;b = temp;
+ }
+
+ int c;
+ while (b != 0) /* 余数不为0,继续相除,直到余数为0 */ {
+ c = a % b;
+ a = b;
+ b = c;
+ }
+ return a;// m*n/a最小公倍数
+ }
+
+ public static void main(String[] args) {
+ Gcd1 main = new Gcd1();
+ Assert.assertEquals(3, main.gcd(27, 15));
+ }
+}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd2.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd2.java
new file mode 100644
index 00000000..66cc920b
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd2.java
@@ -0,0 +1,38 @@
+package cn.lastwhisper.gcdlcm;
+
+import org.junit.Assert;
+
+/**
+ * 相减法
+ * @author lastwhisper
+ * @date 2020/3/12
+ */
+class Gcd2 {
+
+ /**
+ * ⑵ 相减法
+ * 有两整数a和b:
+ * ① 若a>b,则a=a-b
+ * ② 若a12 )
+ * 15-12=3( 12>3 )
+ * 12-3=9( 9>3 )
+ * 9-3=6( 6>3 )
+ * 6-3=3( 3==3 )
+ */
+ public int gcd(int a, int b) {
+ while (a != b) {
+ if (a > b) a = a - b;
+ else b = b - a;
+ }
+ return a;
+ }
+
+ public static void main(String[] args) {
+ Gcd2 main = new Gcd2();
+ Assert.assertEquals(3, main.gcd(27, 15));
+ }
+}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd3.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd3.java
new file mode 100644
index 00000000..bc29cc22
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/gcdlcm/Gcd3.java
@@ -0,0 +1,24 @@
+package cn.lastwhisper.gcdlcm;
+
+import org.junit.Assert;
+
+/**
+ * 穷举法
+ * @author lastwhisper
+ * @date 2020/3/12
+ */
+class Gcd3 {
+
+ // https://www.cnblogs.com/ECJTUACM-873284962/p/6679839.html
+ public int gcd(int a, int b) {
+ int t = 0;
+ for (int i = 1; i <= a; i++)
+ if (a % i == 0 && b % i == 0) t = i;
+ return t;
+ }
+
+ public static void main(String[] args) {
+ Gcd3 main = new Gcd3();
+ Assert.assertEquals(3, main.gcd(27, 15));
+ }
+}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/greedy/GreedyAlgorithm.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/greedy/GreedyAlgorithm.java
deleted file mode 100644
index e5f52905..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/greedy/GreedyAlgorithm.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package cn.lastwhisper.greedy;
-
-import java.util.*;
-
-/**
- * 贪心解决集合覆盖问题
- * @author cn.lastwhisper
- */
-public class GreedyAlgorithm {
-
- public static void main(String[] args) {
- // 广播电台和对应覆盖范围
- Map> broadcasts = new HashMap<>();
- // 覆盖地区
- Set area1 = new HashSet<>();
- area1.add("北京");
- area1.add("上海");
- area1.add("天津");
- Set area2 = new HashSet<>();
- area2.add("广州");
- area2.add("北京");
- area2.add("深圳");
- Set area3 = new HashSet<>();
- area3.add("成都");
- area3.add("上海");
- area3.add("杭州");
- Set area4 = new HashSet<>();
- area4.add("上海");
- area4.add("天津");
- Set area5 = new HashSet<>();
- area5.add("杭州");
- area5.add("大连");
- broadcasts.put("k1", area1);
- broadcasts.put("k2", area2);
- broadcasts.put("k3", area3);
- broadcasts.put("k4", area4);
- broadcasts.put("k5", area5);
-
- // 需要覆盖的范围
- Set allAreas = new HashSet<>();
- allAreas.add("北京");
- allAreas.add("上海");
- allAreas.add("天津");
- allAreas.add("广州");
- allAreas.add("深圳");
- allAreas.add("成都");
- allAreas.add("杭州");
- allAreas.add("大连");
-
- // 存放已选择电台的集合
- List selects = new ArrayList();
- // 存放“遍历到的key对应的覆盖的范围地区的集合”和“需要覆盖的范围地区的集合”的交集
- Set tempSet = new HashSet<>();
- // 存放遍历过程中,能够覆盖最大未覆盖地区对应电台的key
- String maxKey = null;
- while (allAreas.size() != 0) {
- // maxKey置空
- maxKey = null;
- for (String key : broadcasts.keySet()) {
- // 清除集合上一次的缓存
- tempSet.clear();
- // areas key对应的覆盖的范围地区的集合
- Set areas = broadcasts.get(key);
- tempSet.addAll(areas);
- // allAreas 需要覆盖的范围地区的集合
- tempSet.retainAll(allAreas);
- // 贪心算法的核心
- // tempSet.size() > broadcasts.get(maxKey).size())当前这个集合包含的未覆盖地区的数量,比maxKey指向的集合地区还多
- // 将把tempSet.size()对应的key,更新掉maxKey
- if (tempSet.size() > 0 && (maxKey == null ||
- tempSet.size() > broadcasts.get(maxKey).size())) {
- maxKey = key;
- }
-
- }
- // maxKey存在
- if (maxKey != null) {
- // 将maxKey加入已选择电台集合中
- selects.add(maxKey);
- // 并从未覆盖地区删除maxKey对应覆盖的地区
- allAreas.removeAll(broadcasts.get(maxKey));
- // 从广播中移除
- broadcasts.remove(maxKey);
- }
-
- }
-
- System.out.println(selects);
-
- }
-
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/hanoitower/Hanoitower.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/hanoitower/Hanoitower.java
deleted file mode 100644
index f6844589..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/hanoitower/Hanoitower.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.lastwhisper.hanoitower;
-
-/**
- * 汉诺塔问题(递归)
- * @author cn.lastwhisper
- */
-public class Hanoitower {
- public static void main(String[] args) {
- move(3, 'A', 'B', 'C');
- }
-
- /**
- *
- *
- * @param n 盘子的数量
- * @param a 起始位置
- * @param b 中间缓存位置
- * @param c 终点位置
- * @return void
- */
- public static void move(int n, char a, char b, char c) {
- if (n == 1) {
- System.out.printf("第1个盘从 %s->%s\n", a, c);
- } else {
- // 以a为起始位置,c为中间缓存位置,b为终点位置
- move(n - 1, a, c, b);
- System.out.printf("第%d个盘从 %s->%s\n", n, a, c);
- // 以b为起始位置,a为中间缓存位置,c为终点位置
- move(n - 1, b, a, c);
- }
- }
-
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/kmp/KMP.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/kmp/KMP.java
deleted file mode 100644
index 5952d845..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/kmp/KMP.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package cn.lastwhisper.kmp;
-
-/**
- * kmp算法
- * @author cn.lastwhisper
- */
-public class KMP {
- public static void main(String[] args) {
- String str1 = "BBC ABCDAB ABCDABCDABDE";
- String str2 = "ABCDABD";
- //int[] next = kmpNext1("AAA"); // 不考虑调整j的大小
- //int[] next = kmpNext("ABCDABD"); // 不考虑调整j的大小
- //System.out.println(Arrays.toString(next));
- int[] next = kmpNext("ABCDABD");
- //int index = kmpSearch1(str1, "BBC", next); // 不考虑调整j的大小
- int index = kmpSearch(str1, str2, next); // 不考虑调整j的大小
- System.out.println(index);
- }
-
- public static int kmpSearch(String txt, String pat, int[] next) {
- // i指向str1,j指向str2
- for (int i = 0, j = 0; i < txt.length(); i++) {
- // 处理txt.charAt(i) != pat.charAt(j)
- while (j > 0 && txt.charAt(i) != pat.charAt(j)) {
- j = next[j - 1];
- }
- if (txt.charAt(i) == pat.charAt(j)) {
- j++;
- }
- if (j == pat.length()) {
- return i - j + 1;
- }
- }
- return -1;
- }
-
- // 不考虑j的修改
- public static int kmpSearch1(String txt, String pat, int[] next) {
- // i指向str1,j指向str2
- for (int i = 0, j = 0; i < txt.length(); i++) {
- if (txt.charAt(i) == pat.charAt(j)) {
- j++;
- }
- if (j == pat.length()) {
- return i - j + 1;
- }
- }
- return -1;
- }
-
- /**
- * 根据子串算出部分匹配表
- *
- * @param dest 子串
- * @return int[] 部分匹配表
- */
- public static int[] kmpNext(String dest) {
- // 初始化部分匹配表
- int[] next = new int[dest.length()];
- // 部分匹配表第一个字符串为0
- next[0] = 0;
- // i表示,j表示上次的匹配值
- for (int i = 1, j = 0; i < dest.length(); i++) {
- // dest.charAt(i) != dest.charAt(j),从next[j-1]获取新的j
- while (j > 0 && dest.charAt(i) != dest.charAt(j)) {
- j = next[j - 1];
- }
- // dest.charAt(i) == dest.charAt(j),部分匹配值+1
- if (dest.charAt(i) == dest.charAt(j)) {
- j++;
- }
- next[i] = j;
- }
- return next;
- }
-
- // 不考虑调整j的大小
- public static int[] kmpNext1(String dest) {
- // 初始化部分匹配表
- int[] next = new int[dest.length()];
- // 部分匹配表第一个字符串为0
- next[0] = 0;
- // i表示,j表示匹配值
- for (int i = 1, j = 0; i < dest.length(); i++) {
- // 暂时不考虑不等
- // dest.charAt(i) == dest.charAt(j),部分匹配值+1
- if (dest.charAt(i) == dest.charAt(j)) {
- j++;
- }
- next[i] = j;
- }
- return next;
- }
-
-
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/KurskalAlgorithm.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/KurskalAlgorithm.java
deleted file mode 100644
index 590bc482..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/KurskalAlgorithm.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package cn.lastwhisper.mst;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class KurskalAlgorithm {
- //使用 INF 表示两个顶点不能连通
- private static final int INF = Integer.MAX_VALUE;
- // 边的个数
- int edgeNum;
- // 顶点数组
- char[] vertexs;
- // 邻接矩阵
- int[][] matrix;
-
- /**
- * 初始化
- *
- * @param vertexs 顶点数组
- * @param matrix 邻接矩阵
- * @return
- */
- public KurskalAlgorithm(char[] vertexs, int[][] matrix) {
- // 顶点个数
- int vlen = vertexs.length;
- // 初始化顶点
- this.vertexs = new char[vlen];
- for (int i = 0; i < vlen; i++) {
- this.vertexs[i] = vertexs[i];
- }
- // 初始化边
- this.matrix = new int[vlen][vlen];
- for (int i = 0; i < vlen; i++) {
- for (int j = 0; j < vlen; j++) {
- this.matrix[i][j] = matrix[i][j];
- }
- }
- // 统计边的个数
- for (int i = 0; i < vlen; i++) {
- for (int j = i + 1; j < vlen; j++) {
- if (this.matrix[i][j] != INF) {
- this.edgeNum++;
- }
- }
- }
- }
-
- // 打印结点
- public void print() {
- for (int i = 0; i < matrix.length; i++) {
- for (int j = 0; j < matrix[i].length; j++) {
- System.out.printf("%12d", matrix[i][j]);
- }
- System.out.println();//换行
- }
- }
-
- // 排序
- public void sortEdges(EData[] edges) {
- for (int i = 0; i < edges.length; i++) {
- for (int j = 0; j < edges.length - i - 1; j++) {
- if (edges[j].weight > edges[j + 1].weight) {
- EData temp = edges[j + 1];
- edges[j + 1] = edges[j];
- edges[j] = temp;
- }
- }
- }
-
- }
-
- // 根据邻接矩阵构造边对象数组
- public EData[] getEdges() {
- int index = 0;
- EData[] edges = new EData[edgeNum];
- for (int i = 0; i < vertexs.length; i++) {
- for (int j = i + 1; j < vertexs.length; j++) {
- if (matrix[i][j] != INF) {
- edges[index++] = new EData(vertexs[i], vertexs[j], matrix[i][j]);
- }
- }
- }
- return edges;
- }
-
- /**
- * 功能: 获取下标为i的顶点的终点(), 用于后面判断两个顶点的终点是否相同
- * @param ends : 数组就是记录了各个顶点对应的终点是哪个,ends 数组是在遍历过程中,逐步形成
- * @param i : 表示传入的顶点对应的下标
- * @return 返回的就是 下标为i的这个顶点对应的终点的下标, 一会回头还有来理解
- */
- private int getEnd(int[] ends, int i) { // i = 4 [0,0,0,0,5,0,0,0,0,0,0,0]
- while (ends[i] != 0) {
- i = ends[i];
- }
- return i;
- }
-
- /**
- *
- * @param ch 顶点的值,比如'A','B'
- * @return 返回ch顶点对应的下标,如果找不到,返回-1
- */
- private int getPosition(char ch) {
- for (int i = 0; i < vertexs.length; i++) {
- if (vertexs[i] == ch) {//找到
- return i;
- }
- }
- //找不到,返回-1
- return -1;
- }
-
- public void kruskal() {
- int index = 0; //表示最后结果数组的索引
- int[] ends = new int[edgeNum]; //用于保存"已有最小生成树" 中的每个顶点在最小生成树中的终点
- //创建结果数组, 保存最后的最小生成树
- EData[] rets = new EData[edgeNum];
-
- //获取图中 所有的边的集合 , 一共有12边
- EData[] edges = getEdges();
- System.out.println("图的边的集合=" + Arrays.toString(edges) + " 共"+ edges.length); //12
-
- //按照边的权值大小进行排序(从小到大)
- sortEdges(edges);
-
- //遍历edges 数组,将边添加到最小生成树中时,判断是准备加入的边否形成了回路,如果没有,就加入 rets, 否则不能加入
- for(int i=0; i < edgeNum; i++) {
- //获取到第i条边的第一个顶点(起点)
- int p1 = getPosition(edges[i].start); //p1=4
- //获取到第i条边的第2个顶点
- int p2 = getPosition(edges[i].end); //p2 = 5
-
- //获取p1这个顶点在已有最小生成树中的终点
- int m = getEnd(ends, p1); //m = 4
- //获取p2这个顶点在已有最小生成树中的终点
- int n = getEnd(ends, p2); // n = 5
- //是否构成回路
- if(m != n) { //没有构成回路
- ends[m] = n; // 设置m 在"已有最小生成树"中的终点 [0,0,0,0,5,0,0,0,0,0,0,0]
- rets[index++] = edges[i]; //有一条边加入到rets数组
- }
- }
- // 。
- //统计并打印 "最小生成树", 输出 rets
- System.out.println("最小生成树为");
- for(int i = 0; i < index; i++) {
- System.out.println(rets[i]);
- }
-
-
- }
-
- public static void main(String[] args) {
- char[] vertexs = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
- //克鲁斯卡尔算法的邻接矩阵
- int matrix[][] = {
- /*A*//*B*//*C*//*D*//*E*//*F*//*G*/
- /*A*/ {0, 12, INF, INF, INF, 16, 14},
- /*B*/ {12, 0, 10, INF, INF, 7, INF},
- /*C*/ {INF, 10, 0, 3, 5, 6, INF},
- /*D*/ {INF, INF, 3, 0, 4, INF, INF},
- /*E*/ {INF, INF, 5, 4, 0, 2, 8},
- /*F*/ {16, 7, 6, INF, 2, 0, 9},
- /*G*/ {14, INF, INF, INF, 8, 9, 0}};
- KurskalAlgorithm kurskalAlgorithm = new KurskalAlgorithm(vertexs, matrix);
- //kurskalAlgorithm.print();
- //EData[] edges = kurskalAlgorithm.getEdges();
- //kurskalAlgorithm.sortEdges(edges);
- //System.out.println(Arrays.toString(edges));
- kurskalAlgorithm.kruskal();
- }
-}
-
-// 代表一条边
-class EData {
- // 起点
- char start;
- // 终点
- char end;
- // 权重
- int weight;
-
- public EData(char start, char end, int weight) {
- this.start = start;
- this.end = end;
- this.weight = weight;
- }
-
- @Override
- public String toString() {
- return "EData{" +
- "start=" + start +
- ", end=" + end +
- ", weight=" + weight +
- '}';
- }
-}
\ No newline at end of file
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/Prim.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/Prim.java
deleted file mode 100644
index d39e5450..00000000
--- a/algorithms/algorithm/src/main/java/cn/lastwhisper/mst/Prim.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package cn.lastwhisper.mst;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class Prim {
-
-
- public static void main(String[] args) {
- // 图顶点的数据
- char[] data = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G'};
- int vertexs = data.length;
- //邻接矩阵的关系使用二维数组表示,10000表示两个点不联通(Integer.MAX_VALUE)
- int[][] matrix = new int[][]{
- {10000, 5, 7, 10000, 10000, 10000, 2},
- {5, 10000, 10000, 9, 10000, 10000, 3},
- {7, 10000, 10000, 10000, 8, 10000, 10000},
- {10000, 9, 10000, 10000, 10000, 4, 10000},
- {10000, 10000, 8, 10000, 10000, 5, 4},
- {10000, 10000, 10000, 4, 5, 10000, 6},
- {2, 3, 10000, 10000, 4, 6, 10000},};
-
- //创建MGraph对象
- MGraph graph = new MGraph(vertexs);
- // 最小生成树
- MinTree minTree = new MinTree();
- minTree.createGraph(graph, vertexs, data, matrix);
- minTree.showGraph(graph);
- minTree.prim(graph, 0);
- }
-
-}
-
-// 最小生成树
-class MinTree {
-
- /**
- *
- * @param graph 图
- * @param vertexs 顶点个数
- * @param data 顶点数据
- * @param matrix 顶点的关联映射的邻接矩阵
- * @return void
- */
- public void createGraph(MGraph graph, int vertexs, char[] data, int[][] matrix) {
- // 初始化顶点数据
- for (int i = 0; i < vertexs; i++) {
- graph.data[i] = data[i];
- // 初始化邻接矩阵
- for (int j = 0; j < vertexs; j++) {
- graph.matrix[i][j] = matrix[i][j];
- }
- }
- }
-
- //显示图的邻接矩阵
- public void showGraph(MGraph graph) {
- for (int[] link : graph.matrix) {
- System.out.println(Arrays.toString(link));
- }
- }
-
- /**
- * 根据图求得最小生成树
- * @param graph 图对象
- * @param v 起始顶点
- * @return void
- */
- public void prim(MGraph graph, int v) {
- // 记录已经访问过的顶点,true为访问过,false为没有访问过
- boolean[] visited = new boolean[graph.vertexs];
- visited[v] = true;
- int index1 = -1, index2 = -1;
- int minWeight = 10000;
- // n个顶点会产生n-1条边
- for (int k = 1; k < graph.vertexs; k++) {
- // 以i为顶点,向周围顶点访问,找到权值最小的连通顶点
- for (int i = 0; i < graph.vertexs; i++) {
- for (int j = 0; j < graph.vertexs; j++) {
- if (visited[i] && !visited[j] && graph.matrix[i][j] < minWeight) {
- minWeight = graph.matrix[i][j];
- index1 = i;
- index2 = j;
- }
- }
- }
- System.out.printf("边<%s,%s> 权值:%d\n", graph.data[index1], graph.data[index2], minWeight);
- minWeight = 10000;
- visited[index2] = true;
- }
- }
-}
-
-// 图
-class MGraph {
- // 顶点个数
- int vertexs;
- // 顶点数据
- char[] data;
- // 邻接矩阵
- int[][] matrix;
-
- public MGraph(int vertexs) {
- this.vertexs = vertexs;
- data = new char[vertexs];
- matrix = new int[vertexs][vertexs];
- }
-}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/sort/QuickSort.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/sort/QuickSort.java
new file mode 100644
index 00000000..778f8cad
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/sort/QuickSort.java
@@ -0,0 +1,78 @@
+package cn.lastwhisper.sort;
+
+
+import cn.lastwhisper.util.ArrayUtil;
+
+import java.util.Arrays;
+
+/**
+ * 快排
+ *
+ * 整个快速排序的核心是分区(partition),分区的目的是传入一个数组和选定的一个元素,把所有小于那个元素的其他元素放在左边,大于的放在右边。
+ * 元素的选择一般有如下几种:
+ * 永远选择第一个元素
+ * 永远选择最后一个元素
+ * 随机选择元素
+ * 取中间值
+ * @author lastwhisper
+ * @date 2020/3/15
+ */
+public class QuickSort {
+
+
+ public static void sort(int[] arr) {
+ sort(arr, 0, arr.length - 1);
+ }
+
+ public static void sort(int[] arr, int left, int right) {
+ if (left >= right) return;
+ int mid = partition(arr, left, right);
+ sort(arr, left, mid - 1);
+ sort(arr, mid + 1, right);
+ }
+
+ /**
+ * 选取最后的元素,把所有小于那个元素的其他元素放在左边,大于的放在右边
+ *
+ * 7, 3, 2, 8, 1, 9, 5, 4, 6 ==》
+ * 4, 3, 2, 5, 1, 6, 8, 7, 9
+ *
+ * @param arr 待排序数组
+ * @return int 返回数组
+ */
+ private static int partition(int[] arr, int leftBound, int rightBound) {
+ int i = leftBound;
+ int pivot = arr[rightBound];
+ int j = rightBound - 1;//-1是因为最后一个元素以及选择了
+ while (i <= j) {
+ while (i <= j && arr[i] <= pivot) {
+ i++;
+ }
+ while (i <= j && arr[j] > pivot) {
+ j--;
+ }
+ if (i < j) swap(arr, i, j);
+ }
+ swap(arr, i, rightBound);
+ System.out.println(Arrays.toString(arr));
+ return i;
+ }
+
+ private static void swap(int[] arr, int i, int j) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+
+ public static void main(String[] args) {
+ int[] arr = {7, 3, 2, 8, 1, 9, 5, 4, 6};
+ //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 0};//为什么left++和right--条件里面要加 left <= right 限定
+ //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 10};
+ //int arr[] = {7, 3, 2, 6, 8, 1, 9, 5, 4, 6, 10, 6, 6}; // 为什么不取等 arr[right] > pivot
+ //int arr[] = {4, 6}; //小bug测试 // 为什么while (left <= right)里面要取等
+ //sort(arr);
+ sort(ArrayUtil.generateArrByRandom(10));
+ //sort(arr,0,5);
+ //System.err.println(Arrays.toString(arr));
+ }
+}
diff --git a/algorithms/algorithm/src/main/java/cn/lastwhisper/util/ArrayUtil.java b/algorithms/algorithm/src/main/java/cn/lastwhisper/util/ArrayUtil.java
new file mode 100644
index 00000000..b91dfa7c
--- /dev/null
+++ b/algorithms/algorithm/src/main/java/cn/lastwhisper/util/ArrayUtil.java
@@ -0,0 +1,24 @@
+package cn.lastwhisper.util;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class ArrayUtil {
+
+ public static int[] generateArrByRandom(int max) {
+ int[] arr = new int[max];
+ for (int i = 0; i < max; i++) {
+ arr[i] = (int) (Math.random() * 8000000); // 生成一个[0,8000000) 的一个数
+ }
+ return arr;
+ }
+
+ public static int[] generateArrByOrder(int max) {
+ int[] arr = new int[max];
+ for (int i = 0; i < max; i++) {
+ arr[i] = i + 1;
+ }
+
+ return arr;
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/ArrayUtil.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/ArrayUtil.java
deleted file mode 100644
index f26c42f4..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/ArrayUtil.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package cn.lastwhisper;
-
-/**
- * @author cn.lastwhisper
- */
-public class ArrayUtil {
-
- public static int[] generateArrByRandom(int max) {
- int[] arr = new int[max];
- for (int i = 0; i < max; i++) {
- arr[i] = (int) (Math.random() * 8000000); // 生成一个[0,8000000) 的一个数
- }
- return arr;
- }
-
- public static int[] generateArrByOrder(int max) {
- int[] arr = new int[max];
- for (int i = 0; i < max; i++) {
- arr[i] = i + 1;
- }
-
- return arr;
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/graph/Graph.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/graph/Graph.java
similarity index 79%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/graph/Graph.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/graph/Graph.java
index a5226b25..4f69cc9f 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/graph/Graph.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/graph/Graph.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.graph;
+package cn.lastwhisper.atguigu.graph;
import java.util.ArrayList;
import java.util.Arrays;
@@ -13,7 +13,7 @@ public class Graph {
private List vertexList; // 存储顶点集合
private int[][] matrix; // 存储图对应的邻接矩阵
private int numOfEdges; // 记录边的数量
- private boolean[] isVisited; // 记录某结点是否被访问
+ private boolean[] isVisited; // 记录某节点是否被访问
// 初始化图的参数
public Graph(int n) {
@@ -56,7 +56,7 @@ public static void main(String[] args) {
graph.bfs();
}
- //遍历所有的结点,都进行广度优先搜索
+ //遍历所有的节点,都进行广度优先搜索
public void bfs() {
isVisited = new boolean[vertexList.size()];
for (int i = 0; i < getNumOfVertex(); i++) {
@@ -69,28 +69,28 @@ public void bfs() {
// 广度优先
public void bfs(boolean[] isVisited, int i) {
- int u; // 表示队列头结点对应下标
- int w; // 邻接结点w
- // 记录结点访问的顺序
+ int u; // 表示队列头节点对应下标
+ int w; // 邻接节点w
+ // 记录节点访问的顺序
LinkedList queue = new LinkedList<>();
System.out.print(getValueByIndex(i) + "=>");
- // 标记结点已经访问
+ // 标记节点已经访问
isVisited[i] = true;
queue.addLast(i);
while (!queue.isEmpty()) {
- // 出队,遍历当前出队结点的所有邻接结点,并放入队列中
+ // 出队,遍历当前出队节点的所有邻接节点,并放入队列中
u = queue.removeFirst();
- // 获取u的第一个邻接结点下标
+ // 获取u的第一个邻接节点下标
w = getFristNeighbor(u);
while (w != -1) {
if (!isVisited[w]) {
System.out.print(getValueByIndex(w) + "=>");
- // 标记结点已经访问
+ // 标记节点已经访问
isVisited[w] = true;
//入队,用于下一次出队
queue.addLast(w);
}
- // 从队列头结点,找到邻接结点w之后的邻接结点
+ // 从队列头节点,找到邻接节点w之后的邻接节点
w = getNextNeighbor(u, w);
}
}
@@ -109,23 +109,23 @@ public void dfs() {
// 深度优先遍历算法
public void dfs(boolean[] isVisited, int i) {
- // 首先我们访问该结点,输出
+ // 首先我们访问该节点,输出
System.out.print(getValueByIndex(i) + "->");
- // 将结点设置为已经访问
+ // 将节点设置为已经访问
isVisited[i] = true;
- // 查找结点i的第一个邻接结点j
+ // 查找节点i的第一个邻接节点j
int w = getFristNeighbor(i);
while (w != -1) {
if (!isVisited[w]) {
dfs(isVisited, w);
}
- // 第i个结点下标i,matrix的row;w是邻接结点下标,matrix的column
+ // 第i个节点下标i,matrix的row;w是邻接节点下标,matrix的column
w = getNextNeighbor(i, w);
}
}
/**
- * 根据前一个邻接结点的下标来获取下一个邻接结点
+ * 根据前一个邻接节点的下标来获取下一个邻接节点
*
* 0 1 2 3 4
* A B C D E
@@ -134,7 +134,7 @@ public void dfs(boolean[] isVisited, int i) {
* 2 C[1, 1, 0, 0, 0]
* 3 D[0, 1, 0, 0, 0]
* 4 E[0, 1, 0, 0, 0]
- * v1=1,v2=1,下一个邻接结点下标为1
+ * v1=1,v2=1,下一个邻接节点下标为1
* @param v1 当前weight横下标
* @param v2 当前weight纵下标
* @return int
@@ -149,7 +149,7 @@ public int getNextNeighbor(int v1, int v2) {
}
/**
- * 得到某一个结点的第一个邻接结点的下标
+ * 得到某一个节点的第一个邻接节点的下标
* 例如:
* 0 1 2 3 4
* A B C D E
@@ -158,8 +158,8 @@ public int getNextNeighbor(int v1, int v2) {
* 2 C[1, 1, 0, 0, 0]
* 3 D[0, 1, 0, 0, 0]
* 4 E[0, 1, 0, 0, 0]
- * index=0,第一个结点A的第一个邻接结点就是B,第一个邻接结点的下标就是1
- * @param index 某一个结点
+ * index=0,第一个节点A的第一个邻接节点就是B,第一个邻接节点的下标就是1
+ * @param index 某一个节点
* @return int
*/
public int getFristNeighbor(int index) {
@@ -171,12 +171,12 @@ public int getFristNeighbor(int index) {
return -1;
}
- // 返回结点下标对应的数据
+ // 返回节点下标对应的数据
public String getValueByIndex(int i) {
return vertexList.get(i);
}
- // 添加结点
+ // 添加节点
public void addVertex(String vertex) {
vertexList.add(vertex);
}
@@ -184,8 +184,8 @@ public void addVertex(String vertex) {
/**
* 添加边
*
- * @param v1 结点1的下标
- * @param v2 结点2的下标
+ * @param v1 节点1的下标
+ * @param v2 节点2的下标
* @param weight 1表示有通路,0表示无通路
*/
public void addEdge(int v1, int v2, int weight) {
@@ -201,7 +201,7 @@ public void show() {
}
}
- //返回结点的个数
+ //返回节点的个数
public int getNumOfVertex() {
return vertexList.size();
}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/hashtab/HashTabDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/hashtab/HashTabDemo.java
similarity index 99%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/hashtab/HashTabDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/hashtab/HashTabDemo.java
index eccb9cc8..8eb6eee7 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/hashtab/HashTabDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/hashtab/HashTabDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.hashtab;
+package cn.lastwhisper.atguigu.hashtab;
/**
*
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/DoubleLinkedListDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/DoubleLinkedListDemo.java
similarity index 77%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/DoubleLinkedListDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/DoubleLinkedListDemo.java
index cd0ea117..8d725b43 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/DoubleLinkedListDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/DoubleLinkedListDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.linkedlist;
+package cn.lastwhisper.atguigu.linkedlist;
/**
* 双向链表
@@ -15,23 +15,23 @@ public static void main(String[] args) {
doubleLinkedList.add(hero2);
doubleLinkedList.add(hero3);
doubleLinkedList.add(hero4);
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
doubleLinkedList.list();
- System.out.println("===============删除链表某结点==================");
+ System.out.println("===============删除链表某节点==================");
doubleLinkedList.delete(2);
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
doubleLinkedList.list();
- System.out.println("================更新链表结点,4=================");
+ System.out.println("================更新链表节点,4=================");
doubleLinkedList.update(new HeroNode2(4, "林冲", "豹子头~~~"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
doubleLinkedList.list();
- System.out.println("===============按序插入结点,8================");
+ System.out.println("===============按序插入节点,8================");
doubleLinkedList.addByNoOrder(new HeroNode2(8, "武松", "行者"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
doubleLinkedList.list();
- System.out.println("===============按序插入结点,6================");
+ System.out.println("===============按序插入节点,6================");
doubleLinkedList.addByNoOrder(new HeroNode2(6, "入云龙", "公孙胜"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
doubleLinkedList.list();
}
}
@@ -63,13 +63,13 @@ public void delete(int no) {
HeroNode2 tempNode = head;
while (true) {
if (tempNode.next == null) {
- System.out.printf("未找到no==%d 结点\n", no);
+ System.out.printf("未找到no==%d 节点\n", no);
break;
}
tempNode = tempNode.next;
if (tempNode.no == no) {
tempNode.pre.next = tempNode.next;
- System.out.printf("已删除no==%d 结点\n", no);
+ System.out.printf("已删除no==%d 节点\n", no);
break;
}
}
@@ -80,22 +80,22 @@ public void update(HeroNode2 updateNode) {
HeroNode2 tempNode = head;
while (true) {
if (tempNode.next == null) {
- System.out.printf("未找到no==%d 结点\n", updateNode.no);
+ System.out.printf("未找到no==%d 节点\n", updateNode.no);
break;
}
tempNode = tempNode.next;
- // 找到待更新结点
+ // 找到待更新节点
if (tempNode.no == updateNode.no) {
tempNode.name = updateNode.name;
tempNode.nickName = updateNode.nickName;
- System.out.printf("已更新no==%d 结点\n", updateNode.no);
+ System.out.printf("已更新no==%d 节点\n", updateNode.no);
break;
}
}
}
/**
- * 展示所有结点,沿着头结点遍历
+ * 展示所有节点,沿着头节点遍历
*
* @param
* @return void
@@ -125,7 +125,7 @@ public void addByNoOrder(HeroNode2 heroNode) {
}
//preNode = tempNode;
tempNode = tempNode.next;
- // tempNode是待插入结点的前一个结点
+ // tempNode是待插入节点的前一个节点
if (heroNode.no == tempNode.no) {
flag = false;
System.out.println("已存在排名,添加失败" + heroNode);
@@ -134,9 +134,9 @@ public void addByNoOrder(HeroNode2 heroNode) {
if (heroNode.no < tempNode.no) {
// 1,3,4 heroNode.no=2 tempNode.next.no=3 2<3 可以添加
- // heroNode指向no=3结点,即2,3
+ // heroNode指向no=3节点,即2,3
heroNode.next = tempNode;
- // tempNode.pre为no=1的结点 即1,2
+ // tempNode.pre为no=1的节点 即1,2
// preNode.next = heroNode;
tempNode.pre.next = heroNode;
flag = false;
@@ -144,7 +144,7 @@ public void addByNoOrder(HeroNode2 heroNode) {
}
}
if (flag) {
- // 待插入结点no最大
+ // 待插入节点no最大
tempNode.next = heroNode;
heroNode.pre = tempNode;
}
@@ -152,15 +152,15 @@ public void addByNoOrder(HeroNode2 heroNode) {
}
/**
- * 双向链表结点
+ * 双向链表节点
*
*/
class HeroNode2 {
public int no;
public String name;
public String nickName;
- public HeroNode2 next; // 当前结点的后一个结点
- public HeroNode2 pre; //当前结点的前一个结点
+ public HeroNode2 next; // 当前节点的后一个节点
+ public HeroNode2 pre; //当前节点的前一个节点
public HeroNode2(int no, String name, String nickName) {
this.no = no;
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/Josepfu.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/Josepfu.java
similarity index 95%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/Josepfu.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/Josepfu.java
index dd269af1..05df13fc 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/Josepfu.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/Josepfu.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.linkedlist;
+package cn.lastwhisper.atguigu.linkedlist;
/**
* 约瑟夫环
@@ -32,7 +32,7 @@ public void createCircle(int num) {
System.out.println("错误的num");
return;
}
- // 定位最后一个boy的位置,方便添加结点
+ // 定位最后一个boy的位置,方便添加节点
Boy currBoy = null;
for (int i = 1; i <= num; i++) {
Boy boy = new Boy(i);
@@ -51,7 +51,7 @@ public void createCircle(int num) {
}
/**
- * 打印当前环链的结点信息
+ * 打印当前环链的节点信息
*/
public void showBoy() {
if (frist == null) {
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/SingleLinkedListDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/SingleLinkedListDemo.java
similarity index 80%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/SingleLinkedListDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/SingleLinkedListDemo.java
index 964574a5..6f915a4d 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/linkedlist/SingleLinkedListDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/SingleLinkedListDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.linkedlist;
+package cn.lastwhisper.atguigu.linkedlist;
import org.junit.Test;
@@ -27,32 +27,32 @@ public class SingleLinkedListDemo {
public static void main(String[] args) {
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("===============删除链表某结点==================");
+ System.out.println("===============删除链表某节点==================");
singleLinkedList.delete(2);
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("================更新链表结点,4=================");
+ System.out.println("================更新链表节点,4=================");
singleLinkedList.update(new HeroNode(4, "林冲", "豹子头~~~"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("===============按序插入结点,2,3================");
+ System.out.println("===============按序插入节点,2,3================");
singleLinkedList.addByNoOrder(new HeroNode(2, "卢俊义回来了~~~", "玉麒麟"));
singleLinkedList.addByNoOrder(new HeroNode(3, "吴用", "智多星"));
//singleLinkedList.addByNoOrderIsEqual(new HeroNode(2, "卢俊义回来了~~~", "玉麒麟"));
//singleLinkedList.addByNoOrderIsEqual(new HeroNode(3, "吴用", "智多星"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("===============按序插入结点,8================");
+ System.out.println("===============按序插入节点,8================");
singleLinkedList.addByNoOrder(new HeroNode(8, "武松", "行者"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("===============按序插入结点,7================");
+ System.out.println("===============按序插入节点,7================");
singleLinkedList.addByNoOrder(new HeroNode(7, "入云龙", "公孙胜"));
- System.out.println("===============查看链表所有结点================");
+ System.out.println("===============查看链表所有节点================");
singleLinkedList.list();
- System.out.println("---------------获取链表长度,不包括头结点-----------");
+ System.out.println("---------------获取链表长度,不包括头节点-----------");
System.out.println(singleLinkedList.size());
System.out.println("---------------获取链表倒数第2个元素-----------");
System.out.println(singleLinkedList.findLastIndexNode(2));
@@ -74,7 +74,7 @@ public static void main(String[] args) {
singleLinkedList2.add(hero23);
singleLinkedList2.add(hero25);
singleLinkedList2.add(hero27);
- System.out.println("---------------查看二号链表所有结点---------------");
+ System.out.println("---------------查看二号链表所有节点---------------");
singleLinkedList2.list();
SingleLinkedList singleLinkedList3 = new SingleLinkedList();
HeroNode hero32 = new HeroNode(2, "柴进", "小旋风");
@@ -85,11 +85,11 @@ public static void main(String[] args) {
singleLinkedList3.add(hero34);
singleLinkedList3.add(hero36);
singleLinkedList3.add(hero38);
- System.out.println("---------------查看三号链表所有结点---------------");
+ System.out.println("---------------查看三号链表所有节点---------------");
singleLinkedList3.list();
System.out.println("-----------------合并结束-------------------");
singleLinkedList2.mergeOrderLinkedList(singleLinkedList3);
- System.out.println("-----------------查看二号链表所有结点-----------------");
+ System.out.println("-----------------查看二号链表所有节点-----------------");
singleLinkedList2.list();
}
@@ -112,12 +112,12 @@ class SingleLinkedList {
private HeroNode head = new HeroNode(0, "", "");
/**
- * 添加结点
+ * 添加节点
* 找到单链表lastNode,lastNode.next=newNode
*/
public void add(HeroNode heroNode) {
HeroNode tempNode = head;
- // 找到最后一个结点
+ // 找到最后一个节点
while (true) {
if (tempNode.next == null) {
break;
@@ -153,23 +153,23 @@ public void addByNoOrder(HeroNode heroNode) {
if (heroNode.no < tempNode.no) {
// 1,3,4 heroNode.no=2 tempNode.next.no=3 2<3 可以添加
- // heroNode指向no=3结点
+ // heroNode指向no=3节点
heroNode.next = tempNode;
- // tempNode指向heroNode结点
+ // tempNode指向heroNode节点
preNode.next = heroNode;
flag = false;
break;
}
}
if (flag) {
- // 待插入结点no最大
+ // 待插入节点no最大
tempNode.next = heroNode;
}
}
/**
* 根据排名插入到指定位置
- * 可以存在相同编号的结点
+ * 可以存在相同编号的节点
* @param heroNode
* @return void
*/
@@ -186,22 +186,22 @@ public void addByNoOrderIsEqual(HeroNode heroNode) {
if (heroNode.no <= tempNode.no) {
// 1,3,4 heroNode.no=2 tempNode.next.no=3 2<3 可以添加
- // heroNode指向no=3结点
+ // heroNode指向no=3节点
heroNode.next = tempNode;
- // tempNode指向heroNode结点
+ // tempNode指向heroNode节点
preNode.next = heroNode;
flag = false;
break;
}
}
if (flag) {
- // 待插入结点no最大
+ // 待插入节点no最大
tempNode.next = heroNode;
}
}
/**
- * 展示所有结点,沿着头结点遍历
+ * 展示所有节点,沿着头节点遍历
*
* @param
* @return void
@@ -235,32 +235,32 @@ public void deleteDuplicate() {
}
/**
- * 根据no删除结点
+ * 根据no删除节点
*
* @param no
* @return void
*/
public void delete(int no) {
- // 1、沿着头结点tempNode遍历,找到node.no=no的前一个结点preNode
+ // 1、沿着头节点tempNode遍历,找到node.no=no的前一个节点preNode
HeroNode preNode = head;
while (true) {
if (preNode.next == null) {
- System.out.printf("未找到no==%d 结点\n", no);
+ System.out.printf("未找到no==%d 节点\n", no);
break;
}
- // tempNode是待删除结点的前一个结点
+ // tempNode是待删除节点的前一个节点
preNode = preNode.next;
- // 2. 找到待删除结点的前一个结点
+ // 2. 找到待删除节点的前一个节点
if (preNode.next.no == no) {
preNode.next = preNode.next.next;
- System.out.printf("已删除no==%d 结点\n", no);
+ System.out.printf("已删除no==%d 节点\n", no);
break;
}
}
}
/**
- * 根据no更新结点
+ * 根据no更新节点
*
* @param updateNode
* @return void
@@ -269,22 +269,22 @@ public void update(HeroNode updateNode) {
HeroNode tempNode = head;
while (true) {
if (tempNode.next == null) {
- System.out.printf("未找到no==%d 结点\n", updateNode.no);
+ System.out.printf("未找到no==%d 节点\n", updateNode.no);
break;
}
tempNode = tempNode.next;
- // 找到待更新结点
+ // 找到待更新节点
if (tempNode.no == updateNode.no) {
tempNode.name = updateNode.name;
tempNode.nickName = updateNode.nickName;
- System.out.printf("已更新no==%d 结点\n", updateNode.no);
+ System.out.printf("已更新no==%d 节点\n", updateNode.no);
break;
}
}
}
/**
- * 获取单链表的结点个数(不统计头结点)
+ * 获取单链表的节点个数(不统计头节点)
*
* @param
* @return int
@@ -300,7 +300,7 @@ public int size() {
}
/**
- * 获取单链表倒数第k个结点
+ * 获取单链表倒数第k个节点
* 思路:倒数第k个等价于正数size-k+1个
* 示例:7个元素,倒数第2个==正数第6个
* @param k
@@ -320,16 +320,16 @@ public HeroNode findLastIndexNode(int k) {
/**
* 单链表反转
- * 将原链表结点依次插入到反转链表的第一个位置
+ * 将原链表节点依次插入到反转链表的第一个位置
*/
public void reverse() {
- // 如果单链表中无结点或者只有一个结点
+ // 如果单链表中无节点或者只有一个节点
if (head.next == null || head.next.next == null) {
return;
}
- // currNode的作用:指向待插入反转链表结点的指针。遍历原单链表
+ // currNode的作用:指向待插入反转链表节点的指针。遍历原单链表
HeroNode currNode = head.next;
- // nextNode的作用:暂存待插入反转链表结点的下一个结点
+ // nextNode的作用:暂存待插入反转链表节点的下一个节点
HeroNode nextNode;
HeroNode reverseHead = new HeroNode(0, "", "");
@@ -339,10 +339,10 @@ public void reverse() {
nextNode = currNode.next;
currNode.next = reverseHead.next;
reverseHead.next = currNode;
- // currNode每一次循环都会后移一个结点
+ // currNode每一次循环都会后移一个节点
currNode = nextNode;
}
- // 将原链表头结点指向反转链表头结点.next
+ // 将原链表头节点指向反转链表头节点.next
head.next = reverseHead.next;
}
@@ -368,12 +368,12 @@ public void reverseList() {
/**
* 合并两个有序链表(合并后还有序)
- * 方法一:遍历2号链表,将每一个结点都放入1号链表.addByNoOrderIsEqual方法中
+ * 方法一:遍历2号链表,将每一个节点都放入1号链表.addByNoOrderIsEqual方法中
* 优点:方便简洁,代码容易理解。缺点:性能低。
* 方法二:
* 1号链表:1,3,6,7 2号链表:2,4,6,8
- * 由于是有序链表,2号链表的2结点插入到1号链表的1,3结点之中后,
- * 2号链表的4结点没有必要从1号结点的1,2,3开始遍历,直接从刚插入结点2结点开始遍历即可
+ * 由于是有序链表,2号链表的2节点插入到1号链表的1,3节点之中后,
+ * 2号链表的4节点没有必要从1号节点的1,2,3开始遍历,直接从刚插入节点2节点开始遍历即可
* @param singleLinkedList
* @return void
*/
@@ -387,24 +387,24 @@ public void mergeOrderLinkedList(SingleLinkedList singleLinkedList) {
// currNode = nextNode;
//}
// 方法二:
- // 2号链表 currNode1当前待合并结点
+ // 2号链表 currNode1当前待合并节点
HeroNode currNode2 = singleLinkedList.head.next;
- // nextNode是currNode.next,防止2号链表后续结点丢失
+ // nextNode是currNode.next,防止2号链表后续节点丢失
HeroNode nextNode2;
- // 缓存刚插入结点的位置
+ // 缓存刚插入节点的位置
HeroNode currNodeChche2 = null;
while (currNode2 != null) {
nextNode2 = currNode2.next;
// 1号链表
- // 记录2号链表结点在1号链表结点插入的位置
+ // 记录2号链表节点在1号链表节点插入的位置
HeroNode tempNode1 = currNodeChche2;
if (tempNode1 == null) {
tempNode1 = this.head;
}
HeroNode preNode1;
- boolean flag = true; //标识该结点是否插到最后一位
+ boolean flag = true; //标识该节点是否插到最后一位
while (true) {
if (tempNode1.next == null) {
break;
@@ -413,9 +413,9 @@ public void mergeOrderLinkedList(SingleLinkedList singleLinkedList) {
tempNode1 = tempNode1.next;
if (currNode2.no <= tempNode1.no) {
// 1,3,4 nextNode.no=2 nextNode.next.no=3 2<3 可以添加
- // nextNode指向no=3结点
+ // nextNode指向no=3节点
currNode2.next = tempNode1;
- // tempNode指向nextNode结点
+ // tempNode指向nextNode节点
preNode1.next = currNode2;
flag = false;
break;
@@ -423,18 +423,18 @@ public void mergeOrderLinkedList(SingleLinkedList singleLinkedList) {
}
if (flag) {
- // 待插入结点no最大
+ // 待插入节点no最大
tempNode1.next = currNode2;
}
currNodeChche2 = currNode2;
- // 存储2号链表的当前结点后移
+ // 存储2号链表的当前节点后移
currNode2 = nextNode2;
}
}
}
/**
- * 单链表的结点
+ * 单链表的节点
*/
class HeroNode {
public int no;
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v1/SkipSet.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v1/SkipSet.java
new file mode 100644
index 00000000..014114ee
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v1/SkipSet.java
@@ -0,0 +1,165 @@
+package cn.lastwhisper.atguigu.linkedlist.skiplist.v1;
+
+/**
+ * https://www.iteye.com/blog/imtinx-1291165
+ * 跳表节点数据存储结构
+ */
+class SkipNode> {
+ public final E value; //节点存储的数据
+ public final SkipNode[] forward; //节点的指针数组
+
+ /**
+ * 根据节点的层级构造一个节点
+ * @param level 节点层级
+ * @param value 节点存储值
+ */
+ @SuppressWarnings("unchecked")
+ public SkipNode(int level, E value) {
+ forward = new SkipNode[level + 1];//level层的元素后面带着level+1的指针数组
+ this.value = value;
+ }
+
+}
+
+public class SkipSet> {
+
+ /**
+ * 概率因子,实验证明p=1/e比p=0.5要好,e是个神奇的数字!
+ */
+// public static final double P = 0.5;
+ public static final double P = 1 / Math.E;
+ /**
+ * 最大层级
+ */
+ public static final int MAX_LEVEL = 6;
+
+ /**
+ * 开始节点,不存值,贯穿所有层
+ */
+ public final SkipNode header = new SkipNode(MAX_LEVEL, null);
+ /**
+ * 当前跳表的最高层级
+ */
+ public int level = 0;
+
+ /**
+ * 插入一个元素
+ * @param value 待插入值
+ */
+ @SuppressWarnings("unchecked")
+ public void insert(E value) {
+ SkipNode x = header;
+ SkipNode[] update = new SkipNode[MAX_LEVEL + 1];
+ //查找元素的位置,这里其实做了一次contain操作,注释见contain
+ for (int i = level; i >= 0; i--) {
+ while (x.forward[i] != null
+ && x.forward[i].value.compareTo(value) < 0) {
+ x = x.forward[i];
+ }
+ //update[i]是比value小的数里面最大的,是value的前置节点
+ update[i] = x;
+ }
+ x = x.forward[0];
+
+ //此处不允许插入相同元素,为一个set
+ if (x == null || !x.value.equals(value)) {//跳表中不包含所要插的元素
+ //随机产生插入的层级
+ int lvl = randomLevel();
+ //产生的随机层级比当前跳表的最高层级大,需要添加相应的层级,并更新最高层级
+ if (lvl > level) {
+ for (int i = level + 1; i <= lvl; i++) {
+ update[i] = header;
+ }
+ level = lvl;
+ }
+
+ //生成新节点
+ x = new SkipNode(lvl, value);
+ //调整节点的指针,和指向它的指针
+ for (int i = 0; i <= lvl; i++) {
+ x.forward[i] = update[i].forward[i];
+ update[i].forward[i] = x;
+ }
+
+ }
+ }
+
+ /**
+ * 删除一个元素
+ * @param value 待删除值
+ */
+ @SuppressWarnings("unchecked")
+ public void delete(E value) {
+ SkipNode x = header;
+ SkipNode[] update = new SkipNode[MAX_LEVEL + 1];
+ //查找元素的位置,这里其实做了一次contain操作,注释见contain
+ for (int i = level; i >= 0; i--) {
+ while (x.forward[i] != null
+ && x.forward[i].value.compareTo(value) < 0) {
+ x = x.forward[i];
+ }
+ update[i] = x;
+ }
+ x = x.forward[0];
+ //删除元素,调整指针
+ if (x.value.equals(value)) {
+ for (int i = 0; i <= level; i++) {
+ if (update[i].forward[i] != x)
+ break;
+ update[i].forward[i] = x.forward[i];
+ }
+ //如果元素为本层最后一个元素,则删除同时降低当前层级
+ while (level > 0 && header.forward[level] == null) {
+ level--;
+ }
+
+ }
+ }
+
+ /**
+ * 查找是否包含此元素
+ * @param searchValue 带查找值
+ * @return true:包含;false:不包含
+ */
+ public boolean contains(E searchValue) {
+ SkipNode x = header;
+ //从开始节点的最高层级开始查找
+ for (int i = level; i >= 0; i--) {
+ //当到达本层级的NULL节点或者遇到比查找值大的节点时,转到下一层级查找
+ while (x.forward[i] != null
+ && x.forward[i].value.compareTo(searchValue) < 0) {
+ x = x.forward[i];
+ }
+ }
+ x = x.forward[0];
+ //此时x有三种可能,1.x=null,2.x.value=searchValue,3.x.value>searchValue
+ return x != null && x.value.equals(searchValue);
+ }
+
+ /**
+ * 这里是跳表的精髓所在,通过随机概率来判断节点的层级
+ * @return 节点的层级
+ */
+ public static int randomLevel() {
+ int lvl = (int) (Math.log(1. - Math.random()) / Math.log(1. - P));
+ return Math.min(lvl, MAX_LEVEL);
+ }
+
+ /**
+ * 输出跳表的所有元素
+ * 遍历最底层的元素即可
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ SkipNode x = header.forward[0];
+ while (x != null) {
+ sb.append(x.value);
+ x = x.forward[0];
+ if (x != null)
+ sb.append(",");
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v2/SkipList.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v2/SkipList.java
new file mode 100644
index 00000000..999ca80a
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v2/SkipList.java
@@ -0,0 +1,150 @@
+package cn.lastwhisper.atguigu.linkedlist.skiplist.v2;
+
+/**
+ * 跳表的一种实现方法。
+ * 跳表中存储的是正整数,并且存储的是不重复的。
+ *
+ * -------------------------------------------------------------------------
+ * 以每两个结点抽取一个做上级索引为例分析:
+ * 时间复杂度:O(logn)
+ * 空间复杂度:O(n),需要抽出n/2+n/4+n/8…+8+4+2=n-2
+ */
+public class SkipList {
+
+ private static final float SKIPLIST_P = 0.5f;
+ private static final int MAX_LEVEL = 16;
+
+ private int levelCount = 1;
+ // 带头链表
+ private Node head = new Node();
+
+ public static class Node {
+ private int data = -1;
+ private Node[] forwards = new Node[MAX_LEVEL];
+ private int maxLevel = 0;
+
+ @Override
+ public String toString() {
+ return "{ data: " +
+ data +
+ "; levels: " +
+ maxLevel +
+ " }";
+ }
+ }
+
+ public Node find(int value) {
+ Node p = head;
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ p = p.forwards[i];
+ }
+ }
+
+ if (p.forwards[0] != null && p.forwards[0].data == value) {
+ return p.forwards[0];
+ } else {
+ return null;
+ }
+ }
+
+ public void insert(int value) {
+ int level = randomLevel();
+ Node newNode = new Node();
+ newNode.data = value;
+ newNode.maxLevel = level;
+ Node[] update = new Node[level];
+ for (int i = 0; i < level; ++i) {
+ update[i] = head;
+ }
+
+ // record every level largest value which smaller than insert value in update[]
+ Node p = head;
+ for (int i = level - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ p = p.forwards[i];
+ }
+ update[i] = p;// use update save node in search path
+ }
+
+ // in search path node next node become new node forwords(next)
+ for (int i = 0; i < level; ++i) {
+ newNode.forwards[i] = update[i].forwards[i];
+ update[i].forwards[i] = newNode;
+ }
+
+ // update node hight
+ if (levelCount < level) {
+ levelCount = level;
+ }
+ }
+
+ public void delete(int value) {
+ Node[] update = new Node[levelCount];
+ Node p = head;
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ p = p.forwards[i];
+ }
+ update[i] = p;
+ }
+
+ if (p.forwards[0] != null && p.forwards[0].data == value) {
+ for (int i = levelCount - 1; i >= 0; --i) {
+ if (update[i].forwards[i] != null && update[i].forwards[i].data == value) {
+ update[i].forwards[i] = update[i].forwards[i].forwards[i];
+ }
+ }
+ }
+
+ while (levelCount > 1 && head.forwards[levelCount] == null) {
+ levelCount--;
+ }
+
+ }
+
+ // 理论来讲,一级索引中元素个数应该占原始数据的 50%,二级索引中元素个数占 25%,三级索引12.5% ,一直到最顶层。
+ // 因为这里每一层的晋升概率是 50%。对于每一个新插入的节点,都需要调用 randomLevel 生成一个合理的层数。
+ // 该 randomLevel 方法会随机生成 1~MAX_LEVEL 之间的数,且 :
+ // 50%的概率返回 1
+ // 25%的概率返回 2
+ // 12.5%的概率返回 3 ...
+ private int randomLevel() {
+ int level = 1;
+
+ while (Math.random() < SKIPLIST_P && level < MAX_LEVEL) {
+ level += 1;
+ }
+ return level;
+ }
+
+ public void printAll() {
+ Node p = head;
+ while (p.forwards[0] != null) {
+ System.out.print(p.forwards[0] + " ");
+ p = p.forwards[0];
+ }
+ System.out.println();
+ }
+
+ public static void main(String[] args) {
+ SkipList list = new SkipList();
+ list.insert(1);
+ list.insert(2);
+ // 寻找2
+ Node node = list.find(2);
+ System.out.println(node == null ? "不存在" : node.data);
+ list.insert(6);
+ list.insert(7);
+ // 删除2
+ list.delete(2);
+ node = list.find(2);
+ System.out.println(node == null ? "不存在" : node.data);
+ list.insert(8);
+ list.insert(3);
+ list.insert(4);
+ list.insert(5);
+
+ list.printAll();
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v3/SkipList2.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v3/SkipList2.java
new file mode 100644
index 00000000..acc518bb
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/linkedlist/skiplist/v3/SkipList2.java
@@ -0,0 +1,307 @@
+package cn.lastwhisper.atguigu.linkedlist.skiplist.v3;
+
+import java.util.Random;
+
+/**
+ * 1,跳表的一种实现方法,用于练习。跳表中存储的是正整数,并且存储的是不重复的。
+ * 2,本类是参考作者zheng ,自己学习,优化了添加方法
+ * 3,看完这个,我觉得再看ConcurrentSkipListMap 源码,会有很大收获
+ * Author:ldb
+ */
+public class SkipList2 {
+
+ private static final int MAX_LEVEL = 16;
+ private int levelCount = 1;
+
+ /**
+ * 带头链表
+ */
+ private Node head = new Node(MAX_LEVEL);
+ private Random r = new Random();
+
+ /**
+ * 跳表的节点,每个节点记录了当前节点数据和所在层数数据
+ */
+ public class Node {
+ private int data = -1;
+ /**
+ * 表示当前节点位置的下一个节点所有层的数据,从上层切换到下层,就是数组下标-1,
+ * forwards[3]表示当前节点在第三层的下一个节点。
+ */
+ private Node forwards[];
+
+ /**
+ * 这个值其实可以不用,看优化insert()
+ */
+ private int maxLevel = 0;
+
+ public Node(int level) {
+ forwards = new Node[level];
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("{ data: ");
+ builder.append(data);
+ builder.append("; levels: ");
+ builder.append(maxLevel);
+ builder.append(" }");
+ return builder.toString();
+ }
+ }
+
+ public Node find(int value) {
+ Node p = head;
+ // 从最大层开始查找,找到前一节点,通过--i,移动到下层再开始查找
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ // 找到前一节点
+ p = p.forwards[i];
+ }
+ }
+
+ if (p.forwards[0] != null && p.forwards[0].data == value) {
+ return p.forwards[0];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 优化了作者zheng的插入方法
+ *
+ * @param value 值
+ */
+ public void insert(int value) {
+ int level = head.forwards[0] == null ? 1 : randomLevel();
+ // 每次只增加一层,如果条件满足
+ if (level > levelCount) {
+ level = ++levelCount;
+ }
+ Node newNode = new Node(level);
+ newNode.data = value;
+ Node update[] = new Node[level];
+ for (int i = 0; i < level; ++i) {
+ update[i] = head;
+ }
+
+ Node p = head;
+ // 从最大层开始查找,找到前一节点,通过--i,移动到下层再开始查找
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ // 找到前一节点
+ p = p.forwards[i];
+ }
+ // levelCount 会 > level,所以加上判断
+ if (level > i) {
+ update[i] = p;
+ }
+
+ }
+ for (int i = 0; i < level; ++i) {
+ newNode.forwards[i] = update[i].forwards[i];
+ update[i].forwards[i] = newNode;
+ }
+
+ }
+
+ /**
+ * 优化了作者zheng的插入方法2
+ *
+ * @param value 值
+ */
+ public void insert2(int value) {
+ int level = head.forwards[0] == null ? 1 : randomLevel();
+ // 每次只增加一层,如果条件满足
+ if (level > levelCount) {
+ level = ++levelCount;
+ }
+ Node newNode = new Node(level);
+ newNode.data = value;
+ Node p = head;
+ // 从最大层开始查找,找到前一节点,通过--i,移动到下层再开始查找
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ // 找到前一节点
+ p = p.forwards[i];
+ }
+ // levelCount 会 > level,所以加上判断
+ if (level > i) {
+ if (p.forwards[i] == null) {
+ p.forwards[i] = newNode;
+ } else {
+ Node next = p.forwards[i];
+ p.forwards[i] = newNode;
+ newNode.forwards[i] = next;
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * 作者zheng的插入方法,未优化前,优化后参见上面insert()
+ *
+ * @param value
+ * @param level 0 表示随机层数,不为0,表示指定层数,指定层数
+ * 可以让每次打印结果不变动,这里是为了便于学习理解
+ */
+ public void insert(int value, int level) {
+ // 随机一个层数
+ if (level == 0) {
+ level = randomLevel();
+ }
+ // 创建新节点
+ Node newNode = new Node(level);
+ newNode.data = value;
+ // 表示从最大层到低层,都要有节点数据
+ newNode.maxLevel = level;
+ // 记录要更新的层数,表示新节点要更新到哪几层
+ Node update[] = new Node[level];
+ for (int i = 0; i < level; ++i) {
+ update[i] = head;
+ }
+
+ /**
+ *
+ * 1,说明:层是从下到上的,这里最下层编号是0,最上层编号是15
+ * 2,这里没有从已有数据最大层(编号最大)开始找,(而是随机层的最大层)导致有些问题。
+ * 如果数据量为1亿,随机level=1 ,那么插入时间复杂度为O(n)
+ */
+ Node p = head;
+ for (int i = level - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ p = p.forwards[i];
+ }
+ // 这里update[i]表示当前层节点的前一节点,因为要找到前一节点,才好插入数据
+ update[i] = p;
+ }
+
+ // 将每一层节点和后面节点关联
+ for (int i = 0; i < level; ++i) {
+ // 记录当前层节点后面节点指针
+ newNode.forwards[i] = update[i].forwards[i];
+ // 前一个节点的指针,指向当前节点
+ update[i].forwards[i] = newNode;
+ }
+
+ // 更新层高
+ if (levelCount < level) levelCount = level;
+ }
+
+ public void delete(int value) {
+ Node[] update = new Node[levelCount];
+ Node p = head;
+ for (int i = levelCount - 1; i >= 0; --i) {
+ while (p.forwards[i] != null && p.forwards[i].data < value) {
+ p = p.forwards[i];
+ }
+ update[i] = p;
+ }
+
+ if (p.forwards[0] != null && p.forwards[0].data == value) {
+ for (int i = levelCount - 1; i >= 0; --i) {
+ if (update[i].forwards[i] != null && update[i].forwards[i].data == value) {
+ update[i].forwards[i] = update[i].forwards[i].forwards[i];
+ }
+ }
+ }
+ }
+
+ /**
+ * 随机 level 次,如果是奇数层数 +1,防止伪随机
+ *
+ * @return
+ */
+ private int randomLevel() {
+ int level = 1;
+ for (int i = 1; i < MAX_LEVEL; ++i) {
+ if (r.nextInt() % 2 == 1) {
+ level++;
+ }
+ }
+ return level;
+ }
+
+ /**
+ * 打印每个节点数据和最大层数
+ */
+ public void printAll() {
+ Node p = head;
+ while (p.forwards[0] != null) {
+ System.out.print(p.forwards[0] + " ");
+ p = p.forwards[0];
+ }
+ System.out.println();
+ }
+
+ /**
+ * 打印所有数据
+ */
+ public void printAll_beautiful() {
+ Node p = head;
+ Node[] c = p.forwards;
+ Node[] d = c;
+ int maxLevel = c.length;
+ for (int i = maxLevel - 1; i >= 0; i--) {
+ do {
+ System.out.print((d[i] != null ? d[i].data : null) + ":" + i + "-------");
+ } while (d[i] != null && (d = d[i].forwards)[i] != null);
+ System.out.println();
+ d = c;
+ }
+ }
+
+ public static void main(String[] args) {
+ SkipList2 list = new SkipList2();
+ list.insert(1, 3);
+ list.insert(2, 3);
+ list.insert(3, 2);
+ list.insert(4, 4);
+ list.insert(5, 10);
+ list.insert(6, 4);
+ list.insert(8, 5);
+ list.insert(7, 4);
+ list.printAll_beautiful();
+ list.printAll();
+ /**
+ * 结果如下:
+ * null:15-------
+ * null:14-------
+ * null:13-------
+ * null:12-------
+ * null:11-------
+ * null:10-------
+ * 5:9-------
+ * 5:8-------
+ * 5:7-------
+ * 5:6-------
+ * 5:5-------
+ * 5:4------- 8:4-------
+ * 4:3-------5:3-------6:3-------7:3-------8:3-------
+ * 1:2-------2:2------- 4:2-------5:2-------6:2-------7:2-------8:2-------
+ * 1:1-------2:1-------3:1-------4:1-------5:1-------6:1-------7:1-------8:1-------
+ * 1:0-------2:0-------3:0-------4:0-------5:0-------6:0-------7:0-------8:0-------
+ * { data: 1; levels: 3 } { data: 2; levels: 3 } { data: 3; levels: 2 } { data: 4; levels: 4 }
+ * { data: 5; levels: 10 } { data: 6; levels: 4 } { data: 7; levels: 4 } { data: 8; levels: 5 }
+ */
+ // 优化后insert()
+
+ SkipList2 list2 = new SkipList2();
+ list2.insert2(1);
+ list2.insert2(2);
+ list2.insert2(6);
+ list2.insert2(7);
+ list2.insert2(8);
+ list2.insert2(3);
+ list2.insert2(4);
+ list2.insert2(5);
+ System.out.println();
+ list2.printAll_beautiful();
+
+
+ }
+
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/queue/ArrayQueueDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/ArrayQueueDemo.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/queue/ArrayQueueDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/ArrayQueueDemo.java
index 1ee3f0ef..5e924141 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/queue/ArrayQueueDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/ArrayQueueDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.queue;
+package cn.lastwhisper.atguigu.queue;
/**
* 数组实现队列
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/queue/CircleArrayQueueDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/CircleArrayQueueDemo.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/queue/CircleArrayQueueDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/CircleArrayQueueDemo.java
index 8c00f061..bd6aa057 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/queue/CircleArrayQueueDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/queue/CircleArrayQueueDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.queue;
+package cn.lastwhisper.atguigu.queue;
/**
* 数组实现循环队列
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Maze.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Maze.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Maze.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Maze.java
index 8fe19f72..e496578b 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Maze.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Maze.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.recursion;
+package cn.lastwhisper.atguigu.recursion;
/**
* 递归解决迷宫问题
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Queue8.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Queue8.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Queue8.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Queue8.java
index dfed6385..cec867c9 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Queue8.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Queue8.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.recursion;
+package cn.lastwhisper.atguigu.recursion;
/**
* 递归解决八皇后问题
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Recursion.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Recursion.java
similarity index 96%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Recursion.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Recursion.java
index 2d88f90b..3d253071 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/recursion/Recursion.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/recursion/Recursion.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.recursion;
+package cn.lastwhisper.atguigu.recursion;
/**
* 递归通俗解释:
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/BinarySearch.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/BinarySearch.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/search/BinarySearch.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/BinarySearch.java
index 4baf7db3..c180a504 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/BinarySearch.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/BinarySearch.java
@@ -1,6 +1,6 @@
-package cn.lastwhisper.search;
+package cn.lastwhisper.atguigu.search;
-import cn.lastwhisper.ArrayUtil;
+import cn.lastwhisper.util.ArrayUtil;
import java.util.ArrayList;
import java.util.List;
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/FibonacciSearch.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/FibonacciSearch.java
similarity index 92%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/search/FibonacciSearch.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/FibonacciSearch.java
index d1536407..c9dcfd56 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/FibonacciSearch.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/FibonacciSearch.java
@@ -1,6 +1,6 @@
-package cn.lastwhisper.search;
+package cn.lastwhisper.atguigu.search;
-import cn.lastwhisper.ArrayUtil;
+import cn.lastwhisper.util.ArrayUtil;
/**
*
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/InsertValueSearch.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/InsertValueSearch.java
similarity index 93%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/search/InsertValueSearch.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/InsertValueSearch.java
index 65240a80..904e621f 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/InsertValueSearch.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/InsertValueSearch.java
@@ -1,6 +1,6 @@
-package cn.lastwhisper.search;
+package cn.lastwhisper.atguigu.search;
-import cn.lastwhisper.ArrayUtil;
+import cn.lastwhisper.util.ArrayUtil;
/**
*
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/SeqSearch.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/SeqSearch.java
similarity index 94%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/search/SeqSearch.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/SeqSearch.java
index fe55f2d5..31f1993c 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/search/SeqSearch.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/search/SeqSearch.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.search;
+package cn.lastwhisper.atguigu.search;
/**
* @author cn.lastwhisper
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/DubbleSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/DubbleSort.java
similarity index 95%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/sort/DubbleSort.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/DubbleSort.java
index 982fa7ea..fdfc3682 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/DubbleSort.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/DubbleSort.java
@@ -1,6 +1,6 @@
-package cn.lastwhisper.sort;
+package cn.lastwhisper.atguigu.sort;
-import cn.lastwhisper.ArrayUtil;
+import cn.lastwhisper.util.ArrayUtil;
/**
* @author cn.lastwhisper
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/HeapSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/HeapSort.java
new file mode 100644
index 00000000..c591191a
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/HeapSort.java
@@ -0,0 +1,71 @@
+package cn.lastwhisper.atguigu.sort;
+
+import java.util.Arrays;
+
+/**
+ * 堆排序
+ *
+ * @author cn.lastwhisper
+ */
+public class HeapSort {
+ public static void main(String[] args) {
+ //int[] arr = {4, 6, 8, 5, 9, 58, -10};
+ int[] arr = {4, 6, 8, 5, 9};
+ heapSort(arr);
+ System.out.println("数组:" + Arrays.toString(arr));
+ }
+
+ public static void heapSort(int[] arr) {
+
+ //adjustHeap(arr, 1, arr.length);
+ //System.out.println("第1次" + Arrays.toString(arr)); // 4,9,8,5,6
+
+ //adjustHeap(arr, 0, arr.length);
+ //System.out.println("第2次" + Arrays.toString(arr)); // 9,6,8,5,4
+ // 1. 满二叉树从右向左、从下往上构建大顶堆;完全二叉树从左向右、从下往上构建大顶堆;
+ // i--意味着,从下到上,每一次都是[i,arr.length]的数组(二叉树)进行重构大顶堆
+ // [0,arr.length]重构了数组(二叉树)头部几个元素的大顶堆,同时也会重构下面的二叉树
+ for (int i = arr.length / 2 - 1; i >= 0; i--) {
+ adjustHeap(arr, i, arr.length);
+ }
+ // 2. 交换堆顶元素与末尾元素,调整堆结构
+ for (int j = arr.length - 1; j >= 0; j--) {
+ // 交换
+ int temp = arr[j];
+ arr[j] = arr[0];
+ arr[0] = temp;
+ adjustHeap(arr, 0, j);
+ }
+ }
+
+
+ /**
+ * 将一个数组(二叉树), 调整成一个大顶堆
+ * 功能: 将以i对应的非叶子节点的树调整成大顶堆
+ * 举例 int arr[] = {4, 6, 8, 5, 9}; => i = 1 => adjustHeap => 得到 {4, 9, 8, 5, 6}
+ * 如果我们再次调用 adjustHeap 传入的是 i = 0 => {4, 9, 8, 5, 6} => {9, 6, 8, 5, 4}
+ * @param arr 待调整的数组
+ * @param i 表示非叶子节点在数组中索引
+ * @param length 表示对多少个元素继续调整, length 是在逐渐的减少
+ */
+ public static void adjustHeap(int[] arr, int i, int length) {
+ // 当前i节点
+ int temp = arr[i];
+ // k是i节点的左子节点,k + 1是右子节点
+ for (int k = 2 * i + 1; k < length; k = 2 * k + 1) {
+ // arr[k] < arr[k + 1]左节点小于右节点
+ if (k + 1 < length && arr[k] < arr[k + 1]) {
+ // k指向数值最大的节点
+ k++;
+ }
+ if (arr[k] > temp) {//子节点大于父节点
+ arr[i] = arr[k];//将子节点赋值到父节点
+ i = k;//记录子节点的下标,为了最后 arr[i] = temp;
+ } else {
+ break;
+ }
+ }
+ //i = k; arr[i]此时已经是子节点的位置了,前面父节点已经拿到了子节点的值了,这里要将子节点的值赋为父节点的值
+ arr[i] = temp;
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/InsertSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/InsertSort.java
new file mode 100644
index 00000000..24d2e60a
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/InsertSort.java
@@ -0,0 +1,108 @@
+package cn.lastwhisper.atguigu.sort;
+
+import cn.lastwhisper.util.ArrayUtil;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class InsertSort {
+ public static void main(String[] args) {
+ //int[] arr = {101, 34, 119, 1};
+ //insertSort1(arr); // 插入排序算法实现步骤
+
+ int[] arr = ArrayUtil.generateArrByRandom(100000);
+ // 计算耗时
+ long start = System.currentTimeMillis();
+ insertSort(arr);
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+
+ //System.out.println(Arrays.toString(arr));
+ }
+
+ /**
+ * 插入排序O(n^2)
+ * insertVal < arr[insertIndex降序
+ * insertVal > arr[insertIndex升序
+ * @param arr
+ * @return void
+ */
+ public static void insertSort(int[] arr) {
+ int insertVal;
+ int insertIndex;
+ // 有序列表[0];[1...arr.length]无序列表
+ for (int i = 1; i < arr.length; i++) {
+ // insertVal的意义:缓存无序列表的第一个数,这个数也是待插入有序列表的数
+ insertVal = arr[i];
+ // insertIndex的意义:记录有序列表的最后一个数的下标
+ insertIndex = i - 1;
+ // [insertIndex+1...i-1]后移到[insertIndex+2...i](从前往后移动)
+ while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
+ arr[insertIndex + 1] = arr[insertIndex];
+ insertIndex--;
+ }
+ // insertIndex == i - 1; 说明数组并未后移,无需赋值
+ if (insertIndex != i - 1) {
+ // arr[insertIndex + 1]为待插入位置
+ arr[insertIndex + 1] = insertVal;
+ }
+ }
+ }
+
+ /**
+ * 插入排序的实现步骤
+ *
+ * @param arr
+ * @return void
+ */
+ public static void insertSort1(int[] arr) {
+ // 第1轮
+ // 有序列表{101},无序列表{34, 119, 1}
+ // {101, 34, 119, 1}
+
+ // insertVal的意义:缓存无序列表的第一个数,这个数也是待插入有序列表的数
+ int insertVal = arr[1];
+ // insertIndex的意义:记录有序列表的最后一个数的下标
+ int insertIndex = 1 - 1;
+ // insertIndex >= 0的意义:防止数组越界;
+ // insertVal < arr[insertIndex]的意义:找到insertVal要插入位置的前一个位置
+ // 整个while循环的意义:数组覆盖后移,找到待插入位置的前一个位置
+ while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
+ // 第1轮原数组:{101, 34, 119, 1}
+ // arr[1]=arr[0] {101, 101, 119, 1}
+ arr[insertIndex + 1] = arr[insertIndex];
+ //继续向前
+ insertIndex--;
+ }
+ // arr[0]=insertVal {34, 101, 119, 1}
+ arr[insertIndex + 1] = insertVal;
+
+ System.out.printf("第1轮插入,数组:%s\n", Arrays.toString(arr));
+
+ // 第2轮
+ insertVal = arr[2];
+ insertIndex = 2 - 1;
+ while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
+ arr[insertIndex + 1] = arr[insertIndex];
+ insertIndex--;
+ }
+ arr[insertIndex + 1] = insertVal;
+ System.out.printf("第2轮插入,数组:%s\n", Arrays.toString(arr));
+
+ // 第3轮
+ insertVal = arr[3];
+ insertIndex = 3 - 1;
+ while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
+ // 第三轮原数组:{34, 101, 119, 1}
+ // arr[3]=arr[2] {34, 101, 119, 119}
+ // arr[2]=arr[1] {34, 101, 101, 119}
+ // arr[1]=arr[0] {34, 34, 101, 119}
+ arr[insertIndex + 1] = arr[insertIndex];
+ insertIndex--;
+ }
+ arr[insertIndex + 1] = insertVal;
+ System.out.printf("第3轮插入,数组:%s\n", Arrays.toString(arr));
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/MergeSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/MergeSort.java
new file mode 100644
index 00000000..dfe39e34
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/MergeSort.java
@@ -0,0 +1,79 @@
+package cn.lastwhisper.atguigu.sort;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class MergeSort {
+
+ public static void main(String[] args) {
+ int[] arr = {9, 8, 7, 6, 5, 4, 3, 2, 1};
+// int[] arr = ArrayUtil.generateArrByRandom(10000000);// 1443 ms
+ // 计算耗时
+ long start = System.currentTimeMillis();
+ mergeSort(arr, 0, arr.length - 1);
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+
+ System.out.println(Arrays.toString(arr));
+ }
+
+ /**
+ * 归并排序
+ * 分
+ *
+ * @param arr 排序的原始数组
+ * @param left 左边有序序列的初始索引
+ * @param right 右边索引
+ */
+ public static void mergeSort(int[] arr, int left, int right) {
+ if (left < right) {
+ int mid = (left + right) / 2;
+ mergeSort(arr, left, mid); // 向左分
+ mergeSort(arr, mid + 1, right); // 向右分
+ merge(arr, left, mid, right);// 治
+ }
+ }
+
+ /**
+ * 治
+ *
+ * @param arr 排序的原始数组 arr[left...mid] arr[mid+1...right]
+ * @param left 左边有序序列的初始索引
+ * @param mid 中间索引
+ * @param right 右边索引
+ */
+ public static void merge(int[] arr, int left, int mid, int right) {
+ //开辟额外大集合,设置指针
+ int[] temp = new int[right - left + 1];
+
+ int i = left; //左边有序序列的初始索引
+ int j = mid + 1; // 右边有序序列的初始化序索引
+ int tempIdx = 0; // 指向temp数组的当前位置
+
+ // 1)、将左右两边(有序)的数据按照规则填充到temp数组,任意一边处理完毕为止
+ while (i <= mid && j <= right) {
+ if (arr[i] < arr[j]) {
+ // 左小于右,将左数组第i个元素copy到temp数组的第t个位置
+ temp[tempIdx++] = arr[i++];
+ } else {
+ // 右小于或等于左,将右数组第j个元素copy到temp数组的第t个位置
+ temp[tempIdx++] = arr[j++];
+ }
+ }
+
+ // 2)、把有剩余数据的一边的数据依次填充到temp
+ while (i <= mid) {// 说明 右数组还有剩余元素
+ temp[tempIdx++] = arr[i++];
+ }
+ while (j <= right) {// 说明 右数组还有剩余元素
+ temp[tempIdx++] = arr[j++];
+ }
+
+ // 3)、将temp数组的数据copy到arr,注意从本次数组起始位置left,开始复制
+ for (int k = left; k < temp.length; k++) {
+ arr[k] = temp[k];
+ }
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort.java
new file mode 100644
index 00000000..45d903c9
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort.java
@@ -0,0 +1,125 @@
+package cn.lastwhisper.atguigu.sort;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+@Deprecated
+public class QuickSort {
+
+ public static void main(String[] args) {
+ //int[] arr = {-9, 78, 0, 23, -567, 70};
+ //int[] arr = {-9, 78, 0, 23, 60, 70};
+ //int[] arr = {9, 0, -567};
+ int[] arr = {49, 38, 65, 97, 76, 13, 27};
+
+ //int[] arr = ArrayUtil.generateArrByRandom(10000000);//耗时:1519 ms
+ // 计算耗时
+ long start = System.currentTimeMillis();
+ //quickSort(arr, 0, arr.length - 1);
+ qSort(arr, 0, arr.length - 1);
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+
+ System.out.println(Arrays.toString(arr));
+ }
+
+ public static void qSort(int[] arr, int head, int tail) {
+ if (head >= tail || arr == null || arr.length <= 1) {
+ return;
+ }
+ //定义俩指针 用于移动
+ int left = head;
+ int right = tail;
+ int pivot = arr[head]; //基准值,也可以arr[(head + tail) / 2]
+
+ while (left <= right) {
+ while (arr[left] < pivot) { //左指针先走,找到大于等于基准数的停止
+ ++left;
+ }
+ while (arr[right] > pivot) { //右指针后走,找到小于等于基准数的停止
+ --right;
+ }
+ if (left < right) {
+ //交换arr[left]和arr[right]的位置
+ int t = arr[left];
+ arr[left] = arr[right];
+ arr[right] = t;
+ //继续遍历
+ ++left;
+ --right;
+ } else if (left == right) {
+ //遍历完,错开两指针,用于退出循环
+ ++left;
+ //break;
+ }
+ }
+
+ qSort(arr, head, right);
+ qSort(arr, left, tail);
+ }
+
+
+ /**
+ * 快速排序,选取数组中间的值
+ * int pivot = arr[(left + right) / 2];
+ *
+ * @param arr
+ * @param left
+ * @param right
+ * @return void
+ */
+ public static void quickSort1(int[] arr, int left, int right) {
+ int l = left; // 左下标
+ int r = right; // 右下标
+ int temp;
+ // 中轴
+ int pivot = arr[(left + right) / 2];
+ // while循环的目的:小于或等于pivot的放左边,大于或等于pivot的放右边
+ while (l < r) {
+ // 在pivot左边找比pivot大的值的下标l
+ while (arr[l] < pivot) { //找到arr[1]=98 >pivot=0
+ l++;
+ }
+ // 在pivot右边找比pivot小的值的下标r
+ while (arr[r] > pivot) { //找到arr[4]=-567 < pivot=0
+ r--;
+ }
+ // 如果l>=r说明pivot左右两边的值,已经满足:
+ // 小于或等于pivot的放左边,大于或等于pivot的放右边 ——递归结束条件
+ if (l >= r) {
+ break;
+ }
+ // 交换
+ temp = arr[l];
+ arr[l] = arr[r];
+ arr[r] = temp;
+ // 如果交换完后,发现arr[l] == pivot,r--,前移 退出循环
+ if (arr[l] == pivot) {
+ r--;
+ }
+
+ // 如果交换完后,发现arr[r] == pivot,l++,后移 退出循环
+ if (arr[r] == pivot) {
+ l++;
+ }
+ }
+
+ // 第二步
+
+ // 如果l==r,必须l++,r--,否则会栈溢出
+ if (l == r) {
+ l = l + 1;
+ r = r - 1;
+ }
+ // 向左递归
+ if (left < r) {
+ quickSort1(arr, left, r);
+ }
+ // 向右递归
+ if (right > l) {
+ quickSort1(arr, l, right);
+ }
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort2.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort2.java
new file mode 100644
index 00000000..0c4a1124
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/QuickSort2.java
@@ -0,0 +1,58 @@
+package cn.lastwhisper.atguigu.sort;
+
+/**
+ * @author lastwhisper
+ */
+public class QuickSort2 {
+ public static void main(String[] args) {
+// int[] arr = {7, 3, 2, 8, 1, 9, 5, 4, 6};
+ //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 0};//为什么left++和right--条件里面要加 left <= right 限定
+ //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 10};
+// int arr[] = {7, 3, 2, 6, 8, 1, 9, 5, 4, 6, 10, 6, 6}; // 为什么不取等 arr[right] > pivot
+// int[] arr = {4, 6}; //小bug测试 // 为什么while (left <= right)里面要取等
+
+// int[] arr = {2, 10, 8, 22, 34, 5, 12, 28, 21, 11};
+ int[] arr = {49, 38, 65, 97, 76, 13, 27};
+// int[] arr = {2, 10, 8, 1000};
+ sort(arr, 0, arr.length - 1);
+ print(arr);
+ }
+
+ private static void sort(int[] arr, int left, int right) {
+ if (left >= right) return;
+ int mid = partition(arr, left, right);
+ sort(arr, left, mid - 1);
+ sort(arr, mid + 1, right);
+ }
+
+ /**
+ * @param arr 待分区数组
+ * @param left 左边界
+ * @param right 右边界
+ */
+ private static int partition(int[] arr, int left, int right) {
+ int pivot = arr[right];
+ int start = left, end = right - 1;
+ //
+ while (start <= end) {
+ while (start <= end && arr[start] <= pivot) start++;
+ while (start <= end && arr[end] > pivot) end--;
+ if (start < end) swap(arr, start, end);
+ }
+ // 此时的start一定>=pivot(right),所以需要交互
+ swap(arr, start, right);
+ return start;
+ }
+
+ private static void swap(int[] arr, int i, int j) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+
+ private static void print(int[] arr) {
+ for (int value : arr) {
+ System.out.print(value + "\t");
+ }
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/RadixSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/RadixSort.java
new file mode 100644
index 00000000..b55a46a2
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/RadixSort.java
@@ -0,0 +1,152 @@
+package cn.lastwhisper.atguigu.sort;
+
+import cn.lastwhisper.util.ArrayUtil;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class RadixSort {
+
+ public static void main(String[] args) {
+ // 算法实现步骤
+ //int[] arr = {53, 3, 542, 748, 14, 214};
+ //int[] arr = {3, 205, 14};
+ //radixSortStudy(arr);
+
+ // 计算耗时
+ // 占用内存 10000000 * 10 * 4 /1024 / 1024 /1024 = 0.3725290298461914
+ int[] arr = ArrayUtil.generateArrByRandom(10000000);
+ long start = System.currentTimeMillis();
+ radixSort(arr);
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+
+ //System.out.println(Arrays.toString(arr));
+ }
+
+ /**
+ * 基数排序,桶排序的扩展
+ *
+ * @param arr
+ * @return void
+ */
+ public static void radixSort(int[] arr) {
+
+ int[][] bucket = new int[10][arr.length];
+ // 桶元素计数器,记录每个桶中存放了多少数据
+ int[] bucketElementCount = new int[10];
+ // 原arr下标
+ int arrIndex;
+ // 除数
+ int divisor = 1;
+ // 最大值
+ int max = arr[0];
+ // 由于基数排序次数由最大数值的位数决定,所以需要求最大值
+ for (int i = 1; i < arr.length; i++) {
+ if (max < arr[i]) {
+ max = arr[i];
+ }
+ }
+ // 最大值得位数,即排序次数
+ int maxLength = (max + "").length();
+ for (int f = 0; f < maxLength; f++) {
+ for (int i = 0; i < arr.length; i++) {
+ // digitOfElement对应放在哪个bucket中
+ int digitOfElement = arr[i] / divisor % 10;
+ // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
+ bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
+ // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
+ bucketElementCount[digitOfElement]++;
+ }
+
+ arrIndex = 0;
+ // 将桶中数据放回原数组
+ for (int i = 0; i < bucketElementCount.length; i++) {
+ // 对应桶中有数据
+ if (bucketElementCount[i] != 0) {
+ for (int j = 0; j < bucketElementCount[i]; j++) {
+ arr[arrIndex++] = bucket[i][j];
+ }
+ }
+ // 将桶元素计数器清空
+ bucketElementCount[i] = 0;
+ }
+ divisor *= 10;
+ }
+
+ }
+
+ /**
+ * 桶排序算法实现步骤
+ *
+ * @param arr
+ */
+ public static void radixSortStudy(int[] arr) {
+ //
+ int[][] bucket = new int[10][arr.length];
+ // 桶元素计数器,记录每个桶中存放了多少数据
+ int[] bucketElementCount = new int[10];
+ // 原arr下标
+ int arrIndex;
+
+ for (int i = 0; i < arr.length; i++) {
+ // digitOfElement对应放在哪个bucket中
+ int digitOfElement = arr[i] % 10;
+ // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
+ bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
+ // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
+ bucketElementCount[digitOfElement]++;
+ }
+
+ arrIndex = 0;
+ // 将桶中数据放回原数组
+ for (int i = 0; i < bucketElementCount.length; i++) {
+ // 对应桶中有数据
+ if (bucketElementCount[i] != 0) {
+ for (int j = 0; j < bucketElementCount[i]; j++) {
+ arr[arrIndex++] = bucket[i][j];
+ }
+ }
+ // 将桶元素计数器清空
+ bucketElementCount[i] = 0;
+ }
+
+ System.out.println("第1轮,对个位的排序处理 arr =" + Arrays.toString(arr));
+
+ for (int i = 0; i < arr.length; i++) {
+ // digitOfElement对应放在哪个bucket中
+ int digitOfElement = arr[i] / 10 % 10;
+ // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
+ bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
+ // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
+ bucketElementCount[digitOfElement]++;
+ }
+
+ arrIndex = 0;
+ // 将桶中数据放回原数组
+ for (int i = 0; i < bucketElementCount.length; i++) {
+ // 对应桶中有数据
+ if (bucketElementCount[i] != 0) {
+ for (int j = 0; j < bucketElementCount[i]; j++) {
+ arr[arrIndex++] = bucket[i][j];
+ }
+ }
+ // 将桶元素计数器清空
+ bucketElementCount[i] = 0;
+ }
+
+ System.out.println("第2轮,对个位的排序处理 arr =" + Arrays.toString(arr));
+
+ //for (int i = 0; i < bucket.length; i++) {
+ // for (int j = 0; j < bucket[0].length; j++) {
+ // System.out.printf("%d\t", bucket[i][j]);
+ // }
+ // System.out.println();
+ //}
+
+ }
+
+
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/SelectSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/SelectSort.java
new file mode 100644
index 00000000..14f8afb9
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/SelectSort.java
@@ -0,0 +1,82 @@
+package cn.lastwhisper.atguigu.sort;
+
+import cn.lastwhisper.util.ArrayUtil;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class SelectSort {
+
+ public static void main(String[] args) {
+ //int[] arr = {101, 34, 119, 1};
+ //selectSort1(arr);
+ //System.out.println(Arrays.toString(arr));
+
+ int[] arr = ArrayUtil.generateArrByRandom(100000);
+ // 计算耗时
+ long start = System.currentTimeMillis();
+ selectSort(arr);
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+ }
+
+ /**
+ * 选择排序O(n^2)
+ *
+ * @param arr
+ * @return void
+ */
+ public static void selectSort(int[] arr) {
+ for (int i = 0; i < arr.length; i++) {
+ int min = arr[i];
+ int minIndex = i;
+ // 找出[1+i...arr.length]范围内的最小值,和最小值索引
+ for (int j = i + 1; j < arr.length; j++) {
+ if (min > arr[j]) {
+ min = arr[j];
+ minIndex = j;
+ }
+ }
+ // 交换最小值与第i个数的位置
+ if (minIndex != i) {
+ arr[minIndex] = arr[i];
+ arr[i] = min;
+ }
+ }
+ }
+
+ /**
+ * 算法的实现步骤
+ *
+ * @param arr
+ * @return void
+ */
+ public static void selectSort1(int[] arr) {
+ // 第1轮 {101, 34, 119, 1}
+
+ // 1、找最小值
+ // 最小值
+ int min = arr[0];
+ // 最小值索引
+ int minIndex = 0;
+ // {101, 34, 119, 1} 我们假设待排序数组第一个元素就是最小值,即min=arr[0],minIndex=0
+ // 经过遍历后我们发现 min=1,minIndex=3
+ for (int j = 0 + 1; j < arr.length; j++) {
+ // 找最小的数
+ if (min > arr[j]) {
+ min = arr[j];
+ minIndex = j;
+ }
+ }
+ // 2、交换。minIndex是最小值所在位置,min是最小值
+ if (minIndex != 0) {
+ arr[minIndex] = arr[0];
+ arr[0] = min;
+ }
+
+ System.out.printf("第1轮选择,数组:%s", Arrays.toString(arr));
+ }
+
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/ShellSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/ShellSort.java
new file mode 100644
index 00000000..edd5254a
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/ShellSort.java
@@ -0,0 +1,132 @@
+package cn.lastwhisper.atguigu.sort;
+
+import java.util.Arrays;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class ShellSort {
+ public static void main(String[] args) {
+ int[] arr = {8, 9, 1, 7, 2, 3, 5, 4, 6, 0};
+ //int[] arr = ArrayUtil.generateArrByRandom(100000);
+ // 计算耗时
+ long start = System.currentTimeMillis();
+ //shellSort1(arr); // 10490 ms
+ shellSort2(arr); // 10490 ms
+ long end = System.currentTimeMillis();
+ System.out.println("耗时:" + (end - start) + " ms");
+
+ System.out.printf("希尔排序(交换法),数组:%s\n", Arrays.toString(arr));
+ }
+
+
+ /**
+ * 希尔排序(位移法)(插入排序)
+ *
+ * @param arr
+ * @return void
+ */
+ public static void shellSort2(int[] arr) {
+ // {8, 9, 1, 7, 2, 3, 5, 4, 6, 0}
+ int gap = arr.length / 2;
+ int j;
+ int temp;
+ while (gap > 0) {
+ //gap=5,2,1,0
+ // i=5——》{0,5}
+ // i=6——》{1,6}
+ // i=7——》{2,7}
+ // i=8——》{3,8}
+ // i=9——》{4,9}
+ // 对每个数组进行插入排序;由于每个数组并不是真的存在的数组,而是一个大数组
+ // 所以通过gap进行取值
+ for (int i = gap; i < arr.length; i++) {
+ j = i; // 缓存每个数组的起始下标
+ temp = arr[i]; // 缓存每个数组的起始下标的数值
+ if (temp < arr[j - gap]) {
+ while (j - gap >= 0 && temp < arr[j - gap]) {
+ // 从前往后移动
+ arr[j] = arr[j - gap];
+ j = j - gap;
+ }
+ //
+ arr[j] = temp;
+ }
+ }
+ gap = gap / 2;
+ }
+ }
+
+ /**
+ * 希尔排序(交换法)
+ *
+ * @param arr
+ * @return void
+ */
+ public static void shellSort1(int[] arr) {
+ // 第1轮 {8, 9, 1, 7, 2, 3, 5, 4, 6, 0}
+ // 增量 gap=length/2
+ int gap = arr.length / 2;
+ int temp;
+ while (gap > 0) {
+ for (int i = gap; i < arr.length; i++) {
+ // 交换
+ for (int j = i - gap; j >= 0; j -= gap) {
+ if (arr[j] > arr[j + gap]) {
+ temp = arr[j + gap];
+ arr[j + gap] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ gap = gap / 2;
+ }
+ }
+
+ /**
+ * 交换法希尔排序
+ *
+ * @param arr
+ * @return void
+ */
+ public static void shellSortStudy(int[] arr) {
+ // 第1轮 [8, 9, 1, 7, 2, 3, 5, 4, 6, 0]
+ // 增量 gap=length/2
+ int temp;
+ for (int i = 5; i < arr.length; i++) {
+ // 交换
+ for (int j = i - 5; j >= 0; j -= 5) {
+ if (arr[j] > arr[j + 5]) {
+ temp = arr[j + 5];
+ arr[j + 5] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ System.out.printf("第1轮插入,数组:%s\n", Arrays.toString(arr));
+ // 第二轮 [3, 5, 1, 6, 0, 8, 9, 4, 7, 2]
+ for (int i = 2; i < arr.length; i++) {
+ // 交换
+ for (int j = i - 2; j >= 0; j -= 2) {
+ if (arr[j] > arr[j + 2]) {
+ temp = arr[j + 2];
+ arr[j + 2] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ System.out.printf("第2轮插入,数组:%s\n", Arrays.toString(arr));
+ // 第三轮 [0, 2, 1, 4, 3, 5, 7, 6, 9, 8]
+ for (int i = 1; i < arr.length; i++) {
+ // 交换
+ for (int j = i - 1; j >= 0; j -= 1) {
+ if (arr[j] > arr[j + 1]) {
+ temp = arr[j + 1];
+ arr[j + 1] = arr[j];
+ arr[j] = temp;
+ }
+ }
+ }
+ System.out.printf("第3轮插入,数组:%s\n", Arrays.toString(arr));
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/TimeComplexity.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/TimeComplexity.java
similarity index 96%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/sort/TimeComplexity.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/TimeComplexity.java
index de4f13a3..36734634 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/TimeComplexity.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/TimeComplexity.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.sort;
+package cn.lastwhisper.atguigu.sort;
/**
* 时间复杂度举例
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap.java
new file mode 100644
index 00000000..5e3cb8e0
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap.java
@@ -0,0 +1,100 @@
+package cn.lastwhisper.atguigu.sort.heap;
+
+import java.util.Arrays;
+
+public class Heap {
+ private int[] a; // 数组,从下标 1 开始存储数据
+ private int n; // 堆可以存储的最大数据个数
+ private int count; // 堆中已经存储的数据个数
+
+ public Heap(int capacity) {
+ a = new int[capacity + 1];
+ n = capacity;
+ count = 0;
+ }
+
+ /**
+ * 插入
+ */
+ public void insert(int data) {
+ if (count >= n) return; // 堆满了
+ ++count;
+ a[count] = data;
+ int i = count;
+ while (i / 2 > 0 && a[i] > a[i / 2]) { // 自下往上堆化
+ swap(a, i, i / 2); // swap() 函数作用:交换下标为 i 和 i/2 的两个元素
+ i = i / 2;
+ }
+ }
+
+ /**
+ * 删除堆顶
+ */
+ public void removeMax() {
+ if (count == 0) return; // 堆中没有数据
+ a[1] = a[count];
+ --count;
+ heapify(a, count, 1);
+ }
+
+ /**
+ * 堆化大顶堆
+ * 自上往下堆化
+ *
+ * @param arr 数组
+ * @param n 堆中元素个数
+ * @param i 待堆化的元素
+ */
+ private static void heapify(int[] arr, int n, int i) {
+ while (true) {
+ // 待堆化元素、左、右子树最大值的下标
+ int maxPos = i;
+ // 待堆化元素小于左子树
+ if (i * 2 <= n && arr[i] < arr[i * 2]) {
+ maxPos = i * 2;
+ }
+ // 待堆化元素左子树小于右子树,
+ if (i * 2 + 1 <= n && arr[maxPos] < arr[i * 2 + 1]) {
+ maxPos = i * 2 + 1;
+ }
+ // 最大元素是自己无需向下堆化
+ if (maxPos == i) break;
+ // 最大元素不是自己,交互值
+ swap(arr, i, maxPos);
+ // 将被交互的元素继续向下堆化
+ i = maxPos;
+ }
+ }
+
+ private static void buildHeap(int[] a, int n) {
+ // 对非叶子节点进行,自上往下堆化
+ for (int i = n / 2; i >= 1; --i) {
+ heapify(a, n, i);
+ }
+ }
+
+ // n 表示数据的个数,数组 a 中的数据从下标 1 到 n 的位置。
+ public static void sort(int[] a, int n) {
+ buildHeap(a, n);
+ int k = n;
+ while (k > 1) {
+ swap(a, 1, k);
+ --k;
+ heapify(a, k, 1);
+ }
+ }
+
+ private static void swap(int[] arr, int i, int j) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+
+ public static void main(String[] args) {
+ int[] arr = new int[]{-99999, 9, 8, 7, 6, 5, 4, 3, 2, 1};
+ System.out.println(Arrays.toString(arr));
+ Heap.sort(arr, arr.length - 1);
+ System.out.println(Arrays.toString(arr));
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap2.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap2.java
new file mode 100644
index 00000000..2340e830
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/Heap2.java
@@ -0,0 +1,69 @@
+package cn.lastwhisper.atguigu.sort.heap;
+
+import java.util.Arrays;
+
+public class Heap2 {
+
+
+ /**
+ * 堆化大顶堆
+ * 自上往下堆化
+ *
+ * @param arr 数组
+ * @param n 堆中元素个数
+ * @param i 待堆化的元素
+ */
+ private static void heapify(int[] arr, int n, int i) {
+ while (true) {
+ // 待堆化元素、左、右子树最大值的下标
+ int maxPos = i;
+ // 待堆化元素小于左子树
+ if (i * 2 + 1 <= n && arr[i] < arr[i * 2 + 1]) {
+ maxPos = i * 2 + 1;
+ }
+ // 待堆化元素左子树小于右子树,
+ if (i * 2 + 2 <= n && arr[maxPos] < arr[i * 2 + 2]) {
+ maxPos = i * 2 + 2;
+ }
+ // 最大元素是自己无需向下堆化
+ if (maxPos == i) break;
+ // 最大元素不是自己,交互值
+ swap(arr, i, maxPos);
+ // 将被交互的元素继续向下堆化
+ i = maxPos;
+ }
+ }
+
+ private static void buildHeap(int[] a, int n) {
+ // 对非叶子节点进行,自上往下堆化
+ for (int i = n / 2 - 1; i >= 0; --i) {
+ heapify(a, n, i);
+ }
+ }
+
+ public static void sort(int[] arr, int n) {
+ // 1. 构建大顶堆
+ buildHeap(arr, n);
+ int disorder = n;
+ // 2. 交换堆顶元素与末尾元素,调整堆结构
+ while (disorder > 0) {
+ swap(arr, 0, disorder);
+ disorder--;
+ heapify(arr, disorder, 0);
+ }
+ }
+
+ private static void swap(int[] arr, int i, int j) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+
+ public static void main(String[] args) {
+ int[] arr = new int[]{9, 10, 7, 6, 5, 4, 3, 2, 1};
+ System.out.println(Arrays.toString(arr));
+ Heap2.sort(arr, arr.length - 1);
+ System.out.println(Arrays.toString(arr));
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/HeapOperator.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/HeapOperator.java
new file mode 100644
index 00000000..91466e9d
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sort/heap/HeapOperator.java
@@ -0,0 +1,87 @@
+package cn.lastwhisper.atguigu.sort.heap;
+
+import java.util.Arrays;
+
+/**
+ * 对于二叉堆,如下有几种操作:
+ * 插入节点
+ * 删除节点
+ * 构建二叉堆
+ *
+ * @author cunchang
+ * @date 2022/6/12 11:34 PM
+ */
+public class HeapOperator {
+
+
+ /**
+ * 上浮调整
+ * @param array 待调整的堆
+ */
+ public static void upAdjust(int[] array) {
+ int childIndex = array.length - 1;
+ // child = 2*parent+1,则 parent = (child - 1) / 2
+ int parentIndex = (childIndex - 1) / 2;
+ // temp保存插入的叶子节点值,用于最后的赋值
+ int temp = array[childIndex];
+ while (childIndex > 0 && temp < array[parentIndex]) {
+ //无需真正交换,单向赋值即可
+ array[childIndex] = array[parentIndex];
+ childIndex = parentIndex;
+ parentIndex = (parentIndex - 1) / 2;
+ }
+ array[childIndex] = temp;
+ }
+
+
+ /**
+ * 下沉调整
+ * @param array 待调整的堆
+ * @param parentIndex 要下沉的父节点
+ * @param length 堆的有效大小
+ */
+ public static void downAdjust(int[] array, int parentIndex, int length) {
+ // temp保存父节点值,用于最后的赋值
+ int temp = array[parentIndex];
+ int childIndex = 2 * parentIndex + 1;
+ while (childIndex < length) {
+ // 如果有右孩子,且右孩子小于左孩子的值,则定位到右孩子
+ if (childIndex + 1 < length && array[childIndex + 1] < array[childIndex]) {
+ childIndex++;
+ }
+ // 如果父节点小于任何一个孩子的值,直接跳出
+ if (temp <= array[childIndex]) {
+ break;
+ }
+ //无需真正交换,单向赋值即可
+ array[parentIndex] = array[childIndex];
+ parentIndex = childIndex;
+ childIndex = 2 * childIndex + 1;
+ }
+ array[parentIndex] = temp;
+ }
+
+
+ /**
+ * 构建堆
+ *
+ * @param array 待调整的堆
+ */
+ public static void buildHeap(int[] array) {
+ // 从最后一个非叶子节点开始,依次下沉调整
+ for (int i = array.length / 2; i >= 0; i--) {
+ downAdjust(array, i, array.length - 1);
+ }
+ }
+
+ public static void main(String[] args) {
+ int[] array = new int[]{1, 3, 2, 6, 5, 7, 8, 9, 10, 0};
+ upAdjust(array);
+ System.out.println(Arrays.toString(array));
+ array = new int[]{7, 1, 3, 10, 5, 2, 8, 9, 6};
+ buildHeap(array);
+ System.out.println(Arrays.toString(array));
+ }
+
+
+}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/BestSpmatrix.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/BestSpmatrix.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/BestSpmatrix.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/BestSpmatrix.java
index 95b776e9..e1fd05b9 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/BestSpmatrix.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/BestSpmatrix.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.sparsematrix;
+package cn.lastwhisper.atguigu.sparsematrix;
/**
* @author cn.lastwhisper
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/SparseMatrix.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/SparseMatrix.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/SparseMatrix.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/SparseMatrix.java
index f3035474..50f30722 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sparsematrix/SparseMatrix.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/sparsematrix/SparseMatrix.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.sparsematrix;
+package cn.lastwhisper.atguigu.sparsematrix;
/**
* 稀疏矩阵压缩与还原
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/ArrayStackDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/ArrayStackDemo.java
similarity index 90%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/stack/ArrayStackDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/ArrayStackDemo.java
index 077f2614..5a20dc99 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/ArrayStackDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/ArrayStackDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.stack;
+package cn.lastwhisper.atguigu.stack;
/**
* @author cn.lastwhisper
@@ -52,8 +52,7 @@ public int pop() {
if (n > 0 && n == (arr.length / 4)) {
resize(n / 2);
}
- int data = arr[--n];
- return data;
+ return arr[--n];
}
// 查看栈顶元素
public int peek(){
@@ -69,9 +68,7 @@ public int size() {
// resize
public void resize(int maxSize) {
int[] newArr = new int[maxSize];
- for (int i = 0; i < size(); i++) {
- newArr[i] = arr[i];
- }
+ if (size() >= 0) System.arraycopy(arr, 0, newArr, 0, size());
this.arr = newArr;
}
}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/InCalculator.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/InCalculator.java
similarity index 96%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/stack/InCalculator.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/InCalculator.java
index d2565072..1288660c 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/InCalculator.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/InCalculator.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.stack;
+package cn.lastwhisper.atguigu.stack;
/**
* 中缀表达式
@@ -53,11 +53,11 @@ public static void main(String[] args) {
keepNum += ch - 48;
// ch是否是最后一个字符
if (index == expression.length() - 1) {
- numStack.push(Integer.valueOf(keepNum));
+ numStack.push(Integer.parseInt(keepNum));
} else {
// 如果后一位是运算符,则将当前keepNum入栈
if (operStack.isOper(expression.substring(index + 1, index + 2).charAt(0))) {
- numStack.push(Integer.valueOf(keepNum));
+ numStack.push(Integer.parseInt(keepNum));
// 每次清空多位数
keepNum = "";
}
@@ -104,8 +104,7 @@ public int pop() {
if (n > 0 && n == (arr.length / 4)) {
resize(arr.length / 2);
}
- int data = arr[--n];
- return data;
+ return arr[--n];
}
/**
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/SuCalculator.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/SuCalculator.java
similarity index 98%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/stack/SuCalculator.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/SuCalculator.java
index e915c6cc..18d7afa0 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/stack/SuCalculator.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/stack/SuCalculator.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.stack;
+package cn.lastwhisper.atguigu.stack;
import java.util.ArrayList;
import java.util.List;
@@ -103,7 +103,7 @@ public static String infixConverSufix(String infixExpression) {
* 中缀表达式String转中缀表达式Lsit
*
* @param infixExpression
- * @return java.util.List
+ * @return java.array.List
*/
public static List infixStrConvertInfixList(String infixExpression) {
List infixList = new ArrayList<>();
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ArrBinaryTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ArrBinaryTreeDemo.java
similarity index 86%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ArrBinaryTreeDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ArrBinaryTreeDemo.java
index e6490716..59ca8711 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ArrBinaryTreeDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ArrBinaryTreeDemo.java
@@ -1,6 +1,6 @@
-package cn.lastwhisper.tree;
+package cn.lastwhisper.atguigu.tree;
-import cn.lastwhisper.ArrayUtil;
+import cn.lastwhisper.util.ArrayUtil;
/**
* @author cn.lastwhisper
@@ -12,12 +12,12 @@ public static void main(String[] args) {
ArrBinaryTree arrBinaryTree = new ArrBinaryTree(arr);
System.out.println("先序:");
arrBinaryTree.preOrder(0);//1 2 4 5 3 6 7
- System.out.println();
- System.out.println("中序:");
- arrBinaryTree.infixOrder(0);
- System.out.println();
- System.out.println("后序:");
- arrBinaryTree.postOrder(0);
+ //System.out.println();
+ //System.out.println("中序:");
+ //arrBinaryTree.infixOrder(0);
+ //System.out.println();
+ //System.out.println("后序:");
+ //arrBinaryTree.postOrder(0);
}
}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/BinaryTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/BinaryTreeDemo.java
similarity index 92%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/tree/BinaryTreeDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/BinaryTreeDemo.java
index 30f49d76..50ff9a40 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/BinaryTreeDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/BinaryTreeDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.tree;
+package cn.lastwhisper.atguigu.tree;
import org.junit.Test;
@@ -9,6 +9,7 @@
/**
* 二叉树的遍历:先序、中序、后序
* 二叉树的查找:查找指定节点
+ *
* @author cn.lastwhisper
*/
public class BinaryTreeDemo {
@@ -114,7 +115,7 @@ public int height() {
}
/**
- * 递归遍历直到叶子结点
+ * 递归遍历直到叶子节点
*
* @param node
* @return int
@@ -150,7 +151,7 @@ public int size(HeroNode node) {
}
}
- // 返回某节点的父结点
+ // 返回某节点的父节点
// 先序遍历查找
@@ -182,7 +183,7 @@ public HeroNode postOrderSearch(int no) {
/**
* 先序遍历(递归)
- * 先访问根结点,再先序遍历左子树,再先序遍历右子树
+ * 先访问根节点,再先序遍历左子树,再先序遍历右子树
*
* @param node
*/
@@ -196,7 +197,8 @@ public void preOrder(HeroNode node) {
/**
* 中序遍历(递归)
- * 先遍历左子树,再访问根结点,再中序遍历右子树
+ * 先遍历左子树,再访问根节点,再中序遍历右子树
+ *
* @param node
*/
public void infixOrder(HeroNode node) {
@@ -209,7 +211,8 @@ public void infixOrder(HeroNode node) {
/**
* 后序遍历(递归)
- * 先遍历左子树,再后序遍历右子树,再访问根结点
+ * 先遍历左子树,再后序遍历右子树,再访问根节点
+ *
* @param node
*/
public void postOrder(HeroNode node) {
@@ -300,7 +303,7 @@ public String toString() {
* @return cn.cn.lastwhisper.tree.HeroNode
*/
public HeroNode preOrderSearch(int no) {
- // 1)、判断当前结点是否为查找的结点
+ // 1)、判断当前节点是否为查找的节点
if (this.no == no) {
return this;
}
@@ -335,7 +338,7 @@ public HeroNode infixOrderSearch(int no) {
if (result != null) {
return result;
}
- // 2)、判断当前结点是否为查找的结点
+ // 2)、判断当前节点是否为查找的节点
if (this.no == no) {
return this;
}
@@ -356,7 +359,7 @@ public HeroNode postOrderSearch(int no) {
if (result != null) {
return result;
}
- // 2)、判断该结点是否是寻找的节点
+ // 2)、判断该节点是否是寻找的节点
if (this.no == no) {
return this;
}
@@ -369,21 +372,21 @@ public HeroNode postOrderSearch(int no) {
// 递归删除节点
public void clear(int no) {
- // 1)、判断当前结点的左结点是否满足条件
+ // 1)、判断当前节点的左节点是否满足条件
if (this.left != null && this.left.no == no) {
this.left = null;
return;
}
- // 2)、判断当前结点的右结点是否满足条件
+ // 2)、判断当前节点的右节点是否满足条件
if (this.right != null && this.right.no == no) {
this.right = null;
return;
}
- // 3)、当前结点的左右结点不满足条件,递归左结点
+ // 3)、当前节点的左右节点不满足条件,递归左节点
if (this.left != null) {
this.left.clear(no);
}
- // 4)、当前结点的左右结点不满足条件,递归右结点
+ // 4)、当前节点的左右节点不满足条件,递归右节点
if (this.right != null) {
this.right.clear(no);
}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ThreadingBinaryTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ThreadingBinaryTreeDemo.java
similarity index 76%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ThreadingBinaryTreeDemo.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ThreadingBinaryTreeDemo.java
index a03977a4..b087fc40 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/ThreadingBinaryTreeDemo.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/ThreadingBinaryTreeDemo.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.tree;
+package cn.lastwhisper.atguigu.tree;
/**
* 线索化二叉树
@@ -6,7 +6,7 @@
*/
public class ThreadingBinaryTreeDemo {
public static void main(String[] args) {
- // 创建结点
+ // 创建节点
ThreadingHeroNode root = new ThreadingHeroNode(1, "宋江");
ThreadingHeroNode heroNode2 = new ThreadingHeroNode(3, "吴用");
ThreadingHeroNode heroNode3 = new ThreadingHeroNode(6, "卢俊义");
@@ -26,10 +26,10 @@ public static void main(String[] args) {
ThreadingBinaryTree.preOrderThreading();
//System.out.println("===============中序线索化二叉树================");
//ThreadingBinaryTree.infixOrderThreading();
- System.out.println("===============前驱、后继结点================");
+ System.out.println("===============前驱、后继节点================");
ThreadingHeroNode heroNode5Left = heroNode5.getLeft();// 3
ThreadingHeroNode heroNode5Right = heroNode5.getRight(); //
- System.out.println("10号结点的前驱:" + heroNode5Left + "\n10号结点的后继:" + heroNode5Right);
+ System.out.println("10号节点的前驱:" + heroNode5Left + "\n10号节点的后继:" + heroNode5Right);
System.out.println("===============先序遍历线索化二叉树================");
ThreadingBinaryTree.preOrder();
//System.out.println("===============中序遍历线索化二叉树================");
@@ -69,17 +69,17 @@ public void preOrder() {
ThreadingHeroNode node = root;
while (node != null) {
System.out.println(node);
- // 非线索化结点直接输出
+ // 非线索化节点直接输出
while (node.getLeftType() == 0) {
node = node.getLeft();
System.out.println(node);
}
- // 遍历带有线索化的结点,遍历结束时会输出一个非线索化结点
+ // 遍历带有线索化的节点,遍历结束时会输出一个非线索化节点
while (node.getRightType() == 1) {
node = node.getRight();
System.out.println(node);
}
- // 记录非线索化结点右子树
+ // 记录非线索化节点右子树
node = node.getRight();
}
}
@@ -91,17 +91,17 @@ public void preOrder() {
public void infixOrder() {
ThreadingHeroNode node = root;
while (node != null) {
- // 找到type==1的线索化结点
+ // 找到type==1的线索化节点
while (node.getLeftType() == 0) {
node = node.getLeft();
}
System.out.println(node);
- // 遍历带有线索化的结点,遍历结束时会输出一个非线索化结点
+ // 遍历带有线索化的节点,遍历结束时会输出一个非线索化节点
while (node.getRightType() == 1) {
node = node.getRight();
System.out.println(node);
}
- // 记录非线索化结点右子树
+ // 记录非线索化节点右子树
node = node.getRight();
}
}
@@ -109,28 +109,28 @@ public void infixOrder() {
/**
* 构建先序线索化二叉树
*
- * @param node 当前需要线索化的结点
+ * @param node 当前需要线索化的节点
*/
public void preOrderThreading(ThreadingHeroNode node) {
// 数据校验
if (node == null) {
return;
}
- // 处理当前结点的前驱结点
- // 如果当前结点的左子树为空,说明出现了空指针域,需要构建线索前驱结点的线索
+ // 处理当前节点的前驱节点
+ // 如果当前节点的左子树为空,说明出现了空指针域,需要构建线索前驱节点的线索
if (node.getLeft() == null) {
- // 设置当前结点的前驱节点
+ // 设置当前节点的前驱节点
node.setLeft(preNode);
node.setLeftType(1);
}
- // 处理前一个结点的后继结点
- // 如果前一个结点的左子树为空,说明出现了空指针域,需要构建线索后继结点的线索
+ // 处理前一个节点的后继节点
+ // 如果前一个节点的左子树为空,说明出现了空指针域,需要构建线索后继节点的线索
if (preNode != null && preNode.getRight() == null) {
- // 设置前一个结点的后继结点为当前结点
+ // 设置前一个节点的后继节点为当前节点
preNode.setRight(node);
preNode.setRightType(1);
}
- // 每处理一个当前结点,就让当前结点是下一个结点的前驱节点
+ // 每处理一个当前节点,就让当前节点是下一个节点的前驱节点
preNode = node;
// type==0表示link
if (node.getLeftType() == 0) {
@@ -147,7 +147,7 @@ public void preOrderThreading(ThreadingHeroNode node) {
/**
* 构建中序线索化二叉树
*
- * @param node 当前需要线索化的结点
+ * @param node 当前需要线索化的节点
*/
public void infixOrderThreading(ThreadingHeroNode node) {
// 数据校验
@@ -157,21 +157,21 @@ public void infixOrderThreading(ThreadingHeroNode node) {
// 1)、先线索化左子树
infixOrderThreading(node.getLeft());
- // 2)、处理当前结点的前驱结点
- // 如果当前结点的左子树为空,说明出现了空指针域,需要构建线索前驱结点的线索
+ // 2)、处理当前节点的前驱节点
+ // 如果当前节点的左子树为空,说明出现了空指针域,需要构建线索前驱节点的线索
if (node.getLeft() == null) {
- // 设置当前结点的前驱节点
+ // 设置当前节点的前驱节点
node.setLeft(preNode);
node.setLeftType(1);
}
- // 3)、处理前一个结点的后继结点
- // 如果前一个结点的左子树为空,说明出现了空指针域,需要构建线索后继结点的线索
+ // 3)、处理前一个节点的后继节点
+ // 如果前一个节点的左子树为空,说明出现了空指针域,需要构建线索后继节点的线索
if (preNode != null && preNode.getRight() == null) {
- // 设置前一个结点的后继结点为当前结点
+ // 设置前一个节点的后继节点为当前节点
preNode.setRight(node);
preNode.setRightType(1);
}
- // 每处理一个当前结点,就让当前结点是下一个结点的前驱节点
+ // 每处理一个当前节点,就让当前节点是下一个节点的前驱节点
preNode = node;
// 4)、线索化右子树
@@ -179,15 +179,15 @@ public void infixOrderThreading(ThreadingHeroNode node) {
}
}
-// 树的结点
+// 树的节点
class ThreadingHeroNode {
private int no;
private String name;
private ThreadingHeroNode left;
private ThreadingHeroNode right;
- private int leftType; // leftType==0指向左子树,等于1指向前驱结点
- private int rightType;// rightType==0指向右子树,等于1指向后继结点
+ private int leftType; // leftType==0指向左子树,等于1指向前驱节点
+ private int rightType;// rightType==0指向右子树,等于1指向后继节点
public ThreadingHeroNode(int no, String name) {
this.no = no;
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/avl/AVLTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/avl/AVLTreeDemo.java
new file mode 100644
index 00000000..f50d1106
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/avl/AVLTreeDemo.java
@@ -0,0 +1,378 @@
+package cn.lastwhisper.atguigu.tree.avl;
+
+/**
+ * 平衡二叉树
+ * @author cn.lastwhisper
+ */
+public class AVLTreeDemo {
+ public static void main(String[] args) {
+ // 测试左旋转
+ //int[] arr = {4, 3, 6, 5, 7, 8};
+ // 测试右旋转
+ //int[] arr = {10, 12, 8, 9, 7, 6};
+ // 测试双旋转
+ int[] arr = {10, 11, 7, 6, 8, 9};
+ AVLTree avlTree = new AVLTree();
+ for (int i = 0; i < arr.length; i++) {
+ avlTree.add(new Node(arr[i]));
+ }
+ System.out.println("中序遍历");
+ avlTree.infixOrder();
+ Node avlTreeRoot = avlTree.getRoot();
+ System.out.println("当前树的高度:" + avlTreeRoot.height());
+ System.out.println("当前树的左子树高度:" + avlTreeRoot.left.height());
+ System.out.println("当前树的右子树高度:" + avlTreeRoot.right.height());
+ System.out.println("当前根节点:" + avlTreeRoot);
+ }
+}
+
+/**
+ * 二叉排序树
+ */
+class AVLTree {
+ // 根节点
+ private Node root;
+
+ public Node getRoot() {
+ return root;
+ }
+
+ public void setRoot(Node root) {
+ this.root = root;
+ }
+
+ // 查找节点
+ public Node search(int value) {
+ if (root != null) {
+ return root.search(value);
+ } else {
+ return null;
+ }
+ }
+
+ // 查找父节点
+ public Node searchParent(int value) {
+ if (root != null) {
+ return root.searchParent(value);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 找到该节点左子树最小值,并删除这个最小值节点
+ *
+ * @param node
+ * @return int 最小值节点
+ */
+ public int delRightTreeMin(Node node) {
+ Node temp = node;
+ // 找到右子节点的最小值节点
+ while (temp.left != null) {
+ temp = temp.left;
+ }
+ delNode(temp.value);
+ return temp.value;
+ }
+
+ /**
+ * 找到该节点左子树最大值,并删除这个最大值节点
+ *
+ * @param node
+ * @return int 最大值
+ */
+ public int delLeftTreeMax(Node node) {
+ Node temp = node;
+ while (temp.right != null) {
+ temp = temp.right;
+ }
+ delNode(temp.value);
+ return temp.value;
+ }
+
+
+ // 根据value删除节点
+ public void delNode(int value) {
+ if (root == null) {
+ return;
+ } else {
+ // 待删除节点
+ Node targetNode = search(value);
+ // 没有找到待删除节点
+ if (targetNode == null) {
+ return;
+ }
+ // 待删除节点的父节点
+ Node parentNode = searchParent(value);
+ // 1. 情况一:只有一个根节点
+ if (root.left == null && root.right == null) {
+ root = null;
+ return;
+ }
+ // 2. 情况二:删除的节点是叶子节点(左右节点为空)
+ if (targetNode.left == null && targetNode.right == null) {
+ // 2.1 确定targetNode是parent的左子节点还是右子节点;
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // 左子节点
+ parentNode.left = null;
+ } else if (parentNode.right != null && parentNode.right.value == targetNode.value) {
+ // 右子节点
+ parentNode.right = null;
+ }
+ } else if (targetNode.left != null && targetNode.right != null) {
+ // 3. 情况四:删除带有两个子节点的targetNode
+ // 找到targetNode右子树的最小值,删除最小值节点,并将最小值赋值给targetNode
+ //targetNode.value = delRightTreeMin(targetNode.right);
+ targetNode.value = delLeftTreeMax(targetNode.left);
+ } else {
+ // 4. 情况三:删除只有一个子节点的targetNode
+ // 4.1 确定targetNode的子节点是左子节点还是右子节点
+ // targetNode的子节点是左子节点
+ if (targetNode.left != null) {
+ if (parentNode != null) {
+ // 4.2 确定targetNode在parentNode上是左子节点还是右子节点
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // targetNode在parentNode上是左子节点
+ parentNode.left = targetNode.left;
+ } else {
+ // targetNode在parentNode上是右子节点
+ parentNode.right = targetNode.left;
+ }
+ } else {
+ // targetNode为根节点时,parentNode==null
+ // root = targetNode.left;即为删除target节点
+ root = targetNode.left;
+ }
+ } else {
+ if (parentNode != null) {
+ //targetNode的子节点是右子节点
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // targetNode在parentNode上是左子节点
+ parentNode.left = targetNode.right;
+ } else {
+ // targetNode在parentNode上是右子节点
+ parentNode.right = targetNode.right;
+ }
+ } else {
+ root = targetNode.right;
+ }
+ }
+
+ }
+
+
+ }
+
+ }
+
+ // 中序
+ public void infixOrder() {
+ if (root == null) {
+ System.out.println("树空");
+ } else {
+ root.infixOrder();
+ }
+
+ }
+
+ // 添加节点
+ public void add(Node node) {
+ if (root == null) {
+ root = node;
+ } else {
+ root.add(node);
+ }
+ }
+
+}
+
+
+class Node {
+ int value;
+ Node left;
+ Node right;
+
+ public Node(int value) {
+ this.value = value;
+ }
+
+ /**
+ * 以当前某节点进行右旋转,降低左子树的高度
+ */
+ public void rightRotate() {
+ // 1. 创建一个新节点,值等于当前节点的值
+ Node newNode = new Node(this.value);
+ // 2. 将新节点的右子树设置为当前节点的右子树
+ newNode.right = this.right;
+ // 3. 将新节点的左子树设置为当前节点的左子树的右子树(当前节点左子树最大的节点)
+ newNode.left = this.left.right;
+ // 4. 将当前节点的值设置为当前节点的左子树(节点)的值
+ this.value = this.left.value;
+ // 5. 将当前节点的左子树设置为当前节点左子树的左子树
+ this.left = this.left.left;
+ // 6. 将当期节点的右子树设置为新节点
+ this.right = newNode;
+ }
+
+ /**
+ * 以当前某节点进行左旋转,降低右子树的高度
+ */
+ public void leftRotate() {
+ // 1. 创建一个新节点,值等于当前节点的值
+ Node newNode = new Node(this.value);
+ // 2. 将新节点的左子树设置为当前节点的左子树
+ newNode.left = this.left;
+ // 3. 将新节点的右子树设置为当前节点右子树的左子树
+ newNode.right = this.right.left;
+ // 4. 将当前节点的值设置为当前节点右子树的值
+ this.value = this.right.value;
+ // 5. 将当前节点的右子树设置为当前节点右子树的右子树
+ this.right = this.right.right;
+ // 6. 将当前节点左子树设置为新节点
+ this.left = newNode;
+ }
+
+ /**
+ * @return int 当前某节点左子树的高度
+ */
+ public int leftHeight() {
+ if (this.left != null) {
+ return this.left.height();
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * @return int 当前某节点右子树的高度
+ */
+ public int rightHeight() {
+ if (this.right != null) {
+ return this.right.height();
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * @return int 当前某节点的高度
+ */
+ public int height() {
+ int leftHeight = this.left == null ? 0 : this.left.height();
+ int rightHeight = this.right == null ? 0 : this.right.height();
+ return Math.max(leftHeight, rightHeight) + 1;
+ }
+
+ /**
+ * 查找节点
+ *
+ * @param value 节点的value
+ * @return cn.cn.lastwhisper.tree.binarysorttree.Node
+ */
+ public Node search(int value) {
+ // 1. 判断当前节点是否是查找的节点
+ if (this.value == value) {
+ return this;
+ } else if (this.value > value && this.left != null) {
+ // 2.1 当前节点的value大于value,往左边寻找
+ return this.left.search(value);
+ } else if (this.value < value && this.right != null) {
+ // 2.2 当前节点的value小于value,往右边寻找
+ return this.right.search(value);
+ } else {
+ // 3. this.left&&this.right==null,找不到该节点
+ return null;
+ }
+ }
+
+ // 查找节点的父节点
+ public Node searchParent(int value) {
+ // 1. 判断当前节点是否是查找节点的父节点
+ if ((this.left != null && this.left.value == value) ||
+ (this.right != null && this.right.value == value)) {
+ return this;
+ } else {
+ if (this.value > value && this.left != null) {
+ // 2.1 当前节点的value大于value,往左边寻找
+ return this.left.searchParent(value);
+ } else if (this.value < value && this.right != null) {
+ // 2.2 当前节点的value小于value,往右边寻找
+ return this.right.searchParent(value);
+ } else {
+ // 3. this.left&&this.right==null,找不到该节点的父节点
+ return null;
+ }
+ }
+ }
+
+ // 中序
+ public void infixOrder() {
+ if (this.left != null) {
+ this.left.infixOrder();
+ }
+ System.out.println(this);
+ if (this.right != null) {
+ this.right.infixOrder();
+ }
+ }
+
+ /**
+ * 以自身为根节点按规则添加左右子树
+ * 规则:对于非叶子节点p,左节点小于p,右节点大于p
+ * 满足AVL规则!!!
+ * @param node
+ * @return void
+ */
+ public void add(Node node) {
+ // 1. 如果待添加节点为空直接返回
+ if (node == null) {
+ return;
+ }
+ if (this.value > node.value) {
+ // 2.1 如果根节点大于待添加节点,将待添加节点放到左边
+ if (this.left == null) {
+ this.left = node;
+ } else {
+ this.left.add(node);
+ }
+ } else {
+ // 2.2 如果根节点小于待添加节点,将待添加节点放到右边
+ if (this.right == null) {
+ this.right = node;
+ } else {
+ this.right.add(node);
+ }
+ }
+
+ // 当添加完节点后,满足(右子树的高度-左子树的高度) > 1 ,进行左旋转
+ if (this.rightHeight() - this.leftHeight() > 1) {
+ // 如果当前节点的右子树的左子树的高度大于当前节点的右子树的右子树的高度
+ if(this.right!=null&&(this.right.leftHeight()>this.right.rightHeight())){
+ // 先当前节点的右子树进行右旋转,再左旋转
+ this.right.rightRotate();
+ }
+ leftRotate();
+ return;
+ }
+
+ // 当添加完节点后,满足(左子树的高度-右子树的高度) > 1 ,进行右旋转
+ if (this.leftHeight() - this.rightHeight() > 1) {
+ // 如果当前节点的左子树的右子树的高度大于当前节点的左子树的左子树的高度
+ if (this.left != null && (this.left.rightHeight() > this.left.leftHeight())) {
+ // 先对当前节点的左子树进行左旋转,再右旋转
+ this.left.leftRotate();
+ }
+ rightRotate();
+ }
+
+ }
+
+
+ @Override
+ public String toString() {
+ return "Node{" +
+ "value=" + value +
+ '}';
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/binarysorttree/BinarySortTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/binarysorttree/BinarySortTreeDemo.java
new file mode 100644
index 00000000..d582a014
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/binarysorttree/BinarySortTreeDemo.java
@@ -0,0 +1,298 @@
+package cn.lastwhisper.atguigu.tree.binarysorttree;
+
+/**
+ * 二叉排序树
+ * @author cn.lastwhisper
+ */
+public class BinarySortTreeDemo {
+ public static void main(String[] args) {
+ int[] arr = {7, 3, 10, 12, 5, 1, 9, 2};
+ BinarySortTree binarySortTree = new BinarySortTree();
+ for (int i = 0; i < arr.length; i++) {
+ binarySortTree.add(new Node(arr[i]));
+ }
+ System.out.println("中序遍历");
+ binarySortTree.infixOrder();
+
+ //binarySortTree.delNode(2); // 删除叶子节点
+ //binarySortTree.delNode(1); // 删除只有一个子节点
+ //binarySortTree.delNode(7); // 删除有两个子节点
+
+ binarySortTree.delNode(2);
+ binarySortTree.delNode(5);
+ binarySortTree.delNode(9);
+ binarySortTree.delNode(12);
+ binarySortTree.delNode(7);
+ binarySortTree.delNode(3);
+ binarySortTree.delNode(1);
+ binarySortTree.delNode(10);
+ // 会报错
+ //binarySortTree.delNode(10);
+ //binarySortTree.delNode(1);
+
+ System.out.println("删除节点后,中序遍历");
+ binarySortTree.infixOrder();
+ }
+
+}
+
+/**
+ * 二叉排序树
+ */
+class BinarySortTree {
+ // 根节点
+ private Node root;
+
+ public Node getRoot() {
+ return root;
+ }
+
+ public void setRoot(Node root) {
+ this.root = root;
+ }
+
+ // 查找节点
+ public Node search(int value) {
+ if (root != null) {
+ return root.search(value);
+ } else {
+ return null;
+ }
+ }
+
+ // 查找父节点
+ public Node searchParent(int value) {
+ if (root != null) {
+ return root.searchParent(value);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 找到该节点左子树最小值,并删除这个最小值节点
+ *
+ * @param node
+ * @return int 最小值节点
+ */
+ public int delRightTreeMin(Node node) {
+ Node temp = node;
+ // 找到右子节点的最小值节点
+ while (temp.left != null) {
+ temp = temp.left;
+ }
+ delNode(temp.value);
+ return temp.value;
+ }
+
+ /**
+ * 找到该节点左子树最大值,并删除这个最大值节点
+ *
+ * @param node
+ * @return int 最大值
+ */
+ public int delLeftTreeMax(Node node) {
+ Node temp = node;
+ while (temp.right != null) {
+ temp = temp.right;
+ }
+ delNode(temp.value);
+ return temp.value;
+ }
+
+
+ // 根据value删除节点
+ public void delNode(int value) {
+ if (root == null) {
+ } else {
+ // 待删除节点
+ Node targetNode = search(value);
+ // 没有找到待删除节点
+ if (targetNode == null) {
+ return;
+ }
+ // 待删除节点的父节点
+ Node parentNode = searchParent(value);
+ // 1. 情况一:只有一个根节点
+ if (root.left == null && root.right == null) {
+ root = null;
+ return;
+ }
+ // 2. 情况二:删除的节点是叶子节点(左右节点为空)
+ if (targetNode.left == null && targetNode.right == null) {
+ // 2.1 确定targetNode是parent的左子节点还是右子节点;
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // 左子节点
+ parentNode.left = null;
+ } else if (parentNode.right != null && parentNode.right.value == targetNode.value) {
+ // 右子节点
+ parentNode.right = null;
+ }
+ } else if (targetNode.left != null && targetNode.right != null) {
+ // 3. 情况四:删除带有两个子节点的targetNode
+ // 找到targetNode右子树的最小值,删除最小值节点,并将最小值赋值给targetNode
+ //targetNode.value = delRightTreeMin(targetNode.right);
+ targetNode.value = delLeftTreeMax(targetNode.left);
+ } else {
+ // 4. 情况三:待删除节点只有一个子节点
+ // 4.1 确定targetNode的子节点是左子节点还是右子节点
+ // targetNode的子节点是左子节点
+ if (targetNode.left != null) {
+ if (parentNode != null) {
+ // 4.2 确定targetNode在parentNode上是左子节点还是右子节点
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // targetNode在parentNode上是左子节点
+ parentNode.left = targetNode.left;
+ } else {
+ // targetNode在parentNode上是右子节点
+ parentNode.right = targetNode.left;
+ }
+ } else {
+ // targetNode为根节点时,parentNode==null
+ // root = targetNode.left;即为删除target节点
+ root = targetNode.left;
+ }
+ } else {
+ if (parentNode != null) {
+ //targetNode的子节点是右子节点
+ if (parentNode.left != null && parentNode.left.value == targetNode.value) {
+ // targetNode在parentNode上是左子节点
+ parentNode.left = targetNode.right;
+ } else {
+ // targetNode在parentNode上是右子节点
+ parentNode.right = targetNode.right;
+ }
+ } else {
+ root = targetNode.right;
+ }
+ }
+
+ }
+
+
+ }
+
+ }
+
+ // 中序
+ public void infixOrder() {
+ if (root == null) {
+ System.out.println("树空");
+ } else {
+ root.infixOrder();
+ }
+
+ }
+
+ // 添加节点
+ public void add(Node node) {
+ if (root == null) {
+ root = node;
+ } else {
+ root.add(node);
+ }
+ }
+
+}
+
+
+class Node {
+ int value;
+ Node left;
+ Node right;
+
+ public Node(int value) {
+ this.value = value;
+ }
+
+ /**
+ * 查找节点
+ *
+ * @param value 节点的value
+ * @return cn.cn.lastwhisper.tree.binarysorttree.Node
+ */
+ public Node search(int value) {
+ // 1. 判断当前节点是否是查找的节点
+ if (this.value == value) {
+ return this;
+ } else if (this.value > value && this.left != null) {
+ // 2.1 当前节点的value大于value,往左边寻找,因为左子树的值都小于当前节点
+ return this.left.search(value);
+ } else if (this.value < value && this.right != null) {
+ // 2.2 当前节点的value小于value,往右边寻找,因为右子树的值都大于当前节点
+ return this.right.search(value);
+ } else {
+ // 3. this.left&&this.right==null,找不到该节点
+ return null;
+ }
+ }
+
+ // 查找节点的父节点
+ public Node searchParent(int value) {
+ // 1. 判断当前节点是否是查找节点的父节点
+ if ((this.left != null && this.left.value == value) ||
+ (this.right != null && this.right.value == value)) {
+ return this;
+ } else {
+ if (this.value > value && this.left != null) {
+ // 2.1 当前节点的value大于value,往左边寻找
+ return this.left.searchParent(value);
+ } else if (this.value < value && this.right != null) {
+ // 2.2 当前节点的value小于value,往右边寻找
+ return this.right.searchParent(value);
+ } else {
+ // 3. this.left&&this.right==null,找不到该节点的父节点
+ return null;
+ }
+ }
+ }
+
+ // 中序
+ public void infixOrder() {
+ if (this.left != null) {
+ this.left.infixOrder();
+ }
+ System.out.println(this);
+ if (this.right != null) {
+ this.right.infixOrder();
+ }
+ }
+
+ /**
+ * 以自身为根节点按规则添加左右子树
+ * 规则:对于非叶子节点p,左节点小于p,右节点大于p
+ *
+ * @param node
+ * @return void
+ */
+ public void add(Node node) {
+ // 1. 如果待添加节点为空直接返回
+ if (node == null) {
+ return;
+ }
+ if (this.value > node.value) {
+ // 2.1 如果根节点大于待添加节点,将待添加节点放到左边
+ if (this.left == null) {
+ this.left = node;
+ } else {
+ this.left.add(node);
+ }
+ } else {
+ // 2.2 如果根节点小于待添加节点,将待添加节点放到右边
+ if (this.right == null) {
+ this.right = node;
+ } else {
+ this.right.add(node);
+ }
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ return "Node{" +
+ "value=" + value +
+ '}';
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmancode/HuffmanCode.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmancode/HuffmanCode.java
similarity index 95%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmancode/HuffmanCode.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmancode/HuffmanCode.java
index 35cefc4d..11ba50fc 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmancode/HuffmanCode.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmancode/HuffmanCode.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.tree.huffmancode;
+package cn.lastwhisper.atguigu.tree.huffmancode;
import java.io.*;
import java.util.*;
@@ -357,8 +357,8 @@ public static byte[] zip(byte[] bytes, Map huffmanCodes) {
/**
* 根据哈夫曼树建立哈弗曼编码表
*
- * @param root 根结点
- * @return java.util.Map
+ * @param root 根节点
+ * @return java.array.Map
*/
public static Map getCodes(Node root) {
if (root == null) {
@@ -371,7 +371,7 @@ public static Map getCodes(Node root) {
/**
* 根据哈夫曼树建立哈弗曼编码表(递归)
- * @param node 以node结点为root开始建立哈夫曼编码表
+ * @param node 以node节点为root开始建立哈夫曼编码表
* @param code 左边为0,右边为1
* @param stringBuffer 拼接编码的值
* @param huffmanCodes 存储哈夫曼编码表
@@ -380,14 +380,14 @@ public static void getCodes(Node node, String code, StringBuffer stringBuffer, M
// 拼接编码的值,如 a:1——a:11——a:110
StringBuffer sb = new StringBuffer(stringBuffer);
sb.append(code);
- // 非叶子结点,哈夫曼树只有叶子结点有data
+ // 非叶子节点,哈夫曼树只有叶子节点有data
if (node.data == null) {
// 向左递归
getCodes(node.left, "0", sb, huffmanCodes);
// 向右递归
getCodes(node.right, "1", sb, huffmanCodes);
} else {
- // 叶子结点,
+ // 叶子节点,
huffmanCodes.put(node.data, sb.toString());
}
}
@@ -402,19 +402,19 @@ public static void preOrder(Node root) {
}
/**
- * 创建哈夫曼树,并返回root结点
+ * 创建哈夫曼树,并返回root节点
*
- * @param nodes 二叉树结点
- * @return Node 哈夫曼树根结点
+ * @param nodes 二叉树节点
+ * @return Node 哈夫曼树根节点
*/
public static Node createHuffmanTree(List nodes) {
while (nodes.size() > 1) {
- // 1)、将序列升序排序,每一个结点都可以看做是一颗最简单的二叉树
+ // 1)、将序列升序排序,每一个节点都可以看做是一颗最简单的二叉树
Collections.sort(nodes);
- // 2)、找到权值最小的二叉树(结点)
+ // 2)、找到权值最小的二叉树(节点)
Node leftNode = nodes.get(0);
- // 2)、找到权值次小的二叉树(结点)
+ // 2)、找到权值次小的二叉树(节点)
Node rightNode = nodes.get(1);
// 3)、将两个权值最小的二叉树构成一颗新的二叉树,新二叉树的权值为前面两个二叉树权值之和。
Node node = new Node(leftNode.weight + rightNode.weight);
@@ -429,9 +429,9 @@ public static Node createHuffmanTree(List nodes) {
}
/**
- * 将字符串转换成哈夫曼树结点
+ * 将字符串转换成哈夫曼树节点
* @param zipStr 待压缩字符串
- * @return java.util.List
+ * @return java.array.List
*/
public static List getListNode(String zipStr) {
byte[] zipStrBytes = zipStr.getBytes();
@@ -439,9 +439,9 @@ public static List getListNode(String zipStr) {
}
/**
- * 将字符串转换成哈夫曼树结点
+ * 将字符串转换成哈夫曼树节点
* @param zipBytes 待压缩字节数组
- * @return java.util.List
+ * @return java.array.List
*/
public static List getListNode(byte[] zipBytes) {
// 将字节数组按字节拆分,统计每个字节出现的次数(select count(byte) weight from zipBytes order by byte)
@@ -465,7 +465,7 @@ public static List getListNode(byte[] zipBytes) {
}
-// 哈夫曼树结点
+// 哈夫曼树节点
class Node implements Comparable {
Byte data; // 字节
int weight; // 权值,主要用于构建哈夫曼树
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmantree/HuffmanTree.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmantree/HuffmanTree.java
similarity index 87%
rename from algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmantree/HuffmanTree.java
rename to algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmantree/HuffmanTree.java
index 578aa60a..4dd1b9a4 100644
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/huffmantree/HuffmanTree.java
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/atguigu/tree/huffmantree/HuffmanTree.java
@@ -1,4 +1,4 @@
-package cn.lastwhisper.tree.huffmantree;
+package cn.lastwhisper.atguigu.tree.huffmantree;
import java.util.Collections;
import java.util.LinkedList;
@@ -26,7 +26,7 @@ public static void preOrder(Node root) {
}
/**
- * 创建哈夫曼树,并返回root结点
+ * 创建哈夫曼树,并返回root节点
*
* @param arr
* @return cn.cn.lastwhisper.tree.huffmantree.Node
@@ -39,11 +39,11 @@ public static Node createHuffmanTree(int[] arr) {
}
while (nodes.size() > 1) {
- // 1)、将序列升序排序,每一个结点都可以看做是一颗最简单的二叉树
+ // 1)、将序列升序排序,每一个节点都可以看做是一颗最简单的二叉树
Collections.sort(nodes);
- // 2)、找到权值最小的二叉树(结点)
+ // 2)、找到权值最小的二叉树(节点)
Node leftNode = nodes.get(0);
- // 2)、找到权值次小的二叉树(结点)
+ // 2)、找到权值次小的二叉树(节点)
Node rightNode = nodes.get(1);
// 3)、将两个权值最小的二叉树构成一颗新的二叉树,新二叉树的权值为前面两个二叉树权值之和。
Node node = new Node(leftNode.value + rightNode.value);
@@ -61,7 +61,7 @@ public static Node createHuffmanTree(int[] arr) {
}
-// 哈夫曼树结点
+// 哈夫曼树节点
class Node implements Comparable {
int value;// 权值
Node left;//左子树
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/HeapSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/HeapSort.java
deleted file mode 100644
index 3a98a80a..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/HeapSort.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package cn.lastwhisper.sort;
-
-import java.util.Arrays;
-
-/**
- * 堆排序
- *
- * @author cn.lastwhisper
- */
-public class HeapSort {
- public static void main(String[] args) {
- //int[] arr = {4, 6, 8, 5, 9, 58, -10};
- int[] arr = {4, 6, 8, 5, 9};
- heapSort(arr);
- System.out.println("数组:" + Arrays.toString(arr));
- }
-
- public static void heapSort(int[] arr) {
-
- //adjustHeap(arr, 1, arr.length);
- //System.out.println("第1次" + Arrays.toString(arr)); // 4,9,8,5,6
-
- //adjustHeap(arr, 0, arr.length);
- //System.out.println("第2次" + Arrays.toString(arr)); // 9,6,8,5,4
- int temp;
- // 1. 满二叉树从右向左、从下往上构建大顶堆;完全二叉树从左向右、从下往上构建大顶堆;
- // i--意味着,从下到上,每一次都是[i,arr.length]的数组(二叉树)进行重构大顶堆
- // [0,arr.length]重构了数组(二叉树)头部几个元素的大顶堆,同时也会重构下面的二叉树
- for (int i = arr.length / 2 - 1; i >= 0; i--) {
- adjustHeap(arr, i, arr.length);
- }
- // 2. 交换堆顶元素与末尾元素,调整堆结构
- for (int j = arr.length - 1; j >= 0; j--) {
- // 交换
- temp = arr[j];
- arr[j] = arr[0];
- arr[0] = temp;
- adjustHeap(arr, 0, j);
- }
- }
-
-
- /**
- * 将一个数组(二叉树), 调整成一个大顶堆
- * 功能: 将以i对应的非叶子结点的树调整成大顶堆
- * 举例 int arr[] = {4, 6, 8, 5, 9}; => i = 1 => adjustHeap => 得到 {4, 9, 8, 5, 6}
- * 如果我们再次调用 adjustHeap 传入的是 i = 0 => {4, 9, 8, 5, 6} => {9, 6, 8, 5, 4}
- * @param arr 待调整的数组
- * @param i 表示非叶子结点在数组中索引
- * @param length 表示对多少个元素继续调整, length 是在逐渐的减少
- */
- public static void adjustHeap(int[] arr, int i, int length) {
- // 当前i结点
- int temp = arr[i];
- // k是i结点的左子结点,k + 1是右子结点
- for (int k = 2 * i + 1; k < length; k = 2 * k + 1) {
- // arr[k] < arr[k + 1]左结点小于右结点
- if (k + 1 < length && arr[k] < arr[k + 1]) {
- // k指向数值最大的结点
- k++;
- }
- if (arr[k] > temp) {//子节点大于父结点
- arr[i] = arr[k];//将子节点赋值到父结点
- i = k;//记录子结点的下标,为了最后 arr[i] = temp;
- } else {
- break;
- }
- }
- //i = k; arr[i]此时已经是子结点的位置了,前面父结点已经拿到了子结点的值了,这里要将子结点的值赋为父结点的值
- arr[i] = temp;
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/InsertSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/InsertSort.java
deleted file mode 100644
index 7119410d..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/InsertSort.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package cn.lastwhisper.sort;
-
-import cn.lastwhisper.ArrayUtil;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class InsertSort {
- public static void main(String[] args) {
- //int[] arr = {101, 34, 119, 1};
- //insertSort1(arr); // 插入排序算法实现步骤
-
- int[] arr = ArrayUtil.generateArrByRandom(100000);
- // 计算耗时
- long start = System.currentTimeMillis();
- insertSort(arr);
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
-
- //System.out.println(Arrays.toString(arr));
- }
-
- /**
- * 插入排序O(n^2)
- * insertVal < arr[insertIndex降序
- * insertVal > arr[insertIndex升序
- * @param arr
- * @return void
- */
- public static void insertSort(int[] arr) {
- int insertVal;
- int insertIndex;
- // 有序列表[0];[1...arr.length]无序列表
- for (int i = 1; i < arr.length; i++) {
- // insertVal的意义:缓存无序列表的第一个数,这个数也是待插入有序列表的数
- insertVal = arr[i];
- // insertIndex的意义:记录有序列表的最后一个数的下标
- insertIndex = i - 1;
- // [insertIndex+1...i-1]后移到[insertIndex+2...i](从前往后移动)
- while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
- arr[insertIndex + 1] = arr[insertIndex];
- insertIndex--;
- }
- // insertIndex == i - 1; 说明数组并未后移,无需赋值
- if (insertIndex != i - 1) {
- // arr[insertIndex + 1]为待插入位置
- arr[insertIndex + 1] = insertVal;
- }
- }
- }
-
- /**
- * 插入排序的实现步骤
- *
- * @param arr
- * @return void
- */
- public static void insertSort1(int[] arr) {
- // 第1轮
- // 有序列表{101},无序列表{34, 119, 1}
- // {101, 34, 119, 1}
-
- // insertVal的意义:缓存无序列表的第一个数,这个数也是待插入有序列表的数
- int insertVal = arr[1];
- // insertIndex的意义:记录有序列表的最后一个数的下标
- int insertIndex = 1 - 1;
- // insertIndex >= 0的意义:防止数组越界;
- // insertVal < arr[insertIndex]的意义:找到insertVal要插入位置的前一个位置
- // 整个while循环的意义:数组覆盖后移,找到待插入位置的前一个位置
- while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
- // 第1轮原数组:{101, 34, 119, 1}
- // arr[1]=arr[0] {101, 101, 119, 1}
- arr[insertIndex + 1] = arr[insertIndex];
- //继续向前
- insertIndex--;
- }
- // arr[0]=insertVal {34, 101, 119, 1}
- arr[insertIndex + 1] = insertVal;
-
- System.out.printf("第1轮插入,数组:%s\n", Arrays.toString(arr));
-
- // 第2轮
- insertVal = arr[2];
- insertIndex = 2 - 1;
- while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
- arr[insertIndex + 1] = arr[insertIndex];
- insertIndex--;
- }
- arr[insertIndex + 1] = insertVal;
- System.out.printf("第2轮插入,数组:%s\n", Arrays.toString(arr));
-
- // 第3轮
- insertVal = arr[3];
- insertIndex = 3 - 1;
- while (insertIndex >= 0 && insertVal < arr[insertIndex]) {
- // 第三轮原数组:{34, 101, 119, 1}
- // arr[3]=arr[2] {34, 101, 119, 119}
- // arr[2]=arr[1] {34, 101, 101, 119}
- // arr[1]=arr[0] {34, 34, 101, 119}
- arr[insertIndex + 1] = arr[insertIndex];
- insertIndex--;
- }
- arr[insertIndex + 1] = insertVal;
- System.out.printf("第3轮插入,数组:%s\n", Arrays.toString(arr));
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/MergeSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/MergeSort.java
deleted file mode 100644
index 576c9896..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/MergeSort.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package cn.lastwhisper.sort;
-
-import cn.lastwhisper.ArrayUtil;
-
-/**
- * @author cn.lastwhisper
- */
-public class MergeSort {
-
- public static void main(String[] args) {
- //int[] arr = {9, 8, 7, 6, 5, 4, 3, 2, 1};
- int[] arr = ArrayUtil.generateArrByRandom(10000000);// 1443 ms
- // 计算耗时
- long start = System.currentTimeMillis();
- int[] temp = new int[arr.length];
- mergeSort(arr, 0, arr.length - 1, temp);
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
-
- //System.out.println(Arrays.toString(arr));
- }
-
- /**
- * 归并排序
- * 分
- *
- * @param arr 排序的原始数组
- * @param left 左边有序序列的初始索引
- * @param right 右边索引
- * @param temp 中转数组
- */
- public static void mergeSort(int[] arr, int left, int right, int[] temp) {
- int mid;
- if (left < right) {
- mid = (left + right) / 2;
- // 向左分
- mergeSort(arr, left, mid, temp);
- // 向右分
- mergeSort(arr, mid + 1, right, temp);
- // 治
- merge(arr, left, mid, right, temp);
- }
- }
-
- /**
- * 治
- * @param arr 排序的原始数组 arr[left...mid] arr[mid+1...right]
- * @param left 左边有序序列的初始索引
- * @param mid 中间索引
- * @param right 右边索引
- * @param temp 中转数组
- */
- public static void merge(int[] arr, int left, int mid, int right, int[] temp) {
- int i = left; //左边有序序列的初始索引
- int j = mid + 1; // 右边有序序列的初始化序索引
- int t = 0; // 指向temp数组的当前位置
-
- // 1)、将左右两边(有序)的数据按照规则填充到temp数组,任意一边处理完毕为止
- while (i <= mid && j <= right) {
-
- if (arr[i] < arr[j]) {
- // 左小于右,将左数组第i个元素copy到temp数组的第t个位置
- temp[t] = arr[i];
- i += 1;
- } else {
- // 右小于或等于左,将右数组第j个元素copy到temp数组的第t个位置
- temp[t] = arr[j];
- j += 1;
- }
- t += 1;
- }
-
- // 2)、把有剩余数据的一边的数据依次填充到temp
- while (i <= mid) {
- // 说明 右数组还有剩余元素
- temp[t] = arr[i];
- t += 1;
- i += 1;
- }
- while (j <= right) {
- // 说明 右数组还有剩余元素
- temp[t] = arr[j];
- t += 1;
- j += 1;
- }
-
- // 3)、将temp数组的数据copy到arr(并不是每次都copy所有)
- t = 0;
- int tempLeft = left;
- while (tempLeft <= right) { // 0 1;2 3;0 3
- arr[tempLeft] = temp[t];
- t += 1;
- tempLeft += 1;
- }
-
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort.java
deleted file mode 100644
index 0e7c5a51..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package cn.lastwhisper.sort;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class QuickSort {
-
- public static void main(String[] args) {
- //int[] arr = {-9, 78, 0, 23, -567, 70};
- //int[] arr = {-9, 78, 0, 23, 60, 70};
- //int[] arr = {9, 0, -567};
- int[] arr = {49, 38, 65, 97, 76, 13, 27};
-
- //int[] arr = ArrayUtil.generateArrByRandom(10000000);//耗时:1519 ms
- // 计算耗时
- long start = System.currentTimeMillis();
- //quickSort(arr, 0, arr.length - 1);
- qSort(arr, 0, arr.length - 1);
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
-
- System.out.println(Arrays.toString(arr));
- }
-
- public static void qSort(int[] arr, int head, int tail) {
- if (head >= tail || arr == null || arr.length <= 1) {
- return;
- }
- //定义俩指针 用于移动
- int left = head;
- int right = tail;
- int pivot = arr[head]; //基准值,也可以arr[(head + tail) / 2]
-
- while (left <= right) {
- while (arr[left] < pivot) { //左指针先走,找到大于等于基准数的停止
- ++left;
- }
- while (arr[right] > pivot) { //右指针后走,找到小于等于基准数的停止
- --right;
- }
- if (left < right) {
- //交换arr[left]和arr[right]的位置
- int t = arr[left];
- arr[left] = arr[right];
- arr[right] = t;
- //继续遍历
- ++left;
- --right;
- } else if (left == right) {
- //遍历完,错开两指针,用于退出循环
- ++left;
- //break;
- }
- }
-
- qSort(arr, head, right);
- qSort(arr, left, tail);
- }
-
-
- /**
- * 快速排序,选取数组中间的值
- * int pivot = arr[(left + right) / 2];
- * @param arr
- * @param left
- * @param right
- * @return void
- */
- public static void quickSort1(int[] arr, int left, int right) {
- int l = left; // 左下标
- int r = right; // 右下标
- int temp;
- // 中轴
- int pivot = arr[(left + right) / 2];
- // while循环的目的:小于或等于pivot的放左边,大于或等于pivot的放右边
- while (l < r) {
- // 在pivot左边找比pivot大的值的下标l
- while (arr[l] < pivot) { //找到arr[1]=98 >pivot=0
- l ++;
- }
- // 在pivot右边找比pivot小的值的下标r
- while (arr[r] > pivot) { //找到arr[4]=-567 < pivot=0
- r--;
- }
- // 如果l>=r说明pivot左右两边的值,已经满足:
- // 小于或等于pivot的放左边,大于或等于pivot的放右边 ——递归结束条件
- if (l >= r) {
- break;
- }
- // 交换
- temp = arr[l];
- arr[l] = arr[r];
- arr[r] = temp;
- // 如果交换完后,发现arr[l] == pivot,r--,前移 退出循环
- if (arr[l] == pivot) {
- r --;
- }
-
- // 如果交换完后,发现arr[r] == pivot,l++,后移 退出循环
- if (arr[r] == pivot) {
- l ++;
- }
- }
-
- // 第二步
-
- // 如果l==r,必须l++,r--,否则会栈溢出
- if (l == r) {
- l = l + 1;
- r = r - 1;
- }
- // 向左递归
- if (left < r) {
- quickSort1(arr, left, r);
- }
- // 向右递归
- if (right > l) {
- quickSort1(arr, l, right);
- }
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort2.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort2.java
deleted file mode 100644
index f30de4e3..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/QuickSort2.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.lastwhisper.sort;
-
-/**
- * @author lastwhisper
- */
-public class QuickSort2 {
- public static void main(String[] args) {
- int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6};
- //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 0};//为什么left++和right--条件里面要加 left <= right 限定
- //int arr[] = {7, 3, 2, 8, 1, 9, 5, 4, 6, 10};
- //int arr[] = {7, 3, 2, 6, 8, 1, 9, 5, 4, 6, 10, 6, 6}; // 为什么不取等 arr[right] > pivot
- //int arr[] = {4, 6}; //小bug测试 // 为什么while (left <= right)里面要取等
- sort(arr, 0, arr.length - 1);
- print(arr);
- }
-
- private static void sort(int[] arr, int left, int right) {
- if (left >= right) return;
- int mid = partition(arr, left, right);
- sort(arr, left, mid - 1);
- sort(arr, mid + 1, right);
- }
-
- // 分区
- private static int partition(int[] arr, int leftBound, int rightBound) {
- int left = leftBound;
- int pivot = arr[rightBound];
- int right = rightBound - 1;
-
- while (left <= right) {
- while (left <= right && arr[left] <= pivot) left++;//left <= right是为了防止pivot最大,找不到比它大的数,导致越界
- while (left <= right && arr[right] > pivot) right--;
- System.out.println("left:" + left + "\tright:" + right);
- if (left < right) swap(arr, left, right);
- }
- swap(arr, left, rightBound);
- return left;
- }
-
- private static void swap(int[] arr, int i, int j) {
- int temp = arr[i];
- arr[i] = arr[j];
- arr[j] = temp;
- }
-
- private static void print(int[] arr) {
- for (int i = 0; i < arr.length; i++) {
- System.out.print(arr[i] + "\t");
- }
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/RadixSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/RadixSort.java
deleted file mode 100644
index 2179cbea..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/RadixSort.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package cn.lastwhisper.sort;
-
-import cn.lastwhisper.ArrayUtil;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class RadixSort {
-
- public static void main(String[] args) {
- // 算法实现步骤
- //int[] arr = {53, 3, 542, 748, 14, 214};
- //int[] arr = {3, 205, 14};
- //radixSortStudy(arr);
-
- // 计算耗时
- // 占用内存 10000000 * 10 * 4 /1024 / 1024 /1024 = 0.3725290298461914
- int[] arr = ArrayUtil.generateArrByRandom(10000000);
- long start = System.currentTimeMillis();
- radixSort(arr);
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
-
- //System.out.println(Arrays.toString(arr));
- }
-
- /**
- * 基数排序
- *
- * @param arr
- * @return void
- */
- public static void radixSort(int[] arr) {
-
- int[][] bucket = new int[10][arr.length];
- // 桶元素计数器,记录每个桶中存放了多少数据
- int[] bucketElementCount = new int[10];
- // 原arr下标
- int arrIndex;
- // 除数
- int divisor = 1;
- // 最大值
- int max = arr[0];
- // 由于基数排序次数由最大数值的位数决定,所以需要求最大值
- for (int i = 1; i < arr.length; i++) {
- if (max < arr[i]) {
- max = arr[i];
- }
- }
- // 最大值得位数,即排序次数
- int maxLength = (max + "").length();
- for (int f = 0; f < maxLength; f++) {
- for (int i = 0; i < arr.length; i++) {
- // digitOfElement对应放在哪个bucket中
- int digitOfElement = arr[i] / divisor % 10;
- // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
- bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
- // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
- bucketElementCount[digitOfElement]++;
- }
-
- arrIndex = 0;
- // 将桶中数据放回原数组
- for (int i = 0; i < bucketElementCount.length; i++) {
- // 对应桶中有数据
- if (bucketElementCount[i] != 0) {
- for (int j = 0; j < bucketElementCount[i]; j++) {
- arr[arrIndex++] = bucket[i][j];
- }
- }
- // 将桶元素计数器清空
- bucketElementCount[i] = 0;
- }
- divisor *= 10;
- }
-
- }
-
- /**
- * 桶排序算法实现步骤
- *
- * @param arr
- */
- public static void radixSortStudy(int[] arr) {
- //
- int[][] bucket = new int[10][arr.length];
- // 桶元素计数器,记录每个桶中存放了多少数据
- int[] bucketElementCount = new int[10];
- // 原arr下标
- int arrIndex;
-
- for (int i = 0; i < arr.length; i++) {
- // digitOfElement对应放在哪个bucket中
- int digitOfElement = arr[i] % 10;
- // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
- bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
- // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
- bucketElementCount[digitOfElement]++;
- }
-
- arrIndex = 0;
- // 将桶中数据放回原数组
- for (int i = 0; i < bucketElementCount.length; i++) {
- // 对应桶中有数据
- if (bucketElementCount[i] != 0) {
- for (int j = 0; j < bucketElementCount[i]; j++) {
- arr[arrIndex++] = bucket[i][j];
- }
- }
- // 将桶元素计数器清空
- bucketElementCount[i] = 0;
- }
-
- System.out.println("第1轮,对个位的排序处理 arr =" + Arrays.toString(arr));
-
- for (int i = 0; i < arr.length; i++) {
- // digitOfElement对应放在哪个bucket中
- int digitOfElement = arr[i] / 10 % 10;
- // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
- bucket[digitOfElement][bucketElementCount[digitOfElement]] = arr[i];
- // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
- bucketElementCount[digitOfElement]++;
- }
-
- arrIndex = 0;
- // 将桶中数据放回原数组
- for (int i = 0; i < bucketElementCount.length; i++) {
- // 对应桶中有数据
- if (bucketElementCount[i] != 0) {
- for (int j = 0; j < bucketElementCount[i]; j++) {
- arr[arrIndex++] = bucket[i][j];
- }
- }
- // 将桶元素计数器清空
- bucketElementCount[i] = 0;
- }
-
- System.out.println("第2轮,对个位的排序处理 arr =" + Arrays.toString(arr));
-
- //for (int i = 0; i < bucket.length; i++) {
- // for (int j = 0; j < bucket[0].length; j++) {
- // System.out.printf("%d\t", bucket[i][j]);
- // }
- // System.out.println();
- //}
-
- }
-
-
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/SelectSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/SelectSort.java
deleted file mode 100644
index 7075249f..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/SelectSort.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package cn.lastwhisper.sort;
-
-import cn.lastwhisper.ArrayUtil;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class SelectSort {
-
- public static void main(String[] args) {
- //int[] arr = {101, 34, 119, 1};
- //selectSort1(arr);
- //System.out.println(Arrays.toString(arr));
-
- int[] arr = ArrayUtil.generateArrByRandom(100000);
- // 计算耗时
- long start = System.currentTimeMillis();
- selectSort(arr);
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
- }
-
- /**
- * 选择排序O(n^2)
- *
- * @param arr
- * @return void
- */
- public static void selectSort(int[] arr) {
- for (int i = 0; i < arr.length; i++) {
- int min = arr[i];
- int minIndex = i;
- // 找出[1+i...arr.length]范围内的最小值,和最小值索引
- for (int j = i + 1; j < arr.length; j++) {
- if (min > arr[j]) {
- min = arr[j];
- minIndex = j;
- }
- }
- // 交换最小值与第i个数的位置
- if (minIndex != i) {
- arr[minIndex] = arr[i];
- arr[i] = min;
- }
- }
- }
-
- /**
- * 算法的实现步骤
- *
- * @param arr
- * @return void
- */
- public static void selectSort1(int[] arr) {
- // 第1轮 {101, 34, 119, 1}
-
- // 1、找最小值
- // 最小值
- int min = arr[0];
- // 最小值索引
- int minIndex = 0;
- // {101, 34, 119, 1} 我们假设待排序数组第一个元素就是最小值,即min=arr[0],minIndex=0
- // 经过遍历后我们发现 min=1,minIndex=3
- for (int j = 0 + 1; j < arr.length; j++) {
- // 找最小的数
- if (min > arr[j]) {
- min = arr[j];
- minIndex = j;
- }
- }
- // 2、交换。minIndex是最小值所在位置,min是最小值
- if (minIndex != 0) {
- arr[minIndex] = arr[0];
- arr[0] = min;
- }
-
- System.out.printf("第1轮选择,数组:%s", Arrays.toString(arr));
- }
-
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/ShellSort.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/ShellSort.java
deleted file mode 100644
index c37c6de4..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/sort/ShellSort.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package cn.lastwhisper.sort;
-
-import java.util.Arrays;
-
-/**
- * @author cn.lastwhisper
- */
-public class ShellSort {
- public static void main(String[] args) {
- int[] arr = {8, 9, 1, 7, 2, 3, 5, 4, 6, 0};
- //int[] arr = ArrayUtil.generateArrByRandom(100000);
- // 计算耗时
- long start = System.currentTimeMillis();
- //shellSort1(arr); // 10490 ms
- shellSort2(arr); // 10490 ms
- long end = System.currentTimeMillis();
- System.out.println("耗时:" + (end - start) + " ms");
-
- System.out.printf("希尔排序(交换法),数组:%s\n", Arrays.toString(arr));
- }
-
-
- /**
- * 希尔排序(位移法)(插入排序)
- *
- * @param arr
- * @return void
- */
- public static void shellSort2(int[] arr) {
- // {8, 9, 1, 7, 2, 3, 5, 4, 6, 0}
- int gap = arr.length / 2;
- int j;
- int temp;
- while (gap > 0) {
- //gap=5,2,1,0
- // i=5——》{0,5}
- // i=6——》{1,6}
- // i=7——》{2,7}
- // i=8——》{3,8}
- // i=9——》{4,9}
- // 对每个数组进行插入排序;由于每个数组并不是真的存在的数组,而是一个大数组
- // 所以通过gap进行取值
- for (int i = gap; i < arr.length; i++) {
- j = i; // 缓存每个数组的起始下标
- temp = arr[i]; // 缓存每个数组的起始下标的数值
- if (temp < arr[j - gap]) {
- while (j - gap >= 0 && temp < arr[j - gap]) {
- // 从前往后移动
- arr[j] = arr[j - gap];
- j = j - gap;
- }
- //
- arr[j] = temp;
- }
- }
- gap = gap / 2;
- }
- }
-
- /**
- * 希尔排序(交换法)
- *
- * @param arr
- * @return void
- */
- public static void shellSort1(int[] arr) {
- // 第1轮 {8, 9, 1, 7, 2, 3, 5, 4, 6, 0}
- // 增量 gap=length/2
- int gap = arr.length / 2;
- int temp;
- while (gap > 0) {
- for (int i = gap; i < arr.length; i++) {
- // 交换
- for (int j = i - gap; j >= 0; j -= gap) {
- if (arr[j] > arr[j + gap]) {
- temp = arr[j + gap];
- arr[j + gap] = arr[j];
- arr[j] = temp;
- }
- }
- }
- gap = gap / 2;
- }
- }
-
- /**
- * 交换法希尔排序
- *
- * @param arr
- * @return void
- */
- public static void shellSortStudy(int[] arr) {
- // 第1轮 [8, 9, 1, 7, 2, 3, 5, 4, 6, 0]
- // 增量 gap=length/2
- int temp;
- for (int i = 5; i < arr.length; i++) {
- // 交换
- for (int j = i - 5; j >= 0; j -= 5) {
- if (arr[j] > arr[j + 5]) {
- temp = arr[j + 5];
- arr[j + 5] = arr[j];
- arr[j] = temp;
- }
- }
- }
- System.out.printf("第1轮插入,数组:%s\n", Arrays.toString(arr));
- // 第二轮 [3, 5, 1, 6, 0, 8, 9, 4, 7, 2]
- for (int i = 2; i < arr.length; i++) {
- // 交换
- for (int j = i - 2; j >= 0; j -= 2) {
- if (arr[j] > arr[j + 2]) {
- temp = arr[j + 2];
- arr[j + 2] = arr[j];
- arr[j] = temp;
- }
- }
- }
- System.out.printf("第2轮插入,数组:%s\n", Arrays.toString(arr));
- // 第二轮 [0, 2, 1, 4, 3, 5, 7, 6, 9, 8]
- for (int i = 1; i < arr.length; i++) {
- // 交换
- for (int j = i - 1; j >= 0; j -= 1) {
- if (arr[j] > arr[j + 1]) {
- temp = arr[j + 1];
- arr[j + 1] = arr[j];
- arr[j] = temp;
- }
- }
- }
- System.out.printf("第2轮插入,数组:%s\n", Arrays.toString(arr));
- }
-}
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/avl/AVLTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/avl/AVLTreeDemo.java
deleted file mode 100644
index 35463314..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/avl/AVLTreeDemo.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package cn.lastwhisper.tree.avl;
-
-/**
- * 平衡二叉树
- * @author cn.lastwhisper
- */
-public class AVLTreeDemo {
- public static void main(String[] args) {
- // 测试左旋转
- //int[] arr = {4, 3, 6, 5, 7, 8};
- // 测试右旋转
- //int[] arr = {10, 12, 8, 9, 7, 6};
- // 测试双旋转
- int[] arr = {10, 11, 7, 6, 8, 9};
- AVLTree avlTree = new AVLTree();
- for (int i = 0; i < arr.length; i++) {
- avlTree.add(new Node(arr[i]));
- }
- System.out.println("中序遍历");
- avlTree.infixOrder();
- Node avlTreeRoot = avlTree.getRoot();
- System.out.println("当前树的高度:" + avlTreeRoot.height());
- System.out.println("当前树的左子树高度:" + avlTreeRoot.left.height());
- System.out.println("当前树的右子树高度:" + avlTreeRoot.right.height());
- System.out.println("当前根结点:" + avlTreeRoot);
- }
-}
-
-/**
- * 二叉排序树
- */
-class AVLTree {
- // 根结点
- private Node root;
-
- public Node getRoot() {
- return root;
- }
-
- public void setRoot(Node root) {
- this.root = root;
- }
-
- // 查找结点
- public Node search(int value) {
- if (root != null) {
- return root.search(value);
- } else {
- return null;
- }
- }
-
- // 查找父结点
- public Node searchParent(int value) {
- if (root != null) {
- return root.searchParent(value);
- } else {
- return null;
- }
- }
-
- /**
- * 找到该结点左子树最小值,并删除这个最小值结点
- *
- * @param node
- * @return int 最小值结点
- */
- public int delRightTreeMin(Node node) {
- Node temp = node;
- // 找到右子结点的最小值结点
- while (temp.left != null) {
- temp = temp.left;
- }
- delNode(temp.value);
- return temp.value;
- }
-
- /**
- * 找到该结点左子树最大值,并删除这个最大值结点
- *
- * @param node
- * @return int 最大值
- */
- public int delLeftTreeMax(Node node) {
- Node temp = node;
- while (temp.right != null) {
- temp = temp.right;
- }
- delNode(temp.value);
- return temp.value;
- }
-
-
- // 根据value删除结点
- public void delNode(int value) {
- if (root == null) {
- return;
- } else {
- // 待删除结点
- Node targetNode = search(value);
- // 没有找到待删除结点
- if (targetNode == null) {
- return;
- }
- // 待删除结点的父结点
- Node parentNode = searchParent(value);
- // 1. 情况一:只有一个根结点
- if (root.left == null && root.right == null) {
- root = null;
- return;
- }
- // 2. 情况二:删除的结点是叶子结点(左右结点为空)
- if (targetNode.left == null && targetNode.right == null) {
- // 2.1 确定targetNode是parent的左子结点还是右子结点;
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // 左子结点
- parentNode.left = null;
- } else if (parentNode.right != null && parentNode.right.value == targetNode.value) {
- // 右子结点
- parentNode.right = null;
- }
- } else if (targetNode.left != null && targetNode.right != null) {
- // 3. 情况四:删除带有两个子结点的targetNode
- // 找到targetNode右子树的最小值,删除最小值结点,并将最小值赋值给targetNode
- //targetNode.value = delRightTreeMin(targetNode.right);
- targetNode.value = delLeftTreeMax(targetNode.left);
- } else {
- // 4. 情况三:删除只有一个子结点的targetNode
- // 4.1 确定targetNode的子结点是左子结点还是右子结点
- // targetNode的子结点是左子结点
- if (targetNode.left != null) {
- if (parentNode != null) {
- // 4.2 确定targetNode在parentNode上是左子结点还是右子结点
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // targetNode在parentNode上是左子结点
- parentNode.left = targetNode.left;
- } else {
- // targetNode在parentNode上是右子结点
- parentNode.right = targetNode.left;
- }
- } else {
- // targetNode为根结点时,parentNode==null
- // root = targetNode.left;即为删除target结点
- root = targetNode.left;
- }
- } else {
- if (parentNode != null) {
- //targetNode的子结点是右子结点
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // targetNode在parentNode上是左子结点
- parentNode.left = targetNode.right;
- } else {
- // targetNode在parentNode上是右子结点
- parentNode.right = targetNode.right;
- }
- } else {
- root = targetNode.right;
- }
- }
-
- }
-
-
- }
-
- }
-
- // 中序
- public void infixOrder() {
- if (root == null) {
- System.out.println("树空");
- } else {
- root.infixOrder();
- }
-
- }
-
- // 添加结点
- public void add(Node node) {
- if (root == null) {
- root = node;
- } else {
- root.add(node);
- }
- }
-
-}
-
-
-class Node {
- int value;
- Node left;
- Node right;
-
- public Node(int value) {
- this.value = value;
- }
-
- /**
- * 以当前某结点进行右旋转,降低左子树的高度
- */
- public void rightRotate() {
- // 1. 创建一个新结点,值等于当前结点的值
- Node newNode = new Node(this.value);
- // 2. 将新结点的右子树设置为当前结点的右子树
- newNode.right = this.right;
- // 3. 将新结点的左子树设置为当前结点的左子树的右子树(当前结点左子树最大的结点)
- newNode.left = this.left.right;
- // 4. 将当前结点的值设置为当前结点的左子树(结点)的值
- this.value = this.left.value;
- // 5. 将当前结点的左子树设置为当前结点左子树的左子树
- this.left = this.left.left;
- // 6. 将当期结点的右子树设置为新结点
- this.right = newNode;
- }
-
- /**
- * 以当前某结点进行左旋转,降低右子树的高度
- */
- public void leftRotate() {
- // 1. 创建一个新结点,值等于当前结点的值
- Node newNode = new Node(this.value);
- // 2. 将新结点的左子树设置为当前结点的左子树
- newNode.left = this.left;
- // 3. 将新结点的右子树设置为当前结点右子树的左子树
- newNode.right = this.right.left;
- // 4. 将当前结点的值设置为当前结点右子树的值
- this.value = this.right.value;
- // 5. 将当前结点的右子树设置为当前结点右子树的右子树
- this.right = this.right.right;
- // 6. 将当前结点左子树设置为新结点
- this.left = newNode;
- }
-
- /**
- * @return int 当前某结点左子树的高度
- */
- public int leftHeight() {
- if (this.left != null) {
- return this.left.height();
- } else {
- return 0;
- }
- }
-
- /**
- * @return int 当前某结点右子树的高度
- */
- public int rightHeight() {
- if (this.right != null) {
- return this.right.height();
- } else {
- return 0;
- }
- }
-
- /**
- * @return int 当前某结点的高度
- */
- public int height() {
- int leftHeight = this.left == null ? 0 : this.left.height();
- int rightHeight = this.right == null ? 0 : this.right.height();
- return Math.max(leftHeight, rightHeight) + 1;
- }
-
- /**
- * 查找结点
- *
- * @param value 结点的value
- * @return cn.cn.lastwhisper.tree.binarysorttree.Node
- */
- public Node search(int value) {
- // 1. 判断当前结点是否是查找的结点
- if (this.value == value) {
- return this;
- } else if (this.value > value && this.left != null) {
- // 2.1 当前结点的value大于value,往左边寻找
- return this.left.search(value);
- } else if (this.value < value && this.right != null) {
- // 2.2 当前结点的value小于value,往右边寻找
- return this.right.search(value);
- } else {
- // 3. this.left&&this.right==null,找不到该结点
- return null;
- }
- }
-
- // 查找结点的父结点
- public Node searchParent(int value) {
- // 1. 判断当前结点是否是查找结点的父结点
- if ((this.left != null && this.left.value == value) ||
- (this.right != null && this.right.value == value)) {
- return this;
- } else {
- if (this.value > value && this.left != null) {
- // 2.1 当前结点的value大于value,往左边寻找
- return this.left.searchParent(value);
- } else if (this.value < value && this.right != null) {
- // 2.2 当前结点的value小于value,往右边寻找
- return this.right.searchParent(value);
- } else {
- // 3. this.left&&this.right==null,找不到该结点的父结点
- return null;
- }
- }
- }
-
- // 中序
- public void infixOrder() {
- if (this.left != null) {
- this.left.infixOrder();
- }
- System.out.println(this);
- if (this.right != null) {
- this.right.infixOrder();
- }
- }
-
- /**
- * 以自身为根结点按规则添加左右子树
- * 规则:对于非叶子结点p,左结点小于p,右结点大于p
- * 满足AVL规则!!!
- * @param node
- * @return void
- */
- public void add(Node node) {
- // 1. 如果待添加结点为空直接返回
- if (node == null) {
- return;
- }
- if (this.value > node.value) {
- // 2.1 如果根结点大于待添加结点,将待添加结点放到左边
- if (this.left == null) {
- this.left = node;
- } else {
- this.left.add(node);
- }
- } else {
- // 2.2 如果根结点小于待添加结点,将待添加结点放到右边
- if (this.right == null) {
- this.right = node;
- } else {
- this.right.add(node);
- }
- }
-
- // 当添加完结点后,满足(右子树的高度-左子树的高度) > 1 ,进行左旋转
- if (this.rightHeight() - this.leftHeight() > 1) {
- // 如果当前结点的右子树的左子树的高度大于当前结点的右子树的右子树的高度
- if(this.right!=null&&(this.right.leftHeight()>this.right.rightHeight())){
- // 先当前结点的右子树进行右旋转,再左旋转
- this.right.rightRotate();
- }
- leftRotate();
- return;
- }
-
- // 当添加完结点后,满足(左子树的高度-右子树的高度) > 1 ,进行右旋转
- if (this.leftHeight() - this.rightHeight() > 1) {
- // 如果当前结点的左子树的右子树的高度大于当前结点的左子树的左子树的高度
- if (this.left != null && (this.left.rightHeight() > this.left.leftHeight())) {
- // 先对当前结点的左子树进行左旋转,再右旋转
- this.left.leftRotate();
- }
- rightRotate();
- }
-
- }
-
-
- @Override
- public String toString() {
- return "Node{" +
- "value=" + value +
- '}';
- }
-
-}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/binarysorttree/BinarySortTreeDemo.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/binarysorttree/BinarySortTreeDemo.java
deleted file mode 100644
index 11e4f8dc..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/binarysorttree/BinarySortTreeDemo.java
+++ /dev/null
@@ -1,299 +0,0 @@
-package cn.lastwhisper.tree.binarysorttree;
-
-/**
- * 二叉排序树
- * @author cn.lastwhisper
- */
-public class BinarySortTreeDemo {
- public static void main(String[] args) {
- int[] arr = {7, 3, 10, 12, 5, 1, 9, 2};
- BinarySortTree binarySortTree = new BinarySortTree();
- for (int i = 0; i < arr.length; i++) {
- binarySortTree.add(new Node(arr[i]));
- }
- System.out.println("中序遍历");
- binarySortTree.infixOrder();
-
- //binarySortTree.delNode(2); // 删除叶子结点
- //binarySortTree.delNode(1); // 删除只有一个子结点
- //binarySortTree.delNode(7); // 删除有两个子结点
-
- binarySortTree.delNode(2);
- binarySortTree.delNode(5);
- binarySortTree.delNode(9);
- binarySortTree.delNode(12);
- binarySortTree.delNode(7);
- binarySortTree.delNode(3);
- binarySortTree.delNode(1);
- binarySortTree.delNode(10);
- // 会报错
- //binarySortTree.delNode(10);
- //binarySortTree.delNode(1);
-
- System.out.println("删除结点后,中序遍历");
- binarySortTree.infixOrder();
- }
-
-}
-
-/**
- * 二叉排序树
- */
-class BinarySortTree {
- // 根结点
- private Node root;
-
- public Node getRoot() {
- return root;
- }
-
- public void setRoot(Node root) {
- this.root = root;
- }
-
- // 查找结点
- public Node search(int value) {
- if (root != null) {
- return root.search(value);
- } else {
- return null;
- }
- }
-
- // 查找父结点
- public Node searchParent(int value) {
- if (root != null) {
- return root.searchParent(value);
- } else {
- return null;
- }
- }
-
- /**
- * 找到该结点左子树最小值,并删除这个最小值结点
- *
- * @param node
- * @return int 最小值结点
- */
- public int delRightTreeMin(Node node) {
- Node temp = node;
- // 找到右子结点的最小值结点
- while (temp.left != null) {
- temp = temp.left;
- }
- delNode(temp.value);
- return temp.value;
- }
-
- /**
- * 找到该结点左子树最大值,并删除这个最大值结点
- *
- * @param node
- * @return int 最大值
- */
- public int delLeftTreeMax(Node node) {
- Node temp = node;
- while (temp.right != null) {
- temp = temp.right;
- }
- delNode(temp.value);
- return temp.value;
- }
-
-
- // 根据value删除结点
- public void delNode(int value) {
- if (root == null) {
- return;
- } else {
- // 待删除结点
- Node targetNode = search(value);
- // 没有找到待删除结点
- if (targetNode == null) {
- return;
- }
- // 待删除结点的父结点
- Node parentNode = searchParent(value);
- // 1. 情况一:只有一个根结点
- if (root.left == null && root.right == null) {
- root = null;
- return;
- }
- // 2. 情况二:删除的结点是叶子结点(左右结点为空)
- if (targetNode.left == null && targetNode.right == null) {
- // 2.1 确定targetNode是parent的左子结点还是右子结点;
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // 左子结点
- parentNode.left = null;
- } else if (parentNode.right != null && parentNode.right.value == targetNode.value) {
- // 右子结点
- parentNode.right = null;
- }
- } else if (targetNode.left != null && targetNode.right != null) {
- // 3. 情况四:删除带有两个子结点的targetNode
- // 找到targetNode右子树的最小值,删除最小值结点,并将最小值赋值给targetNode
- //targetNode.value = delRightTreeMin(targetNode.right);
- targetNode.value = delLeftTreeMax(targetNode.left);
- } else {
- // 4. 情况三:待删除结点只有一个子结点
- // 4.1 确定targetNode的子结点是左子结点还是右子结点
- // targetNode的子结点是左子结点
- if (targetNode.left != null) {
- if (parentNode != null) {
- // 4.2 确定targetNode在parentNode上是左子结点还是右子结点
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // targetNode在parentNode上是左子结点
- parentNode.left = targetNode.left;
- } else {
- // targetNode在parentNode上是右子结点
- parentNode.right = targetNode.left;
- }
- } else {
- // targetNode为根结点时,parentNode==null
- // root = targetNode.left;即为删除target结点
- root = targetNode.left;
- }
- } else {
- if (parentNode != null) {
- //targetNode的子结点是右子结点
- if (parentNode.left != null && parentNode.left.value == targetNode.value) {
- // targetNode在parentNode上是左子结点
- parentNode.left = targetNode.right;
- } else {
- // targetNode在parentNode上是右子结点
- parentNode.right = targetNode.right;
- }
- } else {
- root = targetNode.right;
- }
- }
-
- }
-
-
- }
-
- }
-
- // 中序
- public void infixOrder() {
- if (root == null) {
- System.out.println("树空");
- } else {
- root.infixOrder();
- }
-
- }
-
- // 添加结点
- public void add(Node node) {
- if (root == null) {
- root = node;
- } else {
- root.add(node);
- }
- }
-
-}
-
-
-class Node {
- int value;
- Node left;
- Node right;
-
- public Node(int value) {
- this.value = value;
- }
-
- /**
- * 查找结点
- *
- * @param value 结点的value
- * @return cn.cn.lastwhisper.tree.binarysorttree.Node
- */
- public Node search(int value) {
- // 1. 判断当前结点是否是查找的结点
- if (this.value == value) {
- return this;
- } else if (this.value > value && this.left != null) {
- // 2.1 当前结点的value大于value,往左边寻找
- return this.left.search(value);
- } else if (this.value < value && this.right != null) {
- // 2.2 当前结点的value小于value,往右边寻找
- return this.right.search(value);
- } else {
- // 3. this.left&&this.right==null,找不到该结点
- return null;
- }
- }
-
- // 查找结点的父结点
- public Node searchParent(int value) {
- // 1. 判断当前结点是否是查找结点的父结点
- if ((this.left != null && this.left.value == value) ||
- (this.right != null && this.right.value == value)) {
- return this;
- } else {
- if (this.value > value && this.left != null) {
- // 2.1 当前结点的value大于value,往左边寻找
- return this.left.searchParent(value);
- } else if (this.value < value && this.right != null) {
- // 2.2 当前结点的value小于value,往右边寻找
- return this.right.searchParent(value);
- } else {
- // 3. this.left&&this.right==null,找不到该结点的父结点
- return null;
- }
- }
- }
-
- // 中序
- public void infixOrder() {
- if (this.left != null) {
- this.left.infixOrder();
- }
- System.out.println(this);
- if (this.right != null) {
- this.right.infixOrder();
- }
- }
-
- /**
- * 以自身为根结点按规则添加左右子树
- * 规则:对于非叶子结点p,左结点小于p,右结点大于p
- *
- * @param node
- * @return void
- */
- public void add(Node node) {
- // 1. 如果待添加结点为空直接返回
- if (node == null) {
- return;
- }
- if (this.value > node.value) {
- // 2.1 如果根结点大于待添加结点,将待添加结点放到左边
- if (this.left == null) {
- this.left = node;
- } else {
- this.left.add(node);
- }
- } else {
- // 2.2 如果根结点小于待添加结点,将待添加结点放到右边
- if (this.right == null) {
- this.right = node;
- } else {
- this.right.add(node);
- }
- }
- }
-
-
- @Override
- public String toString() {
- return "Node{" +
- "value=" + value +
- '}';
- }
-
-}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/traversal/Solution.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/traversal/Solution.java
deleted file mode 100644
index 0e04f7db..00000000
--- a/algorithms/datastructure/src/main/java/cn/lastwhisper/tree/traversal/Solution.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package cn.lastwhisper.tree.traversal;
-
-import java.util.Stack;
-
-public class Solution {
- // 二叉树后序遍历的两种易写的非递归写法 - 我要吃栗子的文章 - 知乎
- //https://zhuanlan.zhihu.com/p/80578741
- public static void main(String[] args) {
- TreeNode root = new TreeNode(1);
- TreeNode treeNode2 = new TreeNode(2);
- TreeNode treeNode3 = new TreeNode(3);
- TreeNode treeNode4 = new TreeNode(4);
- TreeNode treeNode5 = new TreeNode(5);
- root.left = treeNode2;
- root.right = treeNode3;
- treeNode2.left = treeNode4;
- treeNode2.right = treeNode5;
-
- Solution solution = new Solution();
- //solution.preOrderTraversal(root);
- //solution.postOrderTraversal1(root);
- solution.postOrderTraversal2(root);
-
- }
-
- /**
- * 非递归先序遍历,遍历顺序:根左右
- * 需要使用一个栈
- */
- public void preOrderTraversal(TreeNode root) {
- Stack s = new Stack<>();
- TreeNode cur = root;
- while (cur != null || !s.isEmpty()) {
- while (cur != null) { // 经过并访问所有左节点
- System.out.println(cur.val);
- s.push(cur);
- cur = cur.left;
- }
- while (!s.isEmpty() && cur == null) cur = s.pop().right; // 自底向上找栈中节点的第一个非空右子树
- }
- }
-
- /**
- * 非递归后序遍历,遍历顺序:左右根
- * 使用两个栈
- * 参考非递归先序遍历的“根左右”顺序,使用栈反过来
- */
- public void postOrderTraversal1(TreeNode root) {
- Stack s = new Stack<>();
- Stack res = new Stack<>(); // 保存节点序列的栈
- TreeNode cur = root;
- while (cur != null || !s.isEmpty()) {
- while (cur != null) {
- res.push(cur.val);
- s.push(cur);
- cur = cur.right; // 修改处
- }
- if (!s.isEmpty()) {
- cur = s.pop();
- cur = cur.left; // 修改处
- }
- }
- while (!res.isEmpty()) System.out.println(res.pop());// 获取倒序的根右左序列
- }
-
- /**
- * 非递归后序遍历,遍历顺序:左右根
- * 使用一个栈
- */
- public void postOrderTraversal2(TreeNode root) {
- Stack s = new Stack<>();
- TreeNode cur = root;
- TreeNode pre = null; // 用于记录上一次访问的节点
- while(cur!=null || !s.isEmpty()) {
- while(cur!=null) {
- s.push(cur);
- cur = cur.left;
- }
- if(!s.isEmpty()) {
- cur = s.pop();
- if(cur.right==null || pre==cur.right) { // 访问节点的条件
- System.out.println(cur.val); // 访问
- pre = cur; // 这一步是记录上一次访问的节点
- cur = null; // 此处为了跳过下一次循环的访问左子节点的过程,直接进入栈的弹出阶段,因为但凡在栈中的节点,它们的左子节点都肯定被经过且已放入栈中。
- }
- else { // 不访问节点的条件
- s.push(cur); // 将已弹出的根节点放回栈中
- cur = cur.right; // 经过右子节点
- }
- }
- }
- }
-
-}
-
-class TreeNode {
- int val;
- TreeNode left;
- TreeNode right;
-
- TreeNode(int x) {
- val = x;
- }
-}
\ No newline at end of file
diff --git a/algorithms/datastructure/src/main/java/cn/lastwhisper/util/ArrayUtil.java b/algorithms/datastructure/src/main/java/cn/lastwhisper/util/ArrayUtil.java
new file mode 100644
index 00000000..b91dfa7c
--- /dev/null
+++ b/algorithms/datastructure/src/main/java/cn/lastwhisper/util/ArrayUtil.java
@@ -0,0 +1,24 @@
+package cn.lastwhisper.util;
+
+/**
+ * @author cn.lastwhisper
+ */
+public class ArrayUtil {
+
+ public static int[] generateArrByRandom(int max) {
+ int[] arr = new int[max];
+ for (int i = 0; i < max; i++) {
+ arr[i] = (int) (Math.random() * 8000000); // 生成一个[0,8000000) 的一个数
+ }
+ return arr;
+ }
+
+ public static int[] generateArrByOrder(int max) {
+ int[] arr = new int[max];
+ for (int i = 0; i < max; i++) {
+ arr[i] = i + 1;
+ }
+
+ return arr;
+ }
+}
diff --git a/algorithms/datastructure/src/main/java/time/TestString.java b/algorithms/datastructure/src/main/java/time/TestString.java
deleted file mode 100644
index f1ee2964..00000000
--- a/algorithms/datastructure/src/main/java/time/TestString.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package time;
-
-/**
- * @author lastwhisper
- */
-public class TestString {
-
- public void test() {
- String s = "a";
- s = s + "b" + "c";
- s = s + "b" + "c" + "d";
- System.out.println(s);
- }
-
-}
diff --git a/algorithms/datastructure/src/main/java/time/TimeTest.java b/algorithms/datastructure/src/main/java/time/TimeTest.java
deleted file mode 100644
index 369bc8ea..00000000
--- a/algorithms/datastructure/src/main/java/time/TimeTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package time;
-
-/**
- * @author cn.lastwhisper
- */
-public class TimeTest {
-
- public void test1() {
- int x = 1;
- for (int i = 0; i < 10000; i++) {
- x++;
- }
- }
-
- public void test2(int n) {
- int i = 1;
- while (i < n) {
- i = i * 2;
- }
- }
-
- public void test3(int n) {
- //for (i = 0; i < n; i++) {
- // for (j = 0; j < i; j++) {
- // for (k = 0; k < j; k++)
- // x = x + 2;
- // }
- //}
- }
-}
diff --git "a/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.go"
new file mode 100644
index 00000000..eb316f9f
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.go"
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力搜索,找出所有组合进行对比
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+func twoSum(numbers []int, target int) []int {
+ for i := 0; i < len(numbers); i++ {
+ for j := i + 1; j < len(numbers); j++ { // i + 1 是一个优化点
+ if i != j && numbers[i]+numbers[j] == target {
+ return []int{i + 1, j + 1}
+ }
+ }
+ }
+ return nil
+}
+
+func main() {
+ fmt.Println(twoSum([]int{2, 3, 4}, 6))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.go" "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.go"
new file mode 100644
index 00000000..6ad9d169
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.go"
@@ -0,0 +1,46 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:二分搜索
+ * (1)遍历数组,对每一个值 nums[i],在 nums 数组中进行 [i,n] 范围的二分搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*logn)
+ * 空间复杂度:O(1)
+ */
+func twoSum(numbers []int, target int) []int {
+ for i := 0; i < len(numbers); i++ {
+ j := bs(numbers, i, len(numbers)-1, target-numbers[i])
+ if j != -1 {
+ return []int{i + 1, j + 1}
+ }
+ }
+ return nil
+}
+
+func bs(nums []int, l int, r int, target int) int {
+ // 这里是“<=”因为 [l,r] 内所有值都是可能的目标
+ for l <= r {
+ mid := (l-r)/2 + r
+ if nums[mid] == target {
+ return mid
+ } else if nums[mid] > target {
+ r = mid - 1
+ } else {
+ l = mid + 1
+ }
+ }
+ return -1
+}
+
+func main() {
+ fmt.Println(twoSum([]int{2, 3, 4}, 6))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.go" "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.go"
new file mode 100644
index 00000000..f3b51b13
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.go"
@@ -0,0 +1,40 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(对撞指针)
+ * 这种思路的前提是数组有序
+ * (1)定义两个初始指针 l,r 分别指向数组头尾。
+ * (2)nums[l]+nums[r] > target,r--
+ * (3)nums[l]+nums[r] < target,l++
+ * (4)nums[l]+nums[r] == target,找到答案
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func twoSum(numbers []int, target int) []int {
+ l, r := 0, len(numbers)-1
+ // 这里不能等于,因为 index1 必须小于 index2
+ for l < r {
+ if numbers[l]+numbers[r] == target {
+ return []int{l + 1, r + 1}
+ } else if numbers[l]+numbers[r] < target {
+ l++
+ } else {
+ r--
+ }
+ }
+ return nil
+}
+
+func main() {
+ fmt.Println(twoSum([]int{2, 3, 4}, 6))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.go"
new file mode 100644
index 00000000..e8e1d727
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.go"
@@ -0,0 +1,34 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/reverse-string/
+ * 编号:344
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:对撞指针交换元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func reverseString(s []byte) {
+ l, r := 0, len(s)-1
+ for l < r {
+ c := s[l]
+ s[l] = s[r]
+ s[r] = c
+ l++
+ r--
+ }
+}
+
+func main() {
+ s := []byte{'h', 'e', 'l', 'l', 'o'}
+ fmt.Println(s)
+ reverseString(s)
+ fmt.Println(s)
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.go"
new file mode 100644
index 00000000..5df7b3ea
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.go"
@@ -0,0 +1,49 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/reverse-vowels-of-a-string/
+ * 编号:345
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:对撞指针条件交换元素
+ * 元音字母:a,e,i,o,u 大小写
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+func reverseVowels(s string) string {
+ l, r := 0, len(s)-1
+ chars := []uint8(s)
+ for l < r {
+ for l < r && !valid(chars[l]) {
+ l++
+ }
+ for l < r && !valid(chars[r]) {
+ r--
+ }
+ if l < r { // 需要判断
+ c := chars[l]
+ chars[l] = chars[r]
+ chars[r] = c
+ l++
+ r--
+ }
+ }
+ return string(chars)
+}
+
+func valid(c uint8) bool {
+ return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' ||
+ c == 'E' || c == 'I' || c == 'O' || c == 'U'
+}
+
+func main() {
+ s := "hello"
+ fmt.Println(s)
+ fmt.Println(reverseVowels(s))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.go"
new file mode 100644
index 00000000..19048a82
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.go"
@@ -0,0 +1,60 @@
+package main
+
+import "fmt"
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/merge-sorted-array/
+ * 编号:88
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:数组有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * 归并排序,归的过程。
+ * (1)从前到后比较(找小)复制只用 nums1,需要移动 nums1 中的元素,不如创建中间数据
+ * (2)从后到前比较(找大)复制只用 nums1,无需移动 nums1 中的元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+func merge(nums1 []int, m int, nums2 []int, n int) {
+ temp := make([]int, m+n)
+ // p1 是 num1 已拷贝数据的指针,[0,p1]
+ p1, p2, t := 0, 0, 0
+ // 从前到后找 num1 或 num2 最小的复制到 temp
+ for p1 < m && p2 < n {
+ if nums1[p1] > nums2[p2] {
+ temp[t] = nums2[p2]
+ p2++
+ } else {
+ temp[t] = nums1[p1]
+ p1++
+ }
+ t++
+ }
+ // 将 num1 中剩余的数据 copy 到 temp
+ for p1 < m {
+ temp[t] = nums1[p1]
+ t++
+ p1++
+ }
+ // 将 num2 中剩余的数据 copy 到 temp
+ for p2 < n {
+ temp[t] = nums2[p2]
+ t++
+ p2++
+ }
+ // 将 temp 中所有数据 copy 到 num1
+ for i := 0; i < len(temp); i++ {
+ nums1[i] = temp[i]
+ }
+}
+
+func main() {
+ nums1 := []int{1, 2, 3, 0, 0, 0}
+ nums2 := []int{2, 5, 6}
+ m := 3
+ n := 3
+ merge(nums1, m, nums2, n)
+ fmt.Println(nums1)
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.go" "b/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.go"
new file mode 100644
index 00000000..c0d54a69
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.go"
@@ -0,0 +1,47 @@
+package main
+
+import "fmt"
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/merge-sorted-array/
+ * 编号:88
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:数组有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * 从后向前复制
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func merge(nums1 []int, m int, nums2 []int, n int) {
+ // 从后到前找 num1 或 num2 最大的复制到 num1 末尾
+ p1, p2, end := m-1, n-1, m+n-1
+ for p1 >= 0 && p2 >= 0 {
+ if nums1[p1] > nums2[p2] {
+ nums1[end] = nums1[p1]
+ p1--
+ } else {
+ nums1[end] = nums2[p2]
+ p2--
+ }
+ end--
+ }
+ // 如果 num1 还没复制完,不用管,因为num1自身就是有序的
+ // 将 num2 中剩余的数据 copy 到 temp
+ for p2 >= 0 {
+ nums1[end] = nums2[p2]
+ end--
+ p2--
+ }
+}
+
+func main() {
+ nums1 := []int{1, 2, 3, 0, 0, 0}
+ nums2 := []int{2, 5, 6}
+ m := 3
+ n := 3
+ merge(nums1, m, nums2, n)
+ fmt.Println(nums1)
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.go"
new file mode 100644
index 00000000..6620e6b9
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.go"
@@ -0,0 +1,12 @@
+package main
+
+import "sort"
+
+func findKthLargest(nums []int, k int) int {
+ sort.Ints(nums)
+ return nums[len(nums)-k]
+}
+
+func main() {
+
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.go"
new file mode 100644
index 00000000..eb157e31
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.go"
@@ -0,0 +1,51 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * (1)双指针 l、r 维护一个滑动窗口
+ * (2)窗口的左边界在数组范围内,则循环继续
+ * (3)r未到数组尾且 sums 需要动态缩小窗口左边界
+ * (5)循环内每次找 sum >= s 时的最小长度
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // l 和 r 指针同时遍历了一遍数组 O(2n)
+ * 空间复杂度:O(1)
+ */
+func lengthOfLongestSubstring(s string) int {
+ freq := make([]uint8, 256)
+ // 窗口 [l,r] 内无重复元素
+ l, r, res := 0, 0, 0
+ for l < len(s) {
+ if r < len(s) && freq[s[r]] == 0 {
+ freq[s[r]]++
+ r++
+ } else {
+ freq[s[l]]--
+ l++
+ }
+ // 这里 r - l 不加一,因为 l、r 初始化值都是0,并且是先用在加的
+ res = max(res, r-l)
+ }
+ return res
+}
+
+func max(x int, y int) int {
+ if x > y {
+ return x
+ }
+ return y
+}
+
+func main() {
+ s := "abcabcbb"
+ fmt.Println(lengthOfLongestSubstring(s))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.go"
new file mode 100644
index 00000000..c67ee938
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.go"
@@ -0,0 +1,36 @@
+package main
+
+import (
+ "fmt"
+ "math"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/container-with-most-water/
+ * 编号:11
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(对撞指针)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func maxArea(height []int) int {
+ l, r, max := 0, len(height)-1, float64(-1)
+ for l < r {
+ if height[l] < height[r] {
+ max = math.Max(max, float64(height[l]*(r-l)))
+ l++
+ } else {
+ max = math.Max(max, float64(height[r]*(r-l)))
+ r--
+ }
+ }
+ return int(max)
+}
+
+func main() {
+ nums := []int{1, 8, 6, 2, 5, 4, 8, 3, 7}
+ fmt.Println(maxArea(nums))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.go"
new file mode 100644
index 00000000..7b603a86
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.go"
@@ -0,0 +1,60 @@
+package main
+
+import (
+ "fmt"
+ "math"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * (1)双指针 l、r 维护一个滑动窗口
+ * (2)窗口的左边界在数组范围内,则循环继续
+ * (3)r未到数组尾且 sums 需要动态缩小窗口左边界
+ * (5)循环内每次找 sum >= s 时的最小长度
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // l 和 r 指针同时遍历了一遍数组 O(2n)
+ * 空间复杂度:O(1)
+ */
+func minSubArrayLen(s int, nums []int) int {
+ // 滑动窗口[l,r]
+ l, r := 0, -1
+ // 窗口和
+ sum, result := 0, math.MaxInt64
+ // 窗口左边界未越界,说明窗口还可以继续扩容或者缩小
+ for l < len(nums) {
+ // sum= s {
+ result = min(result, r-l+1)
+ }
+ }
+ if result == math.MaxInt64 {
+ return 0
+ }
+ return result
+}
+
+func min(x int, y int) int {
+ if x > y {
+ return y
+ }
+ return x
+}
+
+func main() {
+ s := 7
+ nums := []int{2, 3, 1, 2, 4, 3}
+ fmt.Println(minSubArrayLen(s, nums))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.go" "b/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.go"
new file mode 100644
index 00000000..5e234415
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.go"
@@ -0,0 +1,54 @@
+package main
+
+import (
+ "fmt"
+ "math"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * (1)双指针 l、r 维护一个滑动窗口
+ * (2)窗口的左边界在数组范围内,则循环继续
+ * (3)r未到数组尾且 sums 需要动态缩小窗口左边界
+ * (5)循环内每次找 sum >= s 时的最小长度
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // l 和 r 指针同时遍历了一遍数组 O(2n)
+ * 空间复杂度:O(1)
+ */
+func minSubArrayLen(s int, nums []int) int {
+ // 窗口和
+ l, sum, result := 0, 0, math.MaxInt64
+ // 一直扩容右边界,直到sum >= s,缩小左边界
+ // 每次缩小,都计算最小子数组
+ for r := 0; r < len(nums); r++ {
+ sum += nums[r]
+ for sum >= s {
+ result = min(result, r-l+1)
+ sum -= nums[l]
+ l++
+ }
+ }
+ if result == math.MaxInt64 {
+ return 0
+ }
+ return result
+}
+
+func min(x int, y int) int {
+ if x > y {
+ return y
+ }
+ return x
+}
+
+func main() {
+ s := 7
+ nums := []int{2, 3, 1, 2, 4, 3}
+ fmt.Println(minSubArrayLen(s, nums))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.go"
new file mode 100644
index 00000000..51d91b90
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.go"
@@ -0,0 +1,37 @@
+package main
+
+import "fmt"
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/sort-colors/
+ * 编号:75
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:只有0,1,2
+ * -------------------------------------------------------------------
+ * 思路:
+ * 计数排序,统计每一个数出现的频率
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func sortColors(nums []int) {
+ freq := [3]int{}
+ for i := 0; i < len(nums); i++ {
+ freq[nums[i]]++
+ }
+ idx := 0
+ for i := 0; i < len(freq); i++ {
+ for freq[i] > 0 {
+ nums[idx] = i
+ idx++
+ freq[i]--
+ }
+ }
+}
+
+func main() {
+ var arr = []int{2, 0, 2, 1, 1, 0}
+ sortColors(arr)
+ fmt.Println(arr)
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.go" "b/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.go"
new file mode 100644
index 00000000..cc952a6d
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.go"
@@ -0,0 +1,51 @@
+package main
+
+import "fmt"
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/sort-colors/
+ * 编号:75
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:只有0,1,2
+ * -------------------------------------------------------------------
+ * 思路:
+ * 三路快速排序的思想,对整个数组只遍历了一遍
+ * (1)双指针 left=-1,right=n
+ * (2)下标 i 遍历数组,num[i]==1,i++
+ * (3)num[i]==0,将 0 移动到数组最前位置,swap(num,++left,i++)
+ * i++,即使 num[++left]==0,这次的交换和位移也是正确的
+ * (4)num[i]==2,将 2 移动到数组最后位置,swap(num,--right,i)
+ * i不变,因为有可能num[--right]==2
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func sortColors(nums []int) {
+ left := -1
+ right := len(nums)
+ for i := 0; i < right; {
+ if nums[i] == 1 {
+ i++
+ } else if nums[i] == 0 {
+ left++
+ swap(nums, left, i)
+ i++
+ } else if nums[i] == 2 {
+ right--
+ swap(nums, right, i)
+ }
+ }
+}
+
+func swap(nums []int, i, j int) {
+ temp := nums[i]
+ nums[i] = nums[j]
+ nums[j] = temp
+}
+
+func main() {
+ var arr = []int{2, 0, 2, 1, 1, 0}
+ sortColors(arr)
+ fmt.Println(arr)
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.go" "b/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.go"
new file mode 100644
index 00000000..e8d5b633
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.go"
@@ -0,0 +1,45 @@
+package main
+
+import (
+ "fmt"
+ "strings"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/valid-palindrome/
+ * 编号:125
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 对撞指针遍历比较
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+func isPalindrome(s string) bool {
+ upperS := strings.ToUpper(s)
+ l, r := 0, len(s)-1
+ for l < r {
+ for l < r && !valid(upperS[l]) {
+ l++
+ }
+ for l < r && !valid(upperS[r]) {
+ r--
+ }
+ if upperS[l] != upperS[r] {
+ return false
+ }
+ l++
+ r--
+ }
+ return true
+}
+
+func valid(c uint8) bool {
+ return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)
+}
+
+func main() {
+ fmt.Println(isPalindrome("A man, a plan, a canal: Panama"))
+}
diff --git "a/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution2.go" "b/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution2.go"
new file mode 100644
index 00000000..5aebc977
--- /dev/null
+++ "b/algorithms/go/algorithm/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution2.go"
@@ -0,0 +1,45 @@
+package main
+
+import (
+ "fmt"
+)
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/valid-palindrome/
+ * 编号:125
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 对撞指针遍历比较
+ * 统一转成大写:ch & 0b11011111 简写:ch & 0xDF
+ * 统一转成小写:ch | 0b00100000 简写:ch | 0x20
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+func isPalindrome(s string) bool {
+ l, r := 0, len(s)-1
+ for l < r { // 这里不能等于
+ for l < r && !valid(s[l]) {
+ l++
+ }
+ for l < r && !valid(s[r]) {
+ r--
+ }
+ if (s[l] & 0xDF) != (s[r] & 0xDF) {
+ return false
+ }
+ l++
+ r--
+ }
+ return true
+}
+
+func valid(c uint8) bool {
+ return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)
+}
+
+func main() {
+ fmt.Println(isPalindrome("A man, a plan, a canal: Panama"))
+}
diff --git a/algorithms/go/algorithm/leetcode/lc69.go b/algorithms/go/algorithm/leetcode/lc69.go
new file mode 100644
index 00000000..33b59de5
--- /dev/null
+++ b/algorithms/go/algorithm/leetcode/lc69.go
@@ -0,0 +1,15 @@
+package main
+
+import "fmt"
+
+func mySqrt(x int) int {
+
+
+ return 0
+}
+
+func main() {
+ fmt.Println(mySqrt(4))
+ fmt.Println(mySqrt(8))
+}
+
diff --git a/algorithms/interview/pom.xml b/algorithms/interview/pom.xml
index 495dea29..9d4710bc 100644
--- a/algorithms/interview/pom.xml
+++ b/algorithms/interview/pom.xml
@@ -3,13 +3,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- argorithms
+ algorithms
cn.lastwhisper
1.0-SNAPSHOT
4.0.0
- cn.lastwhisper
interview
diff --git a/algorithms/interview/src/main/java/Main.java b/algorithms/interview/src/main/java/Main.java
index aa3d3c30..a89bcd4c 100644
--- a/algorithms/interview/src/main/java/Main.java
+++ b/algorithms/interview/src/main/java/Main.java
@@ -1,3 +1,4 @@
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
@@ -24,13 +25,11 @@ public static void main(String[] args) {
如果没有该行,则执行第一个in.nextLine()命令时的返回值是int n = in.nextInt()的值*/
sc.nextLine();
- HashSet set = new HashSet();
+ HashSet set = new HashSet<>();
for (int i = 0; i < n; i++) {
String line =sc.nextLine();
String[] arr = line.split(" ");
- for (int j = 0; j < arr.length; j++) {
- set.add(arr[j]);
- }
+ set.addAll(Arrays.asList(arr));
}
System.out.println("sum:" + set.size());
}
diff --git "a/algorithms/interview/src/main/java/cn/lastwhisper/interview/dp/\346\225\264\346\225\260\347\232\204\345\210\206\350\247\243/Solution.java" "b/algorithms/interview/src/main/java/cn/lastwhisper/interview/dp/\346\225\264\346\225\260\347\232\204\345\210\206\350\247\243/Solution.java"
deleted file mode 100644
index 2b61598c..00000000
--- "a/algorithms/interview/src/main/java/cn/lastwhisper/interview/dp/\346\225\264\346\225\260\347\232\204\345\210\206\350\247\243/Solution.java"
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.lastwhisper.interview.dp.整数的分解;
-
-public class Solution
-{
- public static void main(String[] args)
- {
- int[] nums = {3,4,5,6,7};
- for (int num : nums) {
- System.out.println(num + "\t(" + decompose(num)+ ") 种");
- }
- }
-
- // 求整数的分数情况
- public static int decompose(int num) {
- if (num < 3) return 0;
-
- // 从3开始,构建二维数组
- int[][] results = new int[num+1][];
- for (int i = 3; i <= num; i++) {
- // 分解后最小数可能的种数
- int cols = (i-1)/2;
- results[i] = new int[cols+1];
- results[i][0] = 0;
- for (int j = 1; j <= cols; j++) {
- // 对于最小为j的情况,至少有一个分解
- int count = 1;
- int biger = i - j;
- if (biger > 2*j) {
- // 若大数为偶数,可以分解为biger/2 + biger/2
- if (biger % 2 == 0) count++;
- // 其余的分解可用biger的分解中最小数j的情况确定
- for (int k = j; k < results[biger].length; k++)
- count += results[biger][k];
- }
- results[i][j] = count;
- }
- }
-
- int total = 0;
- // 第num行所有的和为分解的所有情况
- for (int i = 0; i < results[num].length; i++)
- total += results[num][i];
- return total;
- }
-}
\ No newline at end of file
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/lejian/Test1.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/lejian/Test1.java
new file mode 100644
index 00000000..8d64005c
--- /dev/null
+++ b/algorithms/interview/src/main/java/cn/lastwhisper/interview/lejian/Test1.java
@@ -0,0 +1,113 @@
+package cn.lastwhisper.interview.lejian;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/**
+ * 最长对称子序列,本质上是在找最长公共子序列
+ *
+ * @author gaojun
+ *
+ */
+public class Test1 {
+
+ /**
+ * 输入一个字符串s,我们可以删除字符串s中的任意字符,让剩下的字符串形成一个对称字符串,且该字符串为最长对称字符串。
+ * 如:输入google,则找到最长对称字符串为goog;
+ * 如:输入abcda则能找到3个最长对称字符串为aba/aca/ada。
+ * 若最长对称字符串存在多个,则输出多个相同长度的最长对称字符串,且字符串中不包含特殊字符。
+ *
+ */
+ public static void main(String[] args) {
+ // TODO 输出最长对称字符串:goog
+ String input1 = "google";
+ System.out.println(findMaxSymmetry(input1));
+ // TODO 输出3个最长对称字符串:aba/aca/ada
+ String input2 = "abcda";
+ System.out.println(findMaxSymmetry(input2));
+ // TODO 输出2个最长对称字符串:pop/upu,不会输出特殊字符的对称字符串p-p
+ String input3 = "pop-upu";
+ System.out.println(findMaxSymmetry(input3));
+ }
+
+ /**
+ * 遍历生成的二维数组,递归查找最长路径
+ * @param a 第一个字符串
+ * @param b 第二个字符串
+ * @param mux 二维中间数组
+ * @param i 二维数组raw位置
+ * @param j 二维数组column位置
+ * @param path 一次查找的字符串
+ * @param paths 最终结果集合
+ */
+ private static void getAllLcs(String a, String b, int[][] mux, int i, int j, String path, Set paths) {
+ StringBuilder pathBuilder = new StringBuilder(path);
+ while (i > 0 && j > 0) {
+ if (a.charAt(i - 1) == b.charAt(j - 1)) {
+ pathBuilder.append(a.charAt(i - 1));
+ --i;
+ --j;
+ } else {
+ if (mux[i - 1][j] > mux[i][j - 1]) {
+ --i;
+ } else if (mux[i - 1][j] < mux[i][j - 1]) {
+ --j;
+ } else {
+ getAllLcs(a, b, mux, i - 1, j, pathBuilder.toString(), paths);
+ getAllLcs(a, b, mux, i, j - 1, pathBuilder.toString(), paths);
+ return;
+ }
+ }
+ }
+ paths.add(pathBuilder.toString());
+ }
+
+ /**
+ * 查找最大公共子序列
+ */
+ private static String findLCS(String input) {
+ if (input == null || input.length() == 0) {
+ return "";
+ }
+ String reverse = new StringBuilder(input).reverse().toString();
+ int len = input.length();
+ // 0行0列分别表示空串和input、reverse的 lcs 长度
+ // 初始状态
+ int[][] dp = new int[len + 1][len + 1];
+
+ for (int i = 1; i < len + 1; i++) {
+ for (int j = 1; j < len + 1; j++) {
+ if (input.charAt(i - 1) == reverse.charAt(j - 1)) {
+ // 找到一个 lcs 的元素
+ dp[i][j] = dp[i - 1][j - 1] + 1;
+ } else {
+ // 找 lcs 长度最长的。
+ dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
+ }
+ }
+ }
+
+ // 查找路径时,存在多个路径是一个字符串的情况,set去重。
+ Set paths = new HashSet<>();
+ getAllLcs(input, reverse, dp, input.length(), reverse.length(), "", paths);
+
+ return String.join("/", paths);
+ }
+
+ /**
+ * 包括对特殊字符,结果格式生成
+ * @param input 待处理字符串
+ */
+ public static String findMaxSymmetry(String input) {
+ String[] prepare = Pattern.compile("[^a-zA-Z0-9]").split(input);
+ StringBuilder sb = new StringBuilder();
+ for (String str : prepare) {
+ String result = findLCS(str);
+ sb.append(result);
+ sb.append("/");
+ }
+ return sb.substring(0, sb.length() - 1);
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/list/CountZero.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/list/CountZero.java
deleted file mode 100644
index b9869365..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/list/CountZero.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package cn.lastwhisper.interview.list;
-
-/**
- * @author lastwhisper
- */
-public class CountZero {
-
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom1/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom1/Main.java
deleted file mode 100644
index 9861d72e..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom1/Main.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.lastwhisper.interview.tangshang.perblom1;
-
-import java.util.*;
-
-/**
- * @author lastwhisper
- */
-public class Main {
-
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- int m = in.nextInt();
- System.out.println(move(n, m));
- }
-
- public static int move(int n, int m) {
-
- int count = 0;
- if (n == 1 || m == 1) {
- return 1;
- }
- if (n > 1) {
- count += move(n - 1, m);
- }
- if (m > 1) {
- count += move(n, m - 1);
- }
- return count;
- }
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom2/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom2/Main.java
deleted file mode 100644
index 496bab8e..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom2/Main.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.lastwhisper.interview.tangshang.perblom2;
-
-import java.util.Scanner;
-
-/**
- * @author lastwhisper
- */
-public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- int[] arr = new int[n];
- for (int i = 0; i < n; i++) {
- arr[i] = in.nextInt();
- }
- int max = arr[0];
- int piovt = 0;
- while (piovt < n) {
- int sum = 0;
- for (int i = piovt; i < n; i++) {
- sum += arr[i];
- if (max < sum) {
- max = sum;
- }
- }
- for (int i = 0; i < piovt; i++) {
- sum += arr[i];
- if (max < sum) {
- max = sum;
- }
- }
- piovt++;
- }
- System.out.println(max);
- }
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main.java
deleted file mode 100644
index 1bce9f56..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.lastwhisper.interview.tangshang.perblom3;
-
-import java.util.Scanner;
-
-/**
- * @author lastwhisper
- */
-public class Main {
-
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- Long n = in.nextLong();
- Long x = in.nextLong();
- for (Long i = n - x >= 10 ? n - x : 10; i < n; i++) {
- String ret = convert(n, i);
- if (Long.parseLong(ret) <= x) {
- System.out.println(i); //进制
- break;
- }
- }
-
- }
-
-
- public static String convert(Long decimal, Long radix) {
- StringBuilder sb = new StringBuilder();
- // 余数
- Long remainder = -1l;
- // 被除数
- Long divisor = decimal;
- while (divisor != 0 && divisor / radix >= 0) {
- remainder = divisor % radix; //取余
- divisor = divisor / radix; // 整除
- sb.append(remainder);
- }
- return sb.reverse().toString();
- }
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main1.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main1.java
deleted file mode 100644
index 644b2dad..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/tangshang/perblom3/Main1.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package cn.lastwhisper.interview.tangshang.perblom3;
-
-import java.util.Scanner;
-
-/**
- * @author lastwhisper
- */
-public class Main1 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- int x = in.nextInt();
- String xStr = String.valueOf(x);
- System.out.println(n - Integer.parseInt(xStr.substring(xStr.length() - 1)));
- }
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/perblom1/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/perblom1/Main.java
deleted file mode 100644
index 3f5b6178..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/perblom1/Main.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.lastwhisper.interview.wangyi.perblom1;
-
-import java.util.Scanner;
-
-/**
- *
- * @author lastwhisper
- */
-public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int[] arr = new int[n];
- for (int i = 0; i < n; i++) {
- arr[i] = sc.nextInt();
- }
- for (int i = 0; i < n; i++) {
- System.out.println(min(arr[i]));
- }
- }
-
- public static String min(int x) {
- int n9 = x / 9; // 5
- int a = x % 9; // 余数
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < n9; i++) {
- sb.append("9");
- }
- if (a != 0) {
- sb.append(a);
- }
- return sb.reverse().toString();
- }
-
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom2/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom2/Main.java
deleted file mode 100644
index 714205e3..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom2/Main.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.lastwhisper.interview.wangyi.problom2;
-
-import java.util.Scanner;
-
-/**
- * @author lastwhisper
- */
-public class Main {
-
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- for (int i = 0; i < n; i++) {
- int a = sc.nextInt();
- int b = sc.nextInt();
- int p = sc.nextInt();
- int q = sc.nextInt();
- int count = 1;
- while (a+p < b) {
- int temp1 = a + p;
- int temp2 = a + p * q;
- if (temp1 > temp2) {
- a = a + p;
- } else {
- p = p * q;
- }
- count++;
- }
- System.out.println(count);
- }
- }
-
-}
diff --git a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom4/Main.java b/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom4/Main.java
deleted file mode 100644
index 40a65726..00000000
--- a/algorithms/interview/src/main/java/cn/lastwhisper/interview/wangyi/problom4/Main.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cn.lastwhisper.interview.wangyi.problom4;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Scanner;
-
-/**
- * @author lastwhisper
- */
-public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int[] arr = new int[n];
- for (int i = 0; i < n; i++) {
- arr[i] = sc.nextInt();
- }
- int count = 0;
- for (int i = 0; i < n; i++) {
- for (int j = i+1; j < n; j++) {
- if (arr[i] > arr[j]) {
- count+=j-i;
- }
- }
- }
- System.out.println(count);
- }
-
-}
diff --git "a/algorithms/interview/src/main/java/cn/lastwhisper/interview/\347\276\216\345\233\242\347\202\271\350\257\204/\345\220\210\345\271\266\351\207\221\345\270\201/Test01.java" "b/algorithms/interview/src/main/java/cn/lastwhisper/interview/\347\276\216\345\233\242\347\202\271\350\257\204/\345\220\210\345\271\266\351\207\221\345\270\201/Test01.java"
new file mode 100644
index 00000000..28c442e5
--- /dev/null
+++ "b/algorithms/interview/src/main/java/cn/lastwhisper/interview/\347\276\216\345\233\242\347\202\271\350\257\204/\345\220\210\345\271\266\351\207\221\345\270\201/Test01.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.interview.美团点评.合并金币;
+
+
+import java.util.Scanner;
+
+public class Test01 {
+ /**
+ * 有 N 堆金币排成一排,第 i 堆中有 C[i]块金币。 每次合并都会将相邻的两堆金币合并为一堆,成本为这两堆金币块数之和。
+ * 经过N-1次合并,最终将所有金币合并为一堆。请找出将金币合并为一堆的最低成本。
+ *
+ * 比如,n=3时表示共有3堆金币,每堆重量分别是2、1、9.
+ * 一种合并方案是2和9合并,新堆重量是11,消耗体力为11;
+ * 接着11和1合并,新堆重量是12,消耗体力为12,因此总消耗体力是11+12=23。
+ * 另一种方案是:1和2合并,新堆重量是3,消耗体力为3;
+ * 接着3和9合并,新堆重量是12,消耗体力为12,因此总消耗体力是3+12=15。可以证明这就是最少消耗体力。
+ *
+ * 其中,1 <= N <= 30,1 <= C[i] <= 100
+ *
+ * f[i,j]=min{f[i,k]+f[k+1,j]+sum[i,j]|i<=k 0)
+ dp[i][i + l] = min + sum[i + l] - sum[i - 1];
+ else dp[i][i + l] = min + sum[l];
+ }
+ }
+ System.out.println(dp[0][n - 1]);
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < n; j++) {
+ System.out.print(dp[i][j] + " ");
+ }
+ System.out.println();
+ }
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/array/pom.xml b/algorithms/leetcode/array/pom.xml
index d86e8f28..6689d525 100644
--- a/algorithms/leetcode/array/pom.xml
+++ b/algorithms/leetcode/array/pom.xml
@@ -13,4 +13,13 @@
array
+
+
+ algorithm-common
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..3114b286
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.array.两数之和_II_输入有序数组_167_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力搜索,找出所有组合进行对比
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public int[] twoSum(int[] numbers, int target) {
+ if (numbers == null || numbers.length < 2) {
+ throw new IllegalArgumentException("Illegal argument numbers");
+ }
+ for (int i = 0; i < numbers.length; i++) {
+ for (int j = i + 1; j < numbers.length; j++) {// i + 1 是一个优化点
+ if (i != j && numbers[i] + numbers[j] == target) {
+ return new int[]{i + 1, j + 1};
+ }
+ }
+ }
+ throw new IllegalStateException("No results found");
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2}, new Solution1().twoSum(new int[]{2, 7, 11, 15}, 9));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..d6b0e31b
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,57 @@
+package cn.lastwhisper.leetcode.array.两数之和_II_输入有序数组_167_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:二分搜索
+ * (1)遍历数组,对每一个值 nums[i],在 nums 数组中进行 [i,n] 范围的二分搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*logn)
+ * 空间复杂度:O(1)
+ */
+ public int[] twoSum(int[] numbers, int target) {
+ if (numbers == null || numbers.length < 2) {
+ throw new IllegalArgumentException("Illegal argument numbers");
+ }
+ for (int i = 0; i < numbers.length; i++) {
+ int j = bs(numbers, i, numbers.length - 1, target - numbers[i]);
+ if (j != -1) {
+ return new int[]{i + 1, j + 1};
+ }
+ }
+ throw new IllegalStateException("No results found");
+ }
+
+ /**
+ * @param nums 待搜索数组
+ * @param l 起始索引
+ * @param r 终止索引
+ * @param target 目标数值
+ * @return int 目标数值在数组中的索引
+ */
+ private int bs(int[] nums, int l, int r, int target) {
+ // 这里是“<=”因为 [l,r] 内所有值都是可能的目标
+ while (l <= r) {
+ int mid = (l - r) / 2 + r;
+ if (nums[mid] == target) {
+ return mid;
+ } else if (nums[mid] > target) {
+ r = mid - 1;
+ } else {
+ l = mid + 1;
+ }
+ }
+ return -1;
+ }
+
+ public static void main(String[] args) {
+ //Assert.assertArrayEquals(new int[]{1, 2}, new Solution2().twoSum(new int[]{2, 7, 11, 15}, 9));
+ Assert.assertArrayEquals(new int[]{1, 3}, new Solution2().twoSum(new int[]{2, 3, 4}, 6));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..3cb95cf3
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.array.两数之和_II_输入有序数组_167_简单;
+
+import org.junit.Assert;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
+ * 编号:167
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(对撞指针)
+ * 这种思路的前提是数组有序
+ * (1)定义两个初始指针 l,r 分别指向数组头尾。
+ * (2)nums[l]+nums[r] > target,r--
+ * (3)nums[l]+nums[r] < target,l++
+ * (4)nums[l]+nums[r] == target,找到答案
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int[] twoSum(int[] numbers, int target) {
+ if (numbers == null || numbers.length < 2) {
+ throw new IllegalArgumentException("Illegal argument numbers");
+ }
+ int l = 0, r = numbers.length - 1;
+ // 这里不能等于,因为 index1 必须小于 index2
+ while (l < r) {
+ if (numbers[l] + numbers[r] == target) {
+ return new int[]{l + 1, r + 1};
+ } else if (numbers[l] + numbers[r] < target) {
+ l++;
+ } else {
+ r--;
+ }
+ }
+ throw new IllegalStateException("No results found");
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 3}, new Solution3().twoSum(new int[]{2, 3, 4}, 6));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\275\277\346\225\260\347\273\204\345\224\257\344\270\200\347\232\204\346\234\200\345\260\217\345\242\236\351\207\217_945_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\275\277\346\225\260\347\273\204\345\224\257\344\270\200\347\232\204\346\234\200\345\260\217\345\242\236\351\207\217_945_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..42c50331
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\344\275\277\346\225\260\347\273\204\345\224\257\344\270\200\347\232\204\346\234\200\345\260\217\345\242\236\351\207\217_945_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,25 @@
+package cn.lastwhisper.leetcode.array.使数组唯一的最小增量_945_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-increment-to-make-array-unique/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int minIncrementForUnique(int[] A) {
+
+ return 0;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(6, new Solution1().minIncrementForUnique(new int[]{3, 2, 1, 2, 1, 7}));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution1.java"
deleted file mode 100644
index 2a60a1ba..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution1.java"
+++ /dev/null
@@ -1,32 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.删除排序数组中的重复项_26_Easy;
-
-
-import java.util.Arrays;
-
-public class Solution1 {
- public int removeDuplicates(int[] nums) {
- if (nums == null || nums.length == 0) {
- return 0;
- }
- int len = nums.length;
- // 区间[0,...,pos]均为第一次出现元素
- int pos = 0;
- // nums[0]肯定是第一次出现,所以i从1开始
- for (int i = 1; i < len; i++) {
- // 如果第一(pos)个元素与第二(i)个元素不等(以此类推),说明是第一次出现。
- if (nums[pos] != nums[i]) {
- pos++;
- nums[pos] = nums[i];
- }
- }
- return pos + 1;
- }
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0,0,1,1,2,3,4,4};
- System.out.println("原数组长度:" + arr.length);
- int length = new Solution1().removeDuplicates(arr);
- System.out.println("现数组长度:" + length);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution2.java"
deleted file mode 100644
index 2486d811..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_Easy/Solution2.java"
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.删除排序数组中的重复项_26_Easy;
-
-
-import java.util.Arrays;
-
-public class Solution2 {
-
- public int removeDuplicates(int[] nums) {
- if (nums == null || nums.length == 0) {
- return 0;
- }
- // 区间[0,...,pos]均为第一次出现元素
- int pos = 0;
- // 数字可出现的次数
- int frequency = 1;
- for (int n : nums) {
- if (pos < frequency || n > nums[pos - frequency]) {
- nums[pos++] = n;
- }
- }
- return pos;
- }
-
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 0, 1, 1, 2, 3, 4, 4, 4, 4, 4};
- System.out.println("原数组长度:" + arr.length);
- int length = new Solution2().removeDuplicates(arr);
- System.out.println("现数组长度:" + length);
- System.out.println(Arrays.toString(arr));
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_Medium/Solution1.java"
deleted file mode 100644
index 6463cdb6..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_Medium/Solution1.java"
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.删除排序数组中的重复项_II_80_Medium;
-
-public class Solution1 {
- public int removeDuplicates(int[] nums) {
- if (nums == null || nums.length == 0) {
- return 0;
- }
- // 区间[0,...,pos]每个元素最多出现两次
- int pos = 0;
- // 数字可出现的次数
- int frequency = 2;
- for (int n : nums) {
- if (pos < frequency || n > nums[pos - frequency]) {
- nums[pos++] = n;
- }
- }
- return pos;
- }
-
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 0, 1, 1, 1, 1, 2, 3, 3};
- System.out.println("原数组长度:" + arr.length);
- int length = new Solution1().removeDuplicates(arr);
- System.out.println("现数组长度:" + length);
- for (int i = 0; i < length; i++) {
- if (i != length - 1) {
- System.out.print(arr[i] + ",");
- } else {
- System.out.print(arr[i]);
- }
- }
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution1.java"
deleted file mode 100644
index 37e1a1e9..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution1.java"
+++ /dev/null
@@ -1,50 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.合并两个有序数组_88_Easy;
-
-import java.util.Arrays;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/merge-sorted-array/
- * 合并两个有序数组
- * 核心思路:归并排序,并的算法思路
- */
- public void merge(int[] nums1, int m, int[] nums2, int n) {
- if (nums1 == null|| nums1.length == 0 || nums2 == null ) {
- return;
- }
- int[] temp = new int[m + n];
- int p0 = 0, p1 = 0, index = 0;
- while (p0 < m && p1 < n) {
- int num1 = nums1[p0];
- int num2 = nums2[p1];
- if (num1 <= num2) {
- temp[index++] = num1;
- p0++;
- } else {
- temp[index++] = num2;
- p1++;
- }
- }
- while (p0 < m) {
- temp[index++] = nums1[p0];
- p0++;
- }
- while (p1 < n) {
- temp[index++] = nums2[p1];
- p1++;
- }
-
- for (int i = 0; i < temp.length; i++) {
- nums1[i] = temp[i];
- }
-
- }
-
- public static void main(String[] args) {
- int[] nums1 = {1, 2, 3, 0, 0, 0};
- int[] nums2 = {2, 5, 6};
- new Solution1().merge(nums1, 3, nums2, 3);
- System.out.println(Arrays.toString(nums1));
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution2.java"
deleted file mode 100644
index 66d1aaf7..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_Easy/Solution2.java"
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.合并两个有序数组_88_Easy;
-
-import java.util.Arrays;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/merge-sorted-array/
- * 核心思想:从后向前合并,不需要额外的空间
- *
- */
- public void merge(int[] nums1, int m, int[] nums2, int n) {
- if (nums1 == null || nums1.length == 0 || nums2 == null) {
- return;
- }
- int p = m-- + n-- - 1;// num1和num2合并后的空间大小
- while (m >= 0 && n >= 0) {
- nums1[p--] = nums1[m] > nums2[n] ? nums1[m--] : nums2[n--];
- }
- // 如果nums1还没合并完,num2合并完了
- // 此时不用管,因为num1自身就是有序的,同时num1还是容器
- // 如果nums1合并完了,num2还没合并完
- while (n > 0) {
- nums1[p--] = nums2[n--];
- }
-
- }
-
- public static void main(String[] args) {
- int[] nums1 = {1, 2, 3, 0, 0, 0};
- int[] nums2 = {2, 5, 6};
- new Solution2().merge(nums1, 3, nums2, 3);
- System.out.println(Arrays.toString(nums1));
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution1.java"
deleted file mode 100644
index 359ca757..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution1.java"
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.数组中的第K个最大元素_215_Medium;
-
-class Solution1 {
- /**
- * 利用快排partition思想,将pivot放置在了其正确的位置上的性质
- */
- public int findKthLargest(int[] nums, int k) {
- return partition(nums, 0, nums.length - 1, nums.length - k);
- }
-
- public int partition(int[] nums, int leftBound, int rightBound, int k) {
- int left = leftBound;
- int right = rightBound;
- int pivot = nums[leftBound];
- while (left < right) {
- while (left < right && nums[left] <= pivot) {
- left++;
- }
- while (left < right && nums[right] > pivot) {
- right--;
- }
- if (left < right) {
- swap(nums, left, right);
- }
- }
- if (left == k) {
- return pivot;
- } else if (left > k) {
- return partition(nums, leftBound, left - 1, k);
- } else {
- return partition(nums, left + 1, rightBound, k);
- }
- }
-
- public void swap(int[] arr, int i, int j) {
- int temp = arr[j];
- arr[j] = arr[i];
- arr[i] = temp;
- }
-
- public static void main(String[] args) {
- int[] arr = {3, 2, 3, 1, 2, 4, 5, 5, 6};
- int k = 4;
- int kthLargest = new Solution1().findKthLargest(arr, k);
- System.out.println(kthLargest);
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution2.java"
deleted file mode 100644
index b5e481a7..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_Medium/Solution2.java"
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.数组中的第K个最大元素_215_Medium;
-
-class Solution2 {
- /**
- * 利用堆排序思想
- * O(n)桶排思想
- */
- public int findKthLargest(int[] nums, int k) {
- int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
- for (int i : nums) {
- max = Math.max(max, i);
- min = Math.min(min, i);
- }
- int n = max - min;
- int[] bucket = new int[n + 1];
- for (int i = 0; i < nums.length; i++) {
- int tmp = nums[i] - min;
- bucket[tmp]++;
- }
- for (int i = n; i >= 0; i--) {
- if (bucket[i] > 0)
- k -= bucket[i];
- if (k <= 0)
- return i + min;
- }
- return 0;
- }
-
-
- public static void main(String[] args) {
- int[] arr = {3, 2, 3, 1, 2, 4, 5, 5, 6};
- int k = 4;
- int kthLargest = new Solution2().findKthLargest(arr, k);
- System.out.println(kthLargest);
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution1.java"
deleted file mode 100644
index abd8f159..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution1.java"
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.有效的字母异位词_242_Easy;
-
-import java.util.HashMap;
-import java.util.Map;
-
-class Solution1 {
- public boolean isAnagram(String s, String t) {
- char[] sChar = s.toCharArray();
- char[] tChar = t.toCharArray();
- HashMap map = new HashMap<>();
- for (int i = 0; i < sChar.length; i++) {
- Integer num = map.get(sChar[i]);
- if (num == null) {
- map.put(sChar[i], 1);
- } else {
- map.put(sChar[i], ++num);
- }
- }
-
- for (int i = 0; i < tChar.length; i++) {
- Integer num = map.get(tChar[i]);
- if (num == null) {
- return false;
- } else {
- map.put(tChar[i], --num);
- }
- }
- for (Map.Entry entry : map.entrySet()) {
- if (entry.getValue() != 0) {
- return false;
- }
- }
- return true;
- }
-
- public static void main(String[] args) {
- //String s = "anagram", t = "nagaram";
- String s = "rat", t = "car";
-
- System.out.println(new Solution1().isAnagram(s, t));
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution2.java"
deleted file mode 100644
index efe5b09d..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_Easy/Solution2.java"
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.有效的字母异位词_242_Easy;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/valid-anagram/submissions/
- * hash
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public boolean isAnagram(String s, String t) {
- if (s.length() != t.length()) {
- return false;
- }
- char[] sChar = s.toCharArray();
- char[] tChar = t.toCharArray();
- byte[] freq = new byte[256];
- for (int i = 0; i < sChar.length; i++) {
- freq[sChar[i]]++;
- }
-
- for (int i = 0; i < tChar.length; i++) {
- freq[tChar[i]]--;
- }
- for (int i = 0; i < freq.length; i++) {
- if (freq[i] != 0) {
- return false;
- }
- }
- return true;
- }
-
- public static void main(String[] args) {
- String s = "anagram", t = "nagaram";
- //String s = "rat", t = "car";
-
- System.out.println(new Solution2().isAnagram(s, t));
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution1.java"
deleted file mode 100644
index c5624e60..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution1.java"
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.移动零_283_Easy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class Solution1 {
- //时间复杂度:O(n)
- //空间复杂度:O(n)
- public void moveZeroes(int[] nums) {
- // 缓存非0元素
- List nonZeroElements = new ArrayList();
- // 找出非0元素并将它缓存进nonZeroElements
- for (int i = 0; i < nums.length; i++) {
- if (nums[i] != 0) {
- nonZeroElements.add(nums[i]);
- }
- }
- // 将非0元素放入原数组中
- for (int i = 0; i < nonZeroElements.size(); i++) {
- nums[i] = nonZeroElements.get(i);
- }
- // 将原数组剩余的位置放置为0
- for (int i = nonZeroElements.size(); i < nums.length; i++) {
- nums[i] = 0;
- }
- }
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 1, 0, 3, 12};
- new Solution1().moveZeroes(arr);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution2.java"
deleted file mode 100644
index d7910c5a..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution2.java"
+++ /dev/null
@@ -1,29 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.移动零_283_Easy;
-
-
-import java.util.Arrays;
-
-public class Solution2 {
- public void moveZeroes(int[] nums) {
- // k保证从[0,...,k)均为非零元素
- int k = 0;
- // 遍历到第i个元素后,保证[0,...,i]中所有非零元素,
- // 都按顺序排列在[0,...,k)中
- for (int i = 0; i < nums.length; i++) {
- if (nums[i] != 0) {
- nums[k] = nums[i];
- k++;
- }
- }
- // 同时保证[k,...,nums.length]中均为零元素
- for (int i = k; i < nums.length; i++) {
- nums[i] = 0;
- }
- }
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 1, 0, 3, 12};
- new Solution2().moveZeroes(arr);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution3.java"
deleted file mode 100644
index 944a5029..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\345\212\250\351\233\266_283_Easy/Solution3.java"
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.移动零_283_Easy;
-
-
-import java.util.Arrays;
-
-public class Solution3 {
- public void moveZeroes(int[] nums) {
- // k保证从[0,...,k)均为非零元素
- int k = 0;
- // temp用于交换时暂存数据
- int temp = 0;
- // 遍历到第i个元素后,保证[0,...,i]中所有非零元素,都按顺序排列在[0,...,k)中
- // 同时保证[k,...,i]中均为零元素
- for (int i = 0; i < nums.length; i++) {
- if (nums[i] != 0) {
- // 防止全为非零元素
- if (i != k) {
- temp = nums[k];
- nums[k] = nums[i];
- nums[i] = temp;
- k++;
- } else {
- k++;
- }
- }
- }
- }
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 1, 0, 3, 12};
- new Solution3().moveZeroes(arr);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\351\231\244\345\205\203\347\264\240_27_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\351\231\244\345\205\203\347\264\240_27_Easy/Solution1.java"
deleted file mode 100644
index bfcb01ae..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\347\247\273\351\231\244\345\205\203\347\264\240_27_Easy/Solution1.java"
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.移除元素_27_Easy;
-
-import java.util.Arrays;
-
-public class Solution1 {
- public int removeElement(int[] nums, int val) {
- if (nums == null || nums.length == 0) {
- return 0;
- }
- int len = nums.length;
- // 区间[0,...,pos)均为不等于val的元素
- int pos = 0;
- // nums中不等于val的值,按顺序移动到nums数组的前面。
- for (int i = 0; i < len; i++) {
- if (nums[i] != val) {
- nums[pos] = nums[i];
- pos++;
- }
- }
- return pos;
- }
-
- //以下为测试代码
- public static void main(String[] args) {
- int[] arr = {0, 1, 2, 2, 3, 0, 4, 2};
- System.out.println("原数组长度:" + arr.length);
- int length = new Solution1().removeElement(arr, 2);
- System.out.println("现数组长度:" + length);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution1.java"
deleted file mode 100644
index f2d148ee..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution1.java"
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.颜色分类_75_Medium;
-
-import java.util.Arrays;
-
-public class Solution1 {
-
- /**
- * 题目:https://leetcode-cn.com/problems/sort-colors/
- * 计数排序
- * 核心思想:统计每一个数出现的频率
- * 时间复杂度:O(n)
- * 时间复杂度:O(1)
- */
- public void sortColors(int[] nums) {
- if (nums == null || nums.length == 0) {
- return;
- }
- int[] count = new int[3];
- for (int i = 0; i < nums.length; i++) {
- count[nums[i]]++;
- }
-
- for (int i = 0; i < count[0]; i++) {
- nums[i] = 0;
- }
- for (int i = count[0]; i < count[0] + count[1]; i++) {
- nums[i] = 1;
- }
- for (int i = count[0] + count[1]; i < count[0] + count[1] + count[2]; i++) {
- nums[i] = 2;
- }
- }
-
- // 优化
- public void sortColors1(int[] nums) {
- if (nums == null || nums.length == 0) {
- return;
- }
- int[] count = new int[3];
- for (int i = 0; i < nums.length; i++) {
- count[nums[i]]++;
- }
- int index = 0;
- for (int i = 0; i < 3; i++) {
- int itemCount = count[i];
- while (itemCount-- > 0) {
- nums[index++] = i;
- }
- }
- }
-
- public static void main(String[] args) {
- int[] arr = {2, 0, 2, 1, 1, 0};
- new Solution1().sortColors(arr);
- System.out.println(Arrays.toString(arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution2.java"
deleted file mode 100644
index 7ea3427d..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\205\266\344\273\226/\351\242\234\350\211\262\345\210\206\347\261\273_75_Medium/Solution2.java"
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.lastwhisper.leetcode.array.其他.颜色分类_75_Medium;
-
-import java.util.Arrays;
-
-/**
- * @author lastwhisper
- */
-public class Solution2 {
-
- /**
- * 题目:https://leetcode-cn.com/problems/sort-colors/
- * 三路快速排序的思想,对整个数组只遍历了一遍
- * 时间复杂度: O(n)
- * 空间复杂度: O(1)
- */
- public void sortColors(int[] nums) {
- if (nums == null || nums.length == 0) {
- return;
- }
- int zero = 0, two = nums.length;
- for (int i = 0; i < two; ) { // 小于two与i不加相对应
- int num = nums[i];
- if (num == 1) {
- i++;
- } else if (num == 0) {
- swap(nums, zero++, i++);
- } else if (num == 2) {
- swap(nums, --two, i);// i不加
- }
- }
- }
-
- public void swap(int[] arr, int i, int j) {
- int temp = arr[j];
- arr[j] = arr[i];
- arr[i] = temp;
- }
-
- public static void main(String[] args) {
- int[] arr = {2, 0, 2, 1, 1, 0};
- new Solution2().sortColors(arr);
- System.out.println(Arrays.toString(arr));
- }
-
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..3dab2b3b
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.array.删除排序数组中的重复项_26_简单;
+
+
+import org.junit.Assert;
+
+public class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
+ * 编号:26
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:从小到大有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * 双指针
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int removeDuplicates(int[] nums) {
+ // 特判
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ // 区间[0,...,pos]均为第一次出现元素
+ int pos = 0;
+
+ for (int i = 1; i < nums.length; i++) {
+ if (nums[pos] != nums[i]) {
+ nums[++pos] = nums[i];
+ }
+ }
+ return pos + 1;
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] nums = {0, 0, 1, 1, 2, 3, 4, 4};
+ Assert.assertEquals(5, new Solution1().removeDuplicates(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..8e1ec9fb
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_26_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,30 @@
+package cn.lastwhisper.leetcode.array.删除排序数组中的重复项_26_简单;
+
+
+import org.junit.Assert;
+
+public class Solution2 {
+
+ public int removeDuplicates(int[] nums) {
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ // 区间[0,...,pos]均为第一次出现元素
+ int pos = 0;
+ // 数字可出现的次数
+ int frequency = 1;
+ for (int n : nums) {
+ if (pos < frequency || n > nums[pos - frequency]) {
+ nums[pos++] = n;
+ }
+ }
+ return pos;
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] nums = {0, 0, 1, 1, 2, 3, 4, 4};
+ Assert.assertEquals(5, new Solution2().removeDuplicates(nums));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..d8382336
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,40 @@
+package cn.lastwhisper.leetcode.array.删除排序数组中的重复项_II_80_中等;
+
+import org.junit.Assert;
+
+public class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array-ii/
+ * 编号:80
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:从小到大有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int removeDuplicates(int[] nums) {
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ // 区间[0,...,pos]每个元素最多出现两次
+ int pos = 0;
+ // 数字可出现的次数
+ int frequency = 2;
+ for (int num : nums) {
+ if (pos < frequency || num > nums[pos - frequency]) {
+ nums[pos++] = num;
+ }
+ }
+ return pos;
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] nums = {0, 0, 1, 1, 1, 1, 2, 3, 3};
+ Assert.assertEquals(7, new Solution1().removeDuplicates(nums));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..0d8258b5
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\210\240\351\231\244\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\351\207\215\345\244\215\351\241\271_II_80_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.array.删除排序数组中的重复项_II_80_中等;
+
+import org.junit.Assert;
+
+public class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array-ii/
+ * 编号:80
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:从小到大有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int removeDuplicates(int[] nums) {
+ // Initialize the counter and the second pointer.
+ int j = 1, count = 1;
+
+ // Start from the second element of the array and process
+ // elements one by one.
+ for (int i = 1; i < nums.length; i++) {
+
+ // If the current element is a duplicate, increment the count.
+ if (nums[i] == nums[i - 1]) {
+ count++;
+ } else {
+ // Reset the count since we encountered a different element
+ // than the previous one.
+ count = 1;
+ }
+ // For a count <= 2, we copy the element over thus
+ // overwriting the element at index "j" in the array
+ if (count <= 2) {
+ nums[j++] = nums[i];
+ }
+ }
+ return j;
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] nums = {0, 0, 1, 1, 1, 1, 2, 3, 3};
+ Assert.assertEquals(7, new Solution2().removeDuplicates(nums));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..3a74c52d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,30 @@
+package cn.lastwhisper.leetcode.array.区间合并.矩形重叠_836_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 两个矩阵的重叠是无限的,但是不重叠是有限的
+ * 检查位置
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(1)
+ * 空间复杂度:O(1)
+ */
+ public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
+ // 矩阵投影X轴,矩阵1在矩阵2左侧 或 矩阵1在矩阵2右侧
+ boolean x_overlap = !(rec1[2] <= rec2[0] || rec2[2] <= rec1[0]);
+ // 矩阵投影y轴,矩阵1在矩阵2上侧 或 矩阵1在矩阵2下侧
+ boolean y_overlap = !(rec1[3] <= rec2[1] || rec2[3] <= rec1[1]);
+ return x_overlap && y_overlap;
+ }
+
+ public static void main(String[] args) {
+ int[] rec1 = {0, 0, 2, 2}, rec2 = {1, 1, 3, 3};
+ Assert.assertTrue(new Solution1().isRectangleOverlap(rec1, rec2));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..8107d63e
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\214\272\351\227\264\345\220\210\345\271\266/\347\237\251\345\275\242\351\207\215\345\217\240_836_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,28 @@
+package cn.lastwhisper.leetcode.array.区间合并.矩形重叠_836_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 检查重叠的矩阵区域
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(1)
+ * 空间复杂度:O(1)
+ */
+ public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
+ //相交矩阵的水平边
+ return (Math.min(rec1[2], rec2[2]) > Math.max(rec1[0], rec2[0]) &&
+ //相交矩阵的垂直边
+ Math.min(rec1[3], rec2[3]) > Math.max(rec1[1], rec2[1]));
+ }
+
+ public static void main(String[] args) {
+ int[] rec1 = {0, 0, 2, 2}, rec2 = {1, 1, 3, 3};
+ Assert.assertTrue(new Solution2().isRectangleOverlap(rec1, rec2));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..26542e85
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.array.卡牌分组_914_简单;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先将数组排序,对数组进行步长为2~len/2进行分组
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public boolean hasGroupsSizeX(int[] deck) {
+ // 特判
+ if (deck == null || deck.length <= 1) {
+ return false;
+ }
+ if (deck.length == 2) {
+ return true;
+ }
+ Arrays.sort(deck);
+ for (int i = 2; i <= deck.length / 2; i++) {
+ if (deck.length % i != 0) {//deck不能整分为i组
+ continue;
+ }
+ boolean flag = true;
+ //步长为2~len/2进行分组
+ for (int len = 0, start = 0, end = i - 1; len < deck.length; end += i, start += i, len += i) {
+ for (int j = start; j < end; j++) {
+ if (deck[j] != deck[j + 1]) {
+ flag = false;
+ break;
+ }
+ }
+ if (!flag) {
+ break;
+ }
+ }
+ if (flag) return true;
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertTrue(new Solution1().hasGroupsSizeX(new int[]{0, 0, 0, 0, 0, 1, 1, 1, 1, 1}));
+ Assert.assertTrue(new Solution1().hasGroupsSizeX(new int[]{1, 1}));
+ Assert.assertFalse(new Solution1().hasGroupsSizeX(new int[]{1, 1, 1, 2, 2, 2, 3, 3}));
+ //Assert.assertTrue(new Solution1().hasGroupsSizeX(new int[]{0, 0, 0, 1, 1, 1, 2, 2, 2}));
+ //Assert.assertTrue(new Solution1().hasGroupsSizeX(new int[]{1, 2, 3, 4, 4, 3, 2, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..8338cd8c
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\215\241\347\211\214\345\210\206\347\273\204_914_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,57 @@
+package cn.lastwhisper.leetcode.array.卡牌分组_914_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:统计每个数出现的次数,次数的最大公约数大于1即可
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public boolean hasGroupsSizeX(int[] deck) {
+ // 特判
+ if (deck == null || deck.length <= 1) {
+ return false;
+ }
+ int[] freq = new int[10000];
+ for (int num : deck) {
+ freq[num]++;
+ }
+
+ int x = freq[deck[0]];
+ for (int num : freq) {
+ // 1个数不能分组
+ if (num == 1) {
+ return false;
+ }
+ if (num > 1) {
+ x = gcd(x, num);
+ // 最小公倍数是1说明也不能按同样的值分组
+ if (x == 1) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private int gcd(int a, int b) {
+ if (b == 0) {
+ return a;
+ }
+ return gcd(b, a % b);
+ }
+
+ public static void main(String[] args) {
+ Assert.assertTrue(new Solution2().hasGroupsSizeX(new int[]{0, 0, 0, 0, 0, 1, 1, 1, 1, 1}));
+ Assert.assertTrue(new Solution2().hasGroupsSizeX(new int[]{1, 1}));
+ Assert.assertFalse(new Solution2().hasGroupsSizeX(new int[]{1, 1, 1, 2, 2, 2, 3, 3}));
+ //Assert.assertTrue(new Solution2().hasGroupsSizeX(new int[]{0, 0, 0, 1, 1, 1, 2, 2, 2}));
+ //Assert.assertTrue(new Solution2().hasGroupsSizeX(new int[]{1, 2, 3, 4, 4, 3, 2, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..ff909dd9
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.array.反转字符串_344_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/reverse-string/
+ * 编号:344
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:对撞指针交换元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void reverseString(char[] s) {
+ int l = 0, r = s.length - 1;
+ while (l < r) {
+ char c = s[l];
+ s[l] = s[r];
+ s[r] = c;
+ l++; r--;
+ }
+ }
+
+ public static void main(String[] args) {
+ char[] s = {'h', 'e', 'l', 'l', 'o'};
+ new Solution1().reverseString(s);
+ Assert.assertArrayEquals(new char[]{'o', 'l', 'l', 'e', 'h'}, s);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..7c26f183
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.array.反转字符串中的元音字母_345_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/reverse-vowels-of-a-string/
+ * 编号:345
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:对撞指针条件交换元素
+ * 元音字母:a,e,i,o,u 大小写
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public String reverseVowels(String s) {
+ int l = 0, r = s.length() - 1;
+ char[] chars = s.toCharArray();
+ while (l < r) {
+ while (l < r && !valid(s.charAt(l))) {
+ l++;
+ }
+ while (l < r && !valid(s.charAt(r))) {
+ r--;
+ }
+ if (l < r) {// 需要判断
+ char c = chars[l];
+ chars[l] = chars[r];
+ chars[r] = c;
+ l++;
+ r--;
+ }
+ }
+ return new String(chars);
+ }
+
+ private boolean valid(char c) {
+ return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
+ c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals("holle", new Solution1().reverseVowels("hello"));
+ Assert.assertEquals("leotcede", new Solution1().reverseVowels("leetcode"));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..bdba81f3
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,53 @@
+package cn.lastwhisper.leetcode.array.合并两个有序数组_88_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/merge-sorted-array/
+ * 编号:88
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:数组有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * 归并排序,归的过程。
+ * (1)从前到后比较(找小)复制只用 nums1,需要移动 nums1 中的元素,不如创建中间数据
+ * (2)从后到前比较(找大)复制只用 nums1,无需移动 nums1 中的元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public void merge(int[] nums1, int m, int[] nums2, int n) {
+ // 暂存 nums1 和 nums2 的数据
+ int[] temp = new int[m + n];
+ int p1 = 0, p2 = 0, t = 0;
+ // 将 nums1 和 nums2 有序复制到 temp,直到某个数组复制完
+ while (p1 < m && p2 < n) {
+ if (nums1[p1] > nums2[p2]) {
+ temp[t] = nums2[p2++];
+ } else {
+ temp[t] = nums1[p1++];
+ }
+ t++;
+ }
+ // 将 nums1 剩余元素复制到 temp
+ while (p1 < m) {
+ temp[t++] = nums1[p1++];
+ }
+ // 将 nums2 剩余元素复制到 temp
+ while (p2 < n) {
+ temp[t++] = nums2[p2++];
+ }
+ // 将 temp 所有元素复制到 nums1
+ System.arraycopy(temp, 0, nums1, 0, temp.length);
+ }
+
+ public static void main(String[] args) {
+ int[] nums1 = {1, 2, 3, 0, 0, 0}, nums2 = {2, 5, 6};
+ int m = 3, n = 3;
+ new Solution1().merge(nums1, m, nums2, n);
+
+ Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 6}, nums1);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..72a5f842
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\220\210\345\271\266\344\270\244\344\270\252\346\234\211\345\272\217\346\225\260\347\273\204_88_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.array.合并两个有序数组_88_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/merge-sorted-array/
+ * 编号:88
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:数组有序
+ * -------------------------------------------------------------------
+ * 思路:
+ * 从后向前复制
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void merge(int[] nums1, int m, int[] nums2, int n) {
+ int p1 = m - 1, p2 = n - 1, total = m + n - 1;
+ // 将 num1 和 num2 中最大的复制到 nums1的最后面
+ while (p1 >= 0 && p2 >= 0) {
+ nums1[total--] = nums1[p1] > nums2[p2] ? nums1[p1--] : nums2[p2--];
+ }
+ // 如果 num1 还没复制完,不用管,因为num1自身就是有序的
+ // 如果 num2 还没复制完,把剩余复制进去
+ while (p2 >= 0) {
+ nums1[total--] = nums2[p2--];
+ }
+ }
+
+ public static void main(String[] args) {
+ int[] nums1 = {1, 2, 3, 0, 0, 0}, nums2 = {2, 5, 6};
+ int m = 3, n = 3;
+ new Solution2().merge(nums1, m, nums2, n);
+
+ Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 6}, nums1);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..11993f9d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,38 @@
+package cn.lastwhisper.leetcode.array.多数元素_169_简单;
+
+import org.junit.Assert;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/majority-element/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:hash表
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int majorityElement(int[] nums) {
+ int half = nums.length / 2;
+ Map map = new HashMap<>();
+ for (int num : nums) {
+ Integer count = map.get(num);
+ count = count == null ? 1 : ++count;
+ map.put(num, count);
+ if (count > half) {
+ return num;
+ }
+ }
+ return 0;
+ }
+
+ public static void main(String[] args) {
+ //Assert.assertEquals(3, new Solution1().majorityElement(new int[]{3, 2, 3}));
+ Assert.assertEquals(2, new Solution1().majorityElement(new int[]{2, 2, 1, 1, 1, 2, 2}));
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..791be615
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\244\232\346\225\260\345\205\203\347\264\240_169_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.array.多数元素_169_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/majority-element/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:摩尔投票法
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int majorityElement(int[] nums) {
+ int candidate = 0;
+ int count = 0;
+ for (int num : nums) {
+ if (count == 0) {
+ candidate = num;
+ }
+ count += candidate == num ? 1 : -1;
+ }
+ return candidate;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(3, new Solution2().majorityElement(new int[]{3, 2, 3}));
+ Assert.assertEquals(2, new Solution2().majorityElement(new int[]{2, 2, 1, 1, 1, 2, 2}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution1.java"
deleted file mode 100644
index 64322f6c..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution1.java"
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.两数之和_II_输入有序数组_167_Easy;
-
-/**
- * https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
- * @author lastwhisper
- */
-public class Solution1 {
- /**
- * https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
- * 暴力解法
- * 时间复杂度:O(n^2)
- * 空间复杂度:O(1)
- */
- public int[] twoSum(int[] numbers, int target) {
- if (numbers == null || numbers.length < 2) {
- return null;
- }
- int len = numbers.length;
- for (int i = 0; i < len; i++) {
- for (int j = 1; j < len; j++) {
- if ((i != j) && (numbers[i] + numbers[j]) == target) {
- return new int[]{i + 1, j + 1};
- }
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- int[] arr = {0, 0, 3, 4};
- int[] index = new Solution1().twoSum(arr, 0);
- System.out.printf("[%s,%s]", index[0], index[1]);
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution2.java"
deleted file mode 100644
index 9095a772..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution2.java"
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.两数之和_II_输入有序数组_167_Easy;
-
-/**
- * @author lastwhisper
- */
-public class Solution2 {
-
- /**
- * https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
- * 将差值放入二分查找剩余数组
- * 时间复杂度:O(nlogn)
- * 空间复杂度:O(1)
- */
- public int[] twoSum(int[] numbers, int target) {
- if (numbers == null || numbers.length < 2) {
- return null;
- }
- for (int index1 = 0; index1 < numbers.length; index1++) {
- int differ = target - numbers[index1];
- int index2 = binarySearch(numbers, index1 + 1, numbers.length - 1, differ);
- if (index2 != -1) {
- return new int[]{index1 + 1, index2 + 1};
- }
- }
- throw new IllegalStateException("The input has no solution");
- }
-
- public int binarySearch(int[] arr, int l, int r, int target) {
- while (l <= r) {
- int mid = l + (r - l) / 2;
- if (arr[mid] == target)
- return mid;
- if (target > arr[mid])
- l = mid + 1;
- else
- r = mid - 1;
- }
- return -1;
- }
-
- public static void main(String[] args) {
- int[] arr = {1, 2, 3, 4, 4, 9, 56, 90};
- int[] index = new Solution2().twoSum(arr, 8);
- System.out.printf("[%s,%s]", index[0], index[1]);
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution3.java"
deleted file mode 100644
index ba9f2825..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\344\270\244\346\225\260\344\271\213\345\222\214_II_\350\276\223\345\205\245\346\234\211\345\272\217\346\225\260\347\273\204_167_Easy/Solution3.java"
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.两数之和_II_输入有序数组_167_Easy;
-
-import java.util.Arrays;
-
-/**
- * @author lastwhisper
- */
-public class Solution3 {
- /**
- * https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/
- * 对撞指针(前提数组有序)
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public int[] twoSum(int[] numbers, int target) {
- if (numbers == null || numbers.length < 2) {
- return null;
- }
- int l = 0, r = numbers.length - 1;
- while (l < r) {
- int left = numbers[l];
- int right = numbers[r];
- if ((left + right) == target) {
- return new int[]{l + 1, r + 1};
- } else if ((left + right) > target) {
- r--;
- } else {
- l++;
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- System.out.println(Arrays.toString(new Solution3().twoSum(new int[]{0, 0, 3, 4}, 0)));
- System.out.println(Arrays.toString(new Solution3().twoSum(new int[]{1, 7, 17, 2, 6, 3, 14}, 20)));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_Easy/Solution1.java"
deleted file mode 100644
index f0b8f06a..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262_344_Easy/Solution1.java"
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.反转字符串_344_Easy;
-
-/**
- * @author lastwhisper
- */
-public class Solution1 {
- /**
- * https://leetcode-cn.com/problems/reverse-string/
- * 指针对撞
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public void reverseString(char[] s) {
- int l = 0, r = s.length - 1;
- while (l < r) {
- char temp = s[l];
- s[l] = s[r];
- s[r] = temp;
- l++;
- r--;
- }
- }
-
- public static void main(String[] args) {
- char[] reverses = new char[]{'H','a','n','n','a','h'};
- new Solution1().reverseString(reverses);
- for (char c : reverses) {
- System.out.printf("\"%s\",",c);
- }
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_Easy/Solution1.java"
deleted file mode 100644
index 59dfaf84..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\345\205\203\351\237\263\345\255\227\346\257\215_345_Easy/Solution1.java"
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.反转字符串中的元音字母_345_Easy;
-
-class Solution1 {
- /**
- * 指针对撞
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public String reverseVowels(String s) {
- char[] chars = s.toCharArray();
- int l = 0, r = chars.length - 1;
- while (l < r) {
- while (l < r && !isVowel(chars[l])) l++; //找到左边的元音
- while (l < r && !isVowel(chars[r])) r--; //找到右边的元音
- if (l < r) {
- // 找到了交换
- char temp = chars[l];
- chars[l] = chars[r];
- chars[r] = temp;
- l++;
- r--;
- }
- }
- return new String(chars);
- }
-
- public boolean isVowel(char c) {
- if (c == 'a' || c == 'A') return true;
- else if (c == 'e' || c == 'E') return true;
- else if (c == 'i' || c == 'I') return true;
- else if (c == 'o' || c == 'O') return true;
- else if (c == 'u' || c == 'U') return true;
- return false;
- }
-
-
- public static void main(String[] args) {
- String s = "leetcode";
- //String s = "aA";
- System.out.println(new Solution1().reverseVowels(s));
- ;
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution1.java"
deleted file mode 100644
index 79304785..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution1.java"
+++ /dev/null
@@ -1,21 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.盛最多水的容器_11_Medium;
-
-/**
- * @author lastwhisper
- */
-public class Solution1 {
- public int maxArea(int[] height) {
- int maxArea = 0;
- for (int i = 0; i < height.length; i++) {
- for (int j = i + 1; j < height.length; j++) {
- maxArea = Math.max(maxArea, Math.min(height[i], height[j]) * (j - i));
- }
- }
- return maxArea;
- }
-
- public static void main(String[] args) {
- int[] arr = {1, 8, 6, 2, 5, 4, 8, 3, 7};
- System.out.println(new Solution1().maxArea(arr));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution2.java"
deleted file mode 100644
index 18880fca..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_Medium/Solution2.java"
+++ /dev/null
@@ -1,24 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.盛最多水的容器_11_Medium;
-
-/**
- * @author lastwhisper
- */
-public class Solution2 {
-
- public int maxArea(int[] height) {
- int maxarea = 0, l = 0, r = height.length - 1;
- while (l < r) {
- maxarea = Math.max(maxarea, Math.min(height[l], height[r]) * (r - l));
- if (height[l] < height[r])
- l++;
- else
- r--;
- }
- return maxarea;
- }
-
- public static void main(String[] args) {
- int[] arr = {1, 8, 6, 2, 5, 4, 8, 3, 7};
- System.out.println(new Solution2().maxArea(arr));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.java"
deleted file mode 100644
index c89b5506..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\257\271\346\222\236\346\214\207\351\222\210/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_Easy/Solution1.java"
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.lastwhisper.leetcode.array.对撞指针.验证回文串_125_Easy;
-
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/valid-palindrome/
- * 指针对撞
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public boolean isPalindrome(String s) {
- String tempStr = s.toUpperCase();
- char[] chars = tempStr.toCharArray();
- int l = 0, r = tempStr.length() - 1;
- while (l < r) {
- while (l < r && !isWordOrNum(chars[l])) l++;
- while (l < r && !isWordOrNum(chars[r])) r--;
- if (chars[l] != chars[r]) {
- return false;
- }
- l++;
- r--;
- }
- return true;
- }
-
- // 是否是字母和数字字符
- public boolean isWordOrNum(char c) {
- return ((c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122));
- }
-
- public static void main(String[] args) {
- String s = "A man, a plan, a canal: Panama";
- //String s = "race a car";
- System.out.println(new Solution1().isPalindrome(s));
- //System.out.println(s.toUpperCase());
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..2a96a74a
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.array.将数组分成和相等的三个部_1013_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-array-into-three-parts-with-equal-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:三个和相等的非空部分,0~i == i+1~j == j-1~length-1。
+ * 观察规律:
+ * 1.分成三等分,说明sum%3==0。
+ * 2.sum%3==0有没有可能不能划分成三等分?
+ * 有可能,比如[6,7,8],必须把8拆一份给6才行,这是不允许的。
+ * 坑:
+ * 非空部分!!!不一定要把数组里面值全部都使用
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean canThreePartsEqualSum(int[] A) {
+ int sum = 0;
+ for (int a : A) {
+ sum += a;
+ }
+ if (sum % 3 != 0) {
+ return false;
+ }
+ // 双指针
+ int left = 0, right = A.length - 1;
+ int peer = sum / 3, leftSum = A[left], rightSum = A[right];
+ // 使用left + 1 < right 的原因,防止只能将数组分成两个部分
+ // 例如:[1,-1,1,-1],使用left < right作为判断条件就会出错
+ while (left + 1 < right) {
+ if (leftSum == peer && rightSum == peer) {
+ return true;
+ }
+ while (left + 1 < right && leftSum != peer) {
+ left++;
+ leftSum += A[left];
+ }
+ while (left + 1 < right && rightSum != peer) {
+ right--;
+ rightSum += A[right];
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = new int[]{0,2,1,-6,6,-7,9,1,2,0,1};
+ //int[] nums = new int[]{0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1};
+ //int[] nums = new int[]{3,3,6,5,-2,2,5,1,-9,4};
+ int[] nums = new int[]{3, 3, 6, 5, -2, 2, 5, 1, -9, 4};
+ System.out.println(new Solution1().canThreePartsEqualSum(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..35b02ccb
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\345\260\206\346\225\260\347\273\204\345\210\206\346\210\220\345\222\214\347\233\270\347\255\211\347\232\204\344\270\211\344\270\252\351\203\250_1013_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.array.将数组分成和相等的三个部_1013_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-array-into-three-parts-with-equal-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean canThreePartsEqualSum(int[] A) {
+ int sum = 0;
+ for (int a : A) {
+ sum += a;
+ }
+ if (sum % 3 != 0) {
+ return false;
+ }
+
+ int freq = 0;
+ int count = 0;
+ for (int a : A) {
+ count += a;
+ if (count == sum / 3) {
+ freq++;
+ count = 0;
+ }
+ }
+ // [10,-10,10,-10,10,-10,10,-10]
+ return freq >= 3;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = new int[]{0,2,1,-6,6,-7,9,1,2,0,1};
+ //int[] nums = new int[]{0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1};
+ //int[] nums = new int[]{3,3,6,5,-2,2,5,1,-9,4};
+ int[] nums = new int[]{3, 3, 6, 5, -2, 2, 5, 1, -9, 4};
+ System.out.println(new Solution2().canThreePartsEqualSum(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..72bd4c28
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,65 @@
+package cn.lastwhisper.leetcode.array.找到字符串中所有字母异位词_438_中等;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/
+ * 编号:438
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(滑动窗口)
+ * (1)双指针 l、r 维护一个滑动窗口,初始窗口扩容至模式串 p 的长度
+ * (2)判断当前 [l,r] 是否满足 异位词,如果满足,记录当前 l 的下标,
+ * (3)窗口整体右移
+ * (4)循环2、3,条件 r 未越界,r 未越界,l 肯定未越界
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2) //n 是 s 的长度、m 是 p 的长度
+ * 空间复杂度:O(1)
+ */
+ public List findAnagrams(String s, String p) {
+ List result = new ArrayList<>();
+ // 特判
+ if (s == null || s.length() < p.length()) {
+ return result;
+ }
+ // 直接让 [l,r] 满足模式串长度
+ int l = 0, r = p.length() - 1;
+ int[] visited = new int[26];
+
+ while (r < s.length()) {
+ // 检查是否是异位词
+ if (anagram(s, l, r, p, visited)) {
+ result.add(l);
+ }
+ l++;
+ r++;
+ }
+ return result;
+ }
+
+ public boolean anagram(String s, int l, int r, String p, int[] visited) {
+ Arrays.fill(visited, 0);
+
+ for (int i = l; i <= r; i++) {
+ visited[s.charAt(i) - 'a']++;
+ visited[p.charAt(i - l) - 'a']--;
+ }
+
+ for (int count : visited) {
+ if (count != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ String s = "cbaebabacd", p = "abc";
+ //String s = "abab", p = "ab";
+ System.out.println(new Solution1().findAnagrams(s, p));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..c3aaa4dd
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,73 @@
+package cn.lastwhisper.leetcode.array.找到字符串中所有字母异位词_438_中等;
+
+import java.util.ArrayList;
+import java.util.List;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/
+ * 编号:438
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(滑动窗口)
+ * (1)双指针 l、r 维护一个滑动窗口进行遍历主串 s,
+ * window[] hash 表用于记录 [l,r] 窗口中某字符次数,是否满足模式串 s 中字符次数,
+ * total 用于记录 [l,r] 窗口各个字符数量,是否满足模式串 s 中字符数量,
+ * need[] hash 表用于记录模式串 s 中各个字符数量,
+ * (2)
+ * (3)
+ * (4)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public List findAnagrams(String s, String p) {
+ if (s == null || p == null || s.length() < p.length()) {
+ return new ArrayList<>();
+ }
+ List result = new ArrayList<>();
+ int l = 0, r = 0, total = p.length();
+ int[] window = new int[26];
+ int[] need = new int[26];
+ for (int i = 0; i < p.length(); i++) {
+ need[p.charAt(i) - 'a']++;
+ }
+ while (r < s.length()) {
+ int cr = s.charAt(r) - 'a';
+ // s 中的字符,是否存在 p 中
+ // 如果存在,window 记录该字符出现次数,该字符出现次数小于等于 p 中该字符数,total--
+ if (need[cr] > 0) {
+ window[cr]++;
+ if (window[cr] <= need[cr]) {
+ total--;
+ }
+ }
+ // [l,r] 中包含了 p 中所有字符
+ while (total == 0) {
+ // 必须是和 p 的长度相同才可以算字母异位词
+ // 比如 s=ceba p=abc 也满足 total==0 ,但是并不是异位词
+ if (r - l == p.length() - 1) {
+ result.add(l);
+ }
+ // 缩小窗口,剔除 l 所指向的字符次数,total++
+ int cl = s.charAt(l) - 'a';
+ if (need[cl] > 0) {
+ window[cl]--;
+ if (window[cl] < need[cl]) {
+ total++;
+ }
+ }
+ l++;
+ }
+ r++;
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ String s = "cbaebabacd", p = "abc";
+ //String s = "abab", p = "ab";
+ System.out.println(new Solution2().findAnagrams(s, p));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/backup.md" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/backup.md"
new file mode 100644
index 00000000..90baddd1
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_\344\270\255\347\255\211/backup.md"
@@ -0,0 +1,139 @@
+第一步:
+```java
+
+int l = 0, r = 0;
+ int[] visit = new int[26];
+while (l < s.length()) {
+ if (r < s.length() && r - l < p.length() && !anagram(s, l, r, p, visit)) {
+ r++;
+ } else {
+ if (anagram(s, l, r, p, visit)) {
+ result.add(l);
+ }
+ l++;
+ }
+ }
+
+
+public boolean anagram(String s, int l, int r, String p, int[] visit) {
+ if (r - l != p.length()) {
+ return false;
+ }
+...
+}
+```
+
+第二步:
+
+思路:双指针(滑动窗口)
+(1)双指针 l、r 维护一个滑动窗口,窗口的长度不大于模式串 p 的长度
+(2)判断当前 [l,r] 满足 异位词
+(3)如果不满足,窗口向右扩容
+(4)如果满足,记录当前 l 的下标,窗口向右缩小
+(5)循环2、3、4,条件 l 未越界
+
+```java
+int l = 0, r = 0;
+ int[] visit = new int[26];
+if (!anagram(s, l, r, p, visit)) {
+ // [l,r]不满足异位词且窗口大小不满足,扩展右边界
+ if ((r - l+1) != p.length()) {
+ r++;
+ } else {
+ // [l,r]不满足异位词且窗口大小满足,扩展左边界
+ l++;
+ }
+ } else {
+ result.add(l);
+ l++;
+ }
+```
+
+第三步:
+
+
+```java
+
+int l = 0, r = 0;
+ int[] visit = new int[26];
+while (l < s.length() && r < s.length()) {
+ // [l,r]不满足窗口大小,扩展右边界
+ if ((r - l + 1) != p.length()) {
+ r++;
+ } else {
+ // [l,r]满足窗口大小,检查是否是异位词
+ if (anagram(s, l, r, p, visit)) {
+ result.add(l);
+ }
+ l++;
+ }
+ }
+
+```
+
+第四步:
+
+```java
+int l = 0, r = 0;
+ int[] visit = new int[26];
+while (l < s.length() && r < s.length()) {
+ // [l,r]不满足模式串长度,扩展右边界
+ while ((r - l + 1) != p.length()) {
+ r++;
+ }
+ // 此时窗口肯定满足,模式串的长度了,但是有可能越界了
+ if (r < s.length()) {
+ // 检查是否是异位词
+ if (anagram(s, l, r, p, visit)) {
+ result.add(l);
+ }
+ l++;
+ }
+ }
+
+```
+第五步:
+
+```java
+
+int l = 0, r = 0;
+ int[] visit = new int[26];
+ while (l < s.length() && r < s.length()) {
+ // [l,r]不满足模式串长度,扩展右边界到窗口最大长度
+ // (r - l + 1) != p.length() ==》 推导 r = p.length() + l - 1;
+ r = p.length() + l - 1;
+ // 此时窗口肯定满足,模式串的长度了,但是有可能越界了
+ if (r < s.length()) {
+ // 检查是否是异位词
+ if (anagram(s, l, r, p, visit)) {
+ result.add(l);
+ }
+ l++;
+ }
+ }
+
+```
+第六步:
+
+```java
+public List findAnagrams(String s, String p) {
+ List result = new ArrayList<>();
+ // 过滤肯定不符合规则的数据
+ if (s == null || s.length() < p.length()) {
+ return result;
+ }
+ // 直接让 [l,r] 满足模式串长度
+ int l = 0, r = p.length() - 1;
+ int[] visit = new int[26];
+
+ while (r < s.length()) {
+ // 检查是否是异位词
+ if (anagram(s, l, r, p, visit)) {
+ result.add(l);
+ }
+ l++;
+ r++;
+ }
+ return result;
+ }
+```
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/README.md" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/README.md"
new file mode 100644
index 00000000..bfb64b8d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/README.md"
@@ -0,0 +1,24 @@
+分类:稳定性、排序原则、存储器不同
+
+按稳定性:
+
+1. 稳定:冒泡排序、插入排序、归并排序、基数排序、桶排序、计数排序
+
+2. 不稳定:选择排序、希尔排序、堆排序、快速排序
+
+按排序原则:
+1. 插入排序:插入排序、希尔排序
+2. 交换排序:冒泡排序、快速排序
+3. 选择排序:选择排序、堆排序
+4. 归并排序:2-路归并排序
+5. 分配排序:基数排序
+
+ (1)插入类:将无序子序列中的一个或几个记录“插入”到有序序列中,从而增加记录的有序子序列的长度。
+ (2)交换类:通过“交换”无序序列中的记录从而得到其中关键字最小或最大的记录,并将它加入到有序子序列中,以此方法增加记录的有序子序列的长度。
+ (3)选择类:从记录的无序子序列中“选择”关键字最小或最大的记录,并将它加入到有序子序列中,以此方法增加记录的有序子序列的长度。
+ (4)归并类:通过“归并”两个或两个以上的记录有序子序列,逐步增加记录有序序列的长度。
+ (5)分配类:是唯一一类不需要进行关键字之间比较的排序方法,排序时主要利用分配和收集两种基本操作来完成。
+
+
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/BubbleSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/BubbleSort.java"
new file mode 100644
index 00000000..bab4a394
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/BubbleSort.java"
@@ -0,0 +1,40 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.交换;
+
+import org.junit.Assert;
+
+class BubbleSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 冒泡排序——稳定
+ * https://zh.wikipedia.org/wiki/%E5%86%92%E6%B3%A1%E6%8E%92%E5%BA%8F
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ // 标识数组是否无序
+ boolean exchanged = true;
+ for (int i = 0; exchanged && i < nums.length; i++) {
+ exchanged = false;
+ // 每次将最大值交换到无序数组最后的位置
+ for (int j = 0; j < nums.length - 1 - i; j++) {
+ if (nums[j] > nums[j + 1]) {
+ int temp = nums[j];
+ nums[j] = nums[j + 1];
+ nums[j + 1] = temp;
+ exchanged = true;
+ }
+ }
+ }
+ return nums;
+ }
+
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new BubbleSort().sortArray(new int[]{5, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/Quick2Sort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/Quick2Sort.java"
new file mode 100644
index 00000000..341d33c9
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/Quick2Sort.java"
@@ -0,0 +1,73 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.交换;
+
+import org.junit.Assert;
+
+class Quick2Sort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 快速排序——不稳定
+ * https://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F
+ *
+ * 快速排序(Quick Sort)是由冒泡排序改进而得的。在冒泡排序过程中,只对相邻的两个记录进行比较,因此每次交换两个相邻记录时只能消除一个逆序。
+ * 如果能通过两个(不相邻)记录的一-次交换,消除多个逆序,则会大大加快排序的速度。快速排序方法中的一次交换可能消除多个逆序。
+ *
+ * 基准值可以选择第一个值、中间值、最后一个值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(nlogn)
+ */
+ public int[] sortArray(int[] nums) {
+ quickSort(nums, 0, nums.length - 1);
+ return nums;
+ }
+
+ public void quickSort(int[] nums, int left, int right) {
+ if (left < right) {// 长度大于1
+ int pivotLoc = partition(nums, left, right);//中轴下标
+ quickSort(nums, left, pivotLoc - 1);
+ quickSort(nums, pivotLoc + 1, right);
+ }
+ }
+
+ /**
+ * 选择第一个值、中间值、最后一个值为中轴,这里选择第一个值
+ * 在[low,high]范围内,中轴左边的值都小于中轴,中轴右边的值都大于中轴
+ *
+ * @param nums 待排序数组
+ * @param low 排序起始位置
+ * @param high 排序终止位置
+ * @return int 中轴下标
+ */
+ private int partition(int[] nums, int low, int high) {
+ int pivot = nums[low];
+ while (low < high) {
+ while (low < high && nums[high] >= pivot) high--;
+ nums[low] = nums[high];
+ while (low < high && nums[low] <= pivot) low++;
+ nums[high] = nums[low];
+ }
+ nums[low] = pivot;
+ return low;
+ }
+ // 选最后一个值
+ //private int partition(int[] nums, int low, int high) {
+ // int pivot = nums[high];
+ // while (low < high) {
+ // while (low < high && nums[low] <= pivot) low++;
+ // nums[high] = nums[low];
+ // while (low < high && nums[high] >= pivot) high--;
+ // nums[low] = nums[high];
+ // }
+ // nums[high] = pivot;
+ // return high;
+ //}
+
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new Quick2Sort().sortArray(new int[]{5, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/QuickSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/QuickSort.java"
new file mode 100644
index 00000000..4968ccac
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\344\272\244\346\215\242/QuickSort.java"
@@ -0,0 +1,69 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.交换;
+
+import org.junit.Assert;
+
+class QuickSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 快速排序——不稳定
+ * https://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F
+ *
+ * 快速排序(Quick Sort)是由冒泡排序改进而得的。在冒泡排序过程中,只对相邻的两个记录进行比较,因此每次交换两个相邻记录时只能消除一个逆序。
+ * 如果能通过两个(不相邻)记录的一-次交换,消除多个逆序,则会大大加快排序的速度。快速排序方法中的一次交换可能消除多个逆序。
+ *
+ * 基准值可以选择第一个值、中间值、最后一个值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(nlogn)
+ */
+ public int[] sortArray(int[] nums) {
+ quickSort(nums, 0, nums.length - 1);
+ return nums;
+ }
+
+ public void quickSort(int[] nums, int left, int right) {
+ if (left < right) {// 长度大于1
+ int pivotLoc = partition(nums, left, right);//中轴下标
+ quickSort(nums, left, pivotLoc - 1);
+ quickSort(nums, pivotLoc + 1, right);
+ }
+ }
+
+ /**
+ * 选择第一个值、中间值、最后一个值为中轴,这里选择最后一个值
+ * 在[start,end]范围内,中轴左边的值都小于中轴,中轴右边的值都大于中轴
+ *
+ * @param nums 待排序数组
+ * @param leftBound 排序起始位置
+ * @param rightBound 排序终止位置
+ * @return int 中轴下标
+ */
+ // 分区
+ private static int partition(int[] nums, int leftBound, int rightBound) {
+ int left = leftBound;
+ int pivot = nums[rightBound];
+ int right = rightBound - 1;
+ while (left <= right) {// left <= right取等,[4,6]时进不去while
+ while (left <= right && nums[left] <= pivot) left++;
+ while (left <= right && nums[right] > pivot) right--;
+ if (left < right) swap(nums, left, right);
+ }
+ swap(nums, left, rightBound);
+ return left;
+ }
+
+ private static void swap(int[] arr, int i, int j) {
+ int temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+ }
+
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new QuickSort().sortArray(new int[]{5, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/CountSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/CountSort.java"
new file mode 100644
index 00000000..625e4898
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/CountSort.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.分配;
+
+class CountSort {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 计数排序——稳定
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int[] sortArray(int[] nums) {
+ int max = -50001, min = 50001;
+ for (int num : nums) {
+ max = Math.max(num, max);
+ min = Math.min(num, min);
+ }
+
+ int[] counter = new int[max - min + 1];
+ for (int num : nums) {
+ counter[num - min]++;
+ }
+
+ int idx = 0;
+ for (int num = min; num <= max; num++) {
+ int cnt = counter[num - min];
+ while (cnt-- > 0) {
+ nums[idx++] = num;
+ }
+ }
+ return nums;
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/RadixSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/RadixSort.java"
new file mode 100644
index 00000000..d9afe66d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\210\206\351\205\215/RadixSort.java"
@@ -0,0 +1,67 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.分配;
+
+import org.junit.Assert;
+
+class RadixSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 基数排序——稳定
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ int[][] bucket = new int[10][nums.length];
+ // 桶元素计数器,记录每个桶中存放了多少数据
+ int[] bucketElementCount = new int[10];
+ // 原arr下标
+ int arrIndex;
+ // 除数
+ int divisor = 1;
+ // 最大值
+ int max = nums[0];
+ // 由于基数排序次数由最大数值的位数决定,所以需要求最大值
+ for (int i = 1; i < nums.length; i++) {
+ if (max < nums[i]) {
+ max = nums[i];
+ }
+ }
+
+ // 最大值得位数,即排序次数
+ int maxLength = (max + "").length();
+ for (int f = 0; f < maxLength; f++) {
+ for (int num : nums) {
+ // digitOfElement对应放在哪个bucket中
+ int digitOfElement = num / divisor % 10;
+ // 放在第digitOfElement个bucket的第bucketElementCount[digitOfElement]下标位置
+ bucket[digitOfElement][bucketElementCount[digitOfElement]] = num;
+ // 下次放在bucket的第bucketElementCount[digitOfElement]++下标位置
+ bucketElementCount[digitOfElement]++;
+ }
+
+ arrIndex = 0;
+ // 将桶中数据放回原数组
+ for (int i = 0; i < bucketElementCount.length; i++) {
+ // 对应桶中有数据
+ if (bucketElementCount[i] != 0) {
+ for (int j = 0; j < bucketElementCount[i]; j++) {
+ nums[arrIndex++] = bucket[i][j];
+ }
+ }
+ // 将桶元素计数器清空
+ bucketElementCount[i] = 0;
+ }
+ divisor *= 10;
+ }
+ return nums;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new RadixSort().sortArray(new int[]{5, 2, 3, 1}));
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 5}, new RadixSort().sortArray(new int[]{5, 1, 1, 2, 0, 0}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\275\222\345\271\266/MergeSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\275\222\345\271\266/MergeSort.java"
new file mode 100644
index 00000000..3b8bde6b
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\345\275\222\345\271\266/MergeSort.java"
@@ -0,0 +1,89 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.归并;
+
+import org.junit.Assert;
+
+class MergeSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 归并排序——稳定
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ mergeSort(nums, 0, nums.length - 1, new int[nums.length]);
+ return nums;
+ }
+
+ /**
+ * 归并排序
+ * 分
+ *
+ * @param arr 排序的原始数组
+ * @param left 左边有序序列的初始索引
+ * @param right 右边索引
+ * @param temp 中转数组
+ */
+ public void mergeSort(int[] arr, int left, int right, int[] temp) {
+ if (left < right) {
+ int mid = (left + right) / 2;
+ // 向左分
+ mergeSort(arr, left, mid, temp);
+ // 向右分
+ mergeSort(arr, mid + 1, right, temp);
+ // 治
+ merge(arr, left, mid, right, temp);
+ }
+ }
+
+ /**
+ * 治
+ * @param arr 排序的原始数组 arr[left...mid] arr[mid+1...right]
+ * @param left 左边有序序列的初始索引
+ * @param mid 中间索引
+ * @param right 右边索引
+ * @param temp 中转数组
+ */
+ public void merge(int[] arr, int left, int mid, int right, int[] temp) {
+ int i = left; //左边有序序列的初始索引
+ int j = mid + 1; // 右边有序序列的初始化序索引
+ int t = 0; // 指向temp数组的当前位置
+
+ // 1)、将左右两边(有序)的数据按照规则填充到temp数组,任意一边处理完毕为止
+ while (i <= mid && j <= right) {
+ if (arr[i] < arr[j]) {
+ // 左小于右,将左数组第i个元素copy到temp数组的第t个位置
+ temp[t++] = arr[i++];
+ } else {
+ // 右小于或等于左,将右数组第j个元素copy到temp数组的第t个位置
+ temp[t++] = arr[j++];
+ }
+ }
+
+ // 2)、把有剩余数据的一边的数据依次填充到temp
+ while (i <= mid) {
+ // 说明 左数组还有剩余元素
+ temp[t++] = arr[i++];
+ }
+ while (j <= right) {
+ // 说明 右数组还有剩余元素
+ temp[t++] = arr[j++];
+ }
+
+ // 3)、将temp数组的数据copy到arr,[left,right]是每次copy的范围
+ for (int k = left, l = 0; k <= right; k++, l++) {
+ arr[k] = temp[l];
+ }
+
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new MergeSort().sortArray(new int[]{5, 2, 3, 1}));
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 5}, new MergeSort().sortArray(new int[]{5, 1, 1, 2, 0, 0}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/InsertSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/InsertSort.java"
new file mode 100644
index 00000000..13f03c56
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/InsertSort.java"
@@ -0,0 +1,36 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.插入;
+
+import org.junit.Assert;
+
+class InsertSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 插入排序——稳定
+ * https://zh.wikipedia.org/wiki/%E6%8F%92%E5%85%A5%E6%8E%92%E5%BA%8F
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ for (int i = 1; i < nums.length; i++) {
+ int num = nums[i];// 无序数组第一个值,待插入数据
+ int idx = i - 1;// 有序数组最后一个值下标
+ // 把待插入的位置腾出来
+ while (idx >= 0 && nums[idx] > num) {
+ nums[idx + 1] = nums[idx];
+ idx--;
+ }
+ nums[idx + 1] = num;
+ }
+ return nums;
+ }
+
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new InsertSort().sortArray(new int[]{5, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/ShellSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/ShellSort.java"
new file mode 100644
index 00000000..a0c870e9
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\346\217\222\345\205\245/ShellSort.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.插入;
+
+import org.junit.Assert;
+
+class ShellSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 希尔排序——不稳定
+ * https://zh.wikipedia.org/wiki/%E6%8F%92%E5%85%A5%E6%8E%92%E5%BA%8F
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ int gap = nums.length / 2;
+ int j;
+ int temp;
+ while (gap > 0) {
+ // 对每个数组进行插入排序;由于每个数组并不是真的存在的数组,而是一个大数组
+ // 所以通过gap进行取值
+ for (int i = gap; i < nums.length; i++) {
+ j = i; // 缓存每个数组的起始下标
+ temp = nums[i]; // 缓存每个数组的起始下标的数值
+ if (temp < nums[j - gap]) {
+ while (j - gap >= 0 && temp < nums[j - gap]) {
+ // 从前往后移动
+ nums[j] = nums[j - gap];
+ j = j - gap;
+ }
+ nums[j] = temp;
+ }
+ }
+ gap = gap / 2;
+ }
+ return nums;
+ }
+
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new ShellSort().sortArray(new int[]{5, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/HeapSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/HeapSort.java"
new file mode 100644
index 00000000..39a9521a
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/HeapSort.java"
@@ -0,0 +1,74 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.选择;
+
+import org.junit.Assert;
+
+class HeapSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 堆排序——不稳定
+ * https://zh.wikipedia.org/wiki/%E5%A0%86%E6%8E%92%E5%BA%8F
+ *
+ * 大顶堆升序,小顶堆降序
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ // 1. 满二叉树从右向左、从下往上构建大顶堆;完全二叉树从左向右、从下往上构建大顶堆;
+ // i--意味着,从下到上,每一次都是[i,arr.length]的数组(二叉树)进行重构大顶堆
+ // 将整个数组构建成完整的大顶堆,此时nums[0]是数组最大值
+ for (int i = nums.length / 2 - 1; i >= 0; i--) {
+ adjustHeap(nums, i, nums.length);
+ }
+ // 2. 交换堆顶元素与末尾元素,调整堆结构
+ for (int j = nums.length - 1; j >= 0; j--) {
+ int temp = nums[j];
+ nums[j] = nums[0];
+ nums[0] = temp;
+ adjustHeap(nums, 0, j);
+ }
+
+ return nums;
+ }
+
+
+ /**
+ * 将一个数组(二叉树), 调整成一个大顶堆
+ * 功能: 将以i对应的非叶子节点的树调整成大顶堆
+ * 举例:
+ * i = 1 => {4, 6, 8, 5, 9} => {4, 9, 8, 5, 6}
+ * i = 0 => {4, 9, 8, 5, 6} => {9, 6, 8, 5, 4}
+ * @param arr 待调整的数组
+ * @param i 表示非叶子节点在数组中索引
+ * @param length 表示对多少个元素继续调整, length 是在逐渐的减少
+ */
+ public void adjustHeap(int[] arr, int i, int length) {
+ // 当前非叶子节点值
+ int temp = arr[i];
+ // k = 2*i+1是i节点的左子节点,k+1是右子节点
+ for (int k = 2 * i + 1; k < length; k = 2 * k + 1) {
+ // 找左右子节点最大的值
+ if (k + 1 < length && arr[k] < arr[k + 1]) {
+ k++;
+ }
+ if (arr[k] > temp) {//子节点大于父节点
+ arr[i] = arr[k];//将较大的子节点赋值到当前节点(父节点)
+ i = k;//记录子节点的下标,为了最后 arr[i] = temp;
+ } else {
+ break;//从下至上,下面已经是大顶堆
+ }
+ }
+ //i = k; arr[i]此时已经是子节点的位置了,前面父节点已经拿到了子节点的值了,这里要将子节点的值赋为父节点的值
+ // 当for循环结束后,我们已经将以i为父结点的树的最大值,放在了最顶(局部)
+ arr[i] = temp;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new HeapSort().sortArray(new int[]{5, 2, 3, 1}));
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 5}, new HeapSort().sortArray(new int[]{5, 1, 1, 2, 0, 0}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/SelectSort.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/SelectSort.java"
new file mode 100644
index 00000000..404b1e1a
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\216\222\345\272\217\346\225\260\347\273\204_912_\344\270\255\347\255\211/\351\200\211\346\213\251/SelectSort.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.array.排序数组_912_中等.选择;
+
+import org.junit.Assert;
+
+class SelectSort {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rectangle-overlap/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 选择排序——不稳定
+ * https://zh.wikipedia.org/wiki/%E9%80%89%E6%8B%A9%E6%8E%92%E5%BA%8F
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public int[] sortArray(int[] nums) {
+ for (int i = 0; i < nums.length; i++) {
+
+ int minIdx = i;
+ for (int j = i + 1; j < nums.length; j++) {
+ if (nums[j] < nums[minIdx]) {
+ minIdx = j;
+ }
+ }
+ // 每次找到无序数组最小值的下标,放到已排序序列的末尾
+ if (nums[i] > nums[minIdx]) {
+ int temp = nums[i];
+ nums[i] = nums[minIdx];
+ nums[minIdx] = temp;
+ }
+ }
+ return nums;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertArrayEquals(new int[]{1, 2, 3, 5}, new SelectSort().sortArray(new int[]{5, 2, 3, 1}));
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 5}, new SelectSort().sortArray(new int[]{5, 1, 1, 2, 0, 0}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..7cebc5e1
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,28 @@
+package cn.lastwhisper.leetcode.array.数组中的第K个最大元素_215_中等;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/
+ * 编号:215
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 升序排序,取n-k个元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*logn)
+ * 空间复杂度:O(1)
+ */
+ public int findKthLargest(int[] nums, int k) {
+ Arrays.sort(nums);
+ return nums[nums.length - k];
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(5, new Solution1().findKthLargest(new int[]{3, 2, 1, 5, 6, 4}, 2));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..fe03e634
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\225\260\347\273\204\344\270\255\347\232\204\347\254\254K\344\270\252\346\234\200\345\244\247\345\205\203\347\264\240_215_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,75 @@
+package cn.lastwhisper.leetcode.array.数组中的第K个最大元素_215_中等;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/
+ * 编号:215
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:小顶堆
+ * 利用小顶堆的特性(堆顶元素最小),先对前K个数组元素进行"原地"建小顶堆,建完小顶堆后,堆顶的元素最小,正好是这K个元素的第K大元素。
+ * 然后遍历剩下的元素 nums[k] ~ nums[len-1]
+ * 1、如果比堆顶元素小,跳过
+ * 2、如果比堆顶元素大,和堆顶元素交换后重新堆化
+ * 建堆 buildHeap 时间复杂度 O(K),遍历剩下元素并且堆化 时间复杂度(N-K)*O(logK),总体的时间复杂度 O(NlogK)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(NlogK)
+ * 空间复杂度:O(1)
+ */
+ public int findKthLargest(int[] nums, int k) {
+ //前K个元素原地建小顶堆
+ buildHeap(nums, k);
+ //遍历剩下元素,比堆顶小,跳过;比堆顶大,交换后重新堆化
+ for (int i = k; i < nums.length; i++) {
+ if (nums[i] < nums[0]) continue;
+ swap(nums, i, 0);
+ heapify(nums, k, 0);
+ }
+ //K个元素的小顶堆的堆顶即是第K大元素
+ return nums[0];
+ }
+
+ /**
+ * 建堆函数
+ * 从倒数第一个非叶子节点开始堆化,倒数第一个非叶子节点下标为 K/2-1
+ */
+ public void buildHeap(int[] a, int k) {
+ for (int i = k / 2 - 1; i >= 0; i--) {
+ heapify(a, k, i);
+ }
+ }
+
+ /**
+ * 堆化函数
+ * 父节点下标i,左右子节点的下标分别为 2*i+1 和 2*i+2
+ */
+ public void heapify(int[] a, int k, int i) {
+ //临时变量 minPos 用于存储最小值的下标,先假设父节点最小
+ int minPos = i;
+ while (true) {
+ //和左子节点比较
+ if (i * 2 + 1 < k && a[i * 2 + 1] < a[i]) minPos = i * 2 + 1;
+ //和右子节点比较
+ if (i * 2 + 2 < k && a[i * 2 + 2] < a[minPos]) minPos = i * 2 + 2;
+ //如果minPos没有发生变化,说明父节点已经是最小了,直接跳出
+ if (minPos == i) break;
+ //否则交换
+ swap(a, i, minPos);
+ //父节点下标进行更新,继续堆化
+ i = minPos;
+ }
+ }
+
+ public void swap(int[] arr, int i, int j) {
+ int temp = arr[j];
+ arr[j] = arr[i];
+ arr[i] = temp;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(5, new Solution2().findKthLargest(new int[]{3, 2, 1, 5, 6, 4}, 2));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..2c0f8420
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,64 @@
+package cn.lastwhisper.leetcode.array.无重复字符的最长子串_3_中等;
+
+import java.util.HashSet;
+import java.util.Set;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
+ * 编号:3
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(滑动窗口)
+ * (1)左指针未超出边界,窗口继续扩容或缩小
+ * (2)Hash表每次检查右指针指向的值是否存在
+ * (3)存在则,移除该字符(移除标识),窗口长度减一
+ * (4)不存在,标识该字符已经存在,窗口长度加一
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // 字符串的长度
+ * 空间复杂度:O(1) // 窗口长度
+ */
+ public int lengthOfLongestSubstring(String s) {
+ int[] freq = new int[256];
+ // 窗口 [l,r] 内无重复元素
+ int l = 0, r = 0;
+ int res = 0;
+ while (l < s.length()) {
+ if (r < s.length() && freq[s.charAt(r)] == 0) {
+ freq[s.charAt(r++)]++;
+ } else {
+ freq[s.charAt(l++)]--;
+ }
+ // 这里 r - l 不加一,因为 l、r 初始化值都是0,并且是先用在加的
+ res = Math.max(res, (r - l));
+ }
+ return res;
+ }
+
+ //public int lengthOfLongestSubstring(String s) {
+ // Set hash = new HashSet<>();
+ // // 窗口 [l,r] 内无重复元素
+ // int l = 0, r = 0;
+ // int result = 0;
+ // while (l < s.length()) {
+ // if (r < s.length() && !hash.contains(s.charAt(r))) {
+ // hash.add(s.charAt(r));
+ // r++;
+ // } else {
+ // hash.remove(s.charAt(l));
+ // l++;
+ // }
+ // // 这里 r - l 不加一,因为 l、r 初始化值都是0,并且是先用在加的
+ // result = Math.max(result, r - l);
+ // }
+ // return result;
+ //}
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().lengthOfLongestSubstring("abcabcbb"));
+ System.out.println(new Solution1().lengthOfLongestSubstring("bbbbb"));
+ System.out.println(new Solution1().lengthOfLongestSubstring("pwwkew"));
+ System.out.println(new Solution1().lengthOfLongestSubstring(" "));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..ff9f77a7
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,36 @@
+package cn.lastwhisper.leetcode.array.无重复字符的最长子串_3_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
+ * 编号:3
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(滑动窗口)
+ * 优化 Solution1
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // 字符串的长度
+ * 空间复杂度:O(1) // 窗口长度
+ */
+ public int lengthOfLongestSubstring(String s) {
+ byte[] freq = new byte[256];
+ int l = 0, r = 0;
+ int res = 0;
+ while (l < s.length()) {
+ while (r < s.length() && freq[s.charAt(r)] == 0) {
+ freq[s.charAt(r++)]++;
+ }
+ res = Math.max(res, (r - l));
+ freq[s.charAt(l++)]--;
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().lengthOfLongestSubstring("abcabcbb"));
+ System.out.println(new Solution2().lengthOfLongestSubstring("bbbbb"));
+ System.out.println(new Solution2().lengthOfLongestSubstring("pwwkew"));
+ System.out.println(new Solution2().lengthOfLongestSubstring(" "));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java"
new file mode 100644
index 00000000..8026aeef
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java"
@@ -0,0 +1,81 @@
+package cn.lastwhisper.leetcode.array.最小覆盖子串_76_hard;
+
+class Solution1 {
+ /**
+ * https://leetcode-cn.com/problems/minimum-window-substring/
+ * 核心思想:滑动窗口
+ * 超时
+ */
+ public String minWindow(String s, String t) {
+ if (s.length() < t.length()) return "";//"a", "aa"
+ if (s.equals(t)) return s;//"a", "a"
+ // 用于判断s子串是否包含t
+ int[] map = new int[128];
+ String target = "";//"abc", "ac";"a", "b"
+ int l = 0, r = 0;
+ while (l <= s.length() && r <= s.length()) {
+ if (!isSub(s.substring(l, r), t, map)) {
+ // 不断增加 r 指针扩大窗口 [l, r],直到窗口中的字符串符合要求
+ r++;
+ } else {
+ // 不断增加 l 指针缩小窗口 [l, r],直到窗口中的字符串不再符合要求
+ if ("".equals(target)) {
+ target = s.substring(l, r);
+ } else {
+ target = target.length() > s.substring(l, r).length() ? s.substring(l, r) : target;
+ }
+ l++;
+ }
+
+ }
+ return target;
+ }
+
+ /**
+ * sub是否包含t
+ */
+ public boolean isSub(String sub, String t, int[] map) {
+ if (sub.length() < t.length()) return false;//过滤肯定不包含
+ boolean flag = true;
+ for (int i = 0; i < sub.length(); i++) {
+ map[sub.charAt(i)] += 1;
+ }
+ // 检验t在sub是否完全出现过
+ for (int i = 0; i < t.length(); i++) {
+ if (map[t.charAt(i)] > 0) {
+ //t在sub出现过
+ map[t.charAt(i)] -= 1;
+ } else {
+ //t在sub没出现过
+ flag = false;
+ }
+ }
+ // 检验sub是否完全包含t
+ for (int i = 0; i < t.length(); i++) {
+ if (map[t.charAt(i)] < 0) {
+ flag = false;
+ }
+ }
+ // 清空
+ for (int i = 0; i < sub.length(); i++) {
+ map[sub.charAt(i)] = 0;
+ }
+ return flag;
+ }
+
+ public static void main(String[] args) {
+ System.out.println("target:" + new Solution1().minWindow("ADOBECODEBANC", "ABC"));
+ System.out.println("target:" + new Solution1().minWindow("a", "a"));
+ System.out.println("target:" + new Solution1().minWindow("a", "aa"));
+ System.out.println("target:" + new Solution1().minWindow("a", "b"));
+ System.out.println("target:" + new Solution1().minWindow("abc", "ac"));
+ System.out.println("target:" + new Solution1().minWindow("bbaa", "aba"));
+ System.out.println("target:" + new Solution1().minWindow("abbc", "abc"));
+ //int[] arr = new int[128];
+ //System.out.println(new Solution1().isSub("ADCB", "ABC", arr));
+ //System.out.println(new Solution1().isSub("ADQCB", "ABC", arr));
+ //System.out.println(new Solution1().isSub("ADeB", "ABC", arr));
+ //System.out.println(new Solution1().isSub("abbc", "abc", arr));
+ //System.out.println(new Solution1().isSub("bbaa", "aba", arr));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java"
new file mode 100644
index 00000000..91ff8787
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java"
@@ -0,0 +1,82 @@
+package cn.lastwhisper.leetcode.array.最小覆盖子串_76_hard;
+
+class Solution2 {
+ /**
+ * https://leetcode-cn.com/problems/minimum-window-substring/
+ * 核心思想:滑动窗口
+ * 超时
+ */
+ public String minWindow(String s, String t) {
+ if (s.length() < t.length()) return "";//"a", "aa"
+ if (s.equals(t)) return s;//"a", "a"
+ char[] ss = s.toCharArray();
+ // 用于判断s子串是否包含t
+ int[] map = new int[128];
+ String target = "";//"abc", "ac";"a", "b"
+ int l = 0, r = 0;
+ while (l <= ss.length && r <= ss.length) {
+ if (!isSub(ss, l, r, t, map)) {
+ // 不断增加 r 指针扩大窗口 [l, r],直到窗口中的字符串符合要求
+ r++;
+ } else {
+ // 不断增加 l 指针缩小窗口 [l, r],直到窗口中的字符串不再符合要求
+ if ("".equals(target)) {
+ target = s.substring(l, r);
+ } else {
+ target = target.length() > s.substring(l, r).length() ? s.substring(l, r) : target;
+ }
+ l++;
+ }
+
+ }
+ return target;
+ }
+
+ /**
+ * sub是否包含t
+ */
+ public boolean isSub(char[] sub, int start, int end, String t, int[] map) {
+ if (sub.length < t.length()) return false;//过滤肯定不包含
+ boolean flag = true;
+ for (int i = start; i < end; i++) {
+ map[sub[i]] += 1;
+ }
+ // 检验t在sub是否完全出现过
+ for (int i = 0; i < t.length(); i++) {
+ if (map[t.charAt(i)] > 0) {
+ //t在sub出现过
+ map[t.charAt(i)] -= 1;
+ } else {
+ //t在sub没出现过
+ flag = false;
+ }
+ }
+ // 检验sub是否完全包含t
+ for (int i = 0; i < t.length(); i++) {
+ if (map[t.charAt(i)] < 0) {
+ flag = false;
+ }
+ }
+ // 清空
+ for (int i = start; i < end; i++) {
+ map[sub[i]] = 0;
+ }
+ return flag;
+ }
+
+ public static void main(String[] args) {
+ System.out.println("target:" + new Solution2().minWindow("ADOBECODEBANC", "ABC"));
+ System.out.println("target:" + new Solution2().minWindow("a", "a"));
+ System.out.println("target:" + new Solution2().minWindow("a", "aa"));
+ System.out.println("target:" + new Solution2().minWindow("a", "b"));
+ System.out.println("target:" + new Solution2().minWindow("abc", "ac"));
+ System.out.println("target:" + new Solution2().minWindow("bbaa", "aba"));
+ System.out.println("target:" + new Solution2().minWindow("abbc", "abc"));
+ //int[] arr = new int[128];
+ //System.out.println(new Solution2().isSub("ADCB", "ABC", arr));
+ //System.out.println(new Solution2().isSub("ADQCB", "ABC", arr));
+ //System.out.println(new Solution2().isSub("ADeB", "ABC", arr));
+ //System.out.println(new Solution2().isSub("abbc", "abc", arr));
+ //System.out.println(new Solution2().isSub("bbaa", "aba", arr));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java"
new file mode 100644
index 00000000..5d61574b
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java"
@@ -0,0 +1,87 @@
+package cn.lastwhisper.leetcode.array.最小覆盖子串_76_hard;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution3 {
+ public String minWindow(String s, String t) {
+
+ if (s.length() == 0 || t.length() == 0) {
+ return "";
+ }
+
+ // Dictionary which keeps a count of all the unique characters in t.
+ Map dictT = new HashMap();
+ for (int i = 0; i < t.length(); i++) {
+ int count = dictT.getOrDefault(t.charAt(i), 0);
+ dictT.put(t.charAt(i), count + 1);
+ }
+
+ // Number of unique characters in t, which need to be present in the desired window.
+ int required = dictT.size();
+
+ // Left and Right pointer
+ int l = 0, r = 0;
+
+ // formed is used to keep track of how many unique characters in t
+ // are present in the current window in its desired frequency.
+ // e.g. if t is "AABC" then the window must have two A's, one B and one C.
+ // Thus formed would be = 3 when all these conditions are met.
+ int formed = 0;
+
+ // Dictionary which keeps a count of all the unique characters in the current window.
+ Map windowCounts = new HashMap();
+
+ // ans list of the form (window length, left, right)
+ int[] ans = {-1, 0, 0};
+
+ while (r < s.length()) {
+ // Add one character from the right to the window
+ char c = s.charAt(r);
+ int count = windowCounts.getOrDefault(c, 0);
+ windowCounts.put(c, count + 1);
+
+ // If the frequency of the current character added equals to the
+ // desired count in t then increment the formed count by 1.
+ if (dictT.containsKey(c) && windowCounts.get(c).intValue() == dictT.get(c).intValue()) {
+ formed++;
+ }
+
+ // Try and co***act the window till the point where it ceases to be 'desirable'.
+ while (l <= r && formed == required) {
+ c = s.charAt(l);
+ // Save the smallest window until now.
+ if (ans[0] == -1 || r - l + 1 < ans[0]) {
+ ans[0] = r - l + 1;
+ ans[1] = l;
+ ans[2] = r;
+ }
+
+ // The character at the position pointed by the
+ // `Left` pointer is no longer a part of the window.
+ windowCounts.put(c, windowCounts.get(c) - 1);
+ if (dictT.containsKey(c) && windowCounts.get(c).intValue() < dictT.get(c).intValue()) {
+ formed--;
+ }
+
+ // Move the left pointer ahead, this would help to look for a new window.
+ l++;
+ }
+
+ // Keep expanding the window once we are done co***acting.
+ r++;
+ }
+
+ return ans[0] == -1 ? "" : s.substring(ans[1], ans[2] + 1);
+ }
+
+ public static void main(String[] args) {
+ System.out.println("target:" + new Solution3().minWindow("ADOBECODEBANC", "ABC"));
+ System.out.println("target:" + new Solution3().minWindow("a", "a"));
+ System.out.println("target:" + new Solution3().minWindow("a", "aa"));
+ System.out.println("target:" + new Solution3().minWindow("a", "b"));
+ System.out.println("target:" + new Solution3().minWindow("abc", "ac"));
+ System.out.println("target:" + new Solution3().minWindow("bbaa", "aba"));
+ System.out.println("target:" + new Solution3().minWindow("abbc", "abc"));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java"
new file mode 100644
index 00000000..2c81b182
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.array.最小覆盖子串_76_hard;
+
+class Solution4 {
+ public String minWindow(String s, String t) {
+ //把字符串转换为字符数组
+ char[] sChars = s.toCharArray();
+ char[] pChars = t.toCharArray();
+ //
+ int[] pMap = new int[128];
+ //左指针,右指针
+ int i = 0, j = 0; // 考察窗口[i,j-1]
+ //还没有覆盖的字符数量
+ int count = pChars.length;
+
+ //初始化记录答案的变量
+ int minLen = s.length() + 1, l = 0, r = 0;
+
+ //记录t串中每种字符出现的次数
+ for (char pChar : pChars)
+ pMap[pChar]++;
+
+ while (j < sChars.length) {
+
+ //减小计数
+ if (pMap[sChars[j]] > 0)
+ count--;
+ pMap[sChars[j]]--;
+ j++;
+
+ //计数为 0说明区间[i,j-1] 包含 p
+ while (count == 0) {
+
+ //更新答案
+ if (j - i < minLen) {
+ minLen = j - i;
+ l = i;
+ r = j;
+ }
+
+ pMap[sChars[i]]++;
+ // 增加计数
+ if (pMap[sChars[i]] > 0)
+ count++;
+ i++;
+ }
+ }
+ return minLen == s.length() + 1 ? "" : s.substring(l, r);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..9c95a7c8
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.array.有效的字母异位词_242_简单;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution1 {
+ public boolean isAnagram(String s, String t) {
+ char[] sChar = s.toCharArray();
+ char[] tChar = t.toCharArray();
+ HashMap map = new HashMap<>();
+ for (int i = 0; i < sChar.length; i++) {
+ Integer num = map.get(sChar[i]);
+ if (num == null) {
+ map.put(sChar[i], 1);
+ } else {
+ map.put(sChar[i], ++num);
+ }
+ }
+
+ for (int i = 0; i < tChar.length; i++) {
+ Integer num = map.get(tChar[i]);
+ if (num == null) {
+ return false;
+ } else {
+ map.put(tChar[i], --num);
+ }
+ }
+ for (Map.Entry entry : map.entrySet()) {
+ if (entry.getValue() != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ //String s = "anagram", t = "nagaram";
+ String s = "rat", t = "car";
+
+ System.out.println(new Solution1().isAnagram(s, t));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..6c53f39c
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_242_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.array.有效的字母异位词_242_简单;
+
+class Solution2 {
+ /**
+ * https://leetcode-cn.com/problems/valid-anagram/submissions/
+ * hash
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public boolean isAnagram(String s, String t) {
+ if (s.length() != t.length()) {
+ return false;
+ }
+ char[] sChar = s.toCharArray();
+ char[] tChar = t.toCharArray();
+ byte[] freq = new byte[256];
+ for (int i = 0; i < sChar.length; i++) {
+ freq[sChar[i]]++;
+ }
+
+ for (int i = 0; i < tChar.length; i++) {
+ freq[tChar[i]]--;
+ }
+ for (int i = 0; i < freq.length; i++) {
+ if (freq[i] != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ String s = "anagram", t = "nagaram";
+ //String s = "rat", t = "car";
+
+ System.out.println(new Solution2().isAnagram(s, t));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution1.java"
deleted file mode 100644
index 5f603473..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution1.java"
+++ /dev/null
@@ -1,72 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.找到字符串中所有字母异位词_438_Medium;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/
- * 核心思想:滑动窗口
- * 时间复杂度:O(n^2)
- */
- public List findAnagrams(String s, String p) {
- List list = new ArrayList<>();
- // 过滤肯定不符合规则的数据
- if (s == null || s.length() < p.length()) {
- return list;
- }
- int l = 0, r = 0;
- char[] sChar = s.toCharArray();
- char[] pChar = p.toCharArray();
- while (l < sChar.length && r < sChar.length) {
- // [l,r]不满足异位词
- if (!isAnagram(sChar, l, r, pChar)) {
- // [l,r]不满足异位词且窗口大小不满足,扩展右边界
- if ((r - l) != pChar.length) {
- r++;
- } else {
- // [l,r]不满足异位词且窗口大小满足,扩展左边界
- l++;
- }
- } else {
- // [l,r]满足异位词,扩展左边界
- list.add(l);
- l++;
- }
- }
- return list;
- }
-
- public boolean isAnagram(char[] sChar, int start, int end, char[] pChar) {
- if ((end - start + 1) != pChar.length) {
- return false;
- }
- byte[] freq = new byte[26];
- for (int i = start; i <= end; i++) {
- freq[sChar[i] - 'a']++;
- }
-
- for (int i = 0; i < pChar.length; i++) {
- freq[pChar[i] - 'a']--;
- }
- for (int i = 0; i < freq.length; i++) {
- if (freq[i] != 0) {
- return false;
- }
- }
- return true;
- }
-
-
- public static void main(String[] args) {
- new Solution1().findAnagrams("cbaebabacd", "abc").forEach(System.out::print);
- System.out.println();
- new Solution1().findAnagrams("abab", "ab").forEach(System.out::print);
- System.out.println();
- new Solution1().findAnagrams("", "a").forEach(System.out::print);//错误数据
-
- //System.out.println(new Solution1().isAnagram(new char[]{'c','b','a'}, new char[]{'a','b','c'}));
-
- }
-
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution2.java"
deleted file mode 100644
index e8480290..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution2.java"
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.找到字符串中所有字母异位词_438_Medium;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/
- * 核心思想:滑动窗口
- * 时间复杂度:O(n)
- */
- public List findAnagrams(String s, String p) {
- if (s == null || s.length() == 0) return new ArrayList<>();
- List res = new ArrayList<>();
- int[] needs = new int[26]; //由于都是小写字母,因此直接用26个长度的数组代替原来的HashMap
- int[] window = new int[26];
- int left = 0, right = 0, total = p.length(); //用total检测窗口中是否已经涵盖了p中的字符
- for (char ch : p.toCharArray()) {
- needs[ch - 'a']++;
- }
- while (right < s.length()) {
- char chr = s.charAt(right);
- if (needs[chr - 'a'] > 0) {
- window[chr - 'a']++;
- if (window[chr - 'a'] <= needs[chr - 'a']) {
- total--;
- }
- }
- while (total == 0) {
- if (right - left + 1 == p.length()) {
- res.add(left);
- }
- char chl = s.charAt(left);
- if (needs[chl - 'a'] > 0) {
- window[chl - 'a']--;
- if (window[chl - 'a'] < needs[chl - 'a']) {
- total++;
- }
- }
- left++;
- }
- right++;
- }
- return res;
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution3.java"
deleted file mode 100644
index f42488b3..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\211\276\345\210\260\345\255\227\347\254\246\344\270\262\344\270\255\346\211\200\346\234\211\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215_438_Medium/Solution3.java"
+++ /dev/null
@@ -1,50 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.找到字符串中所有字母异位词_438_Medium;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class Solution3 {
-
- public List findAnagrams(String s, String p) {
- int sl = s.length();
- int pl = p.length();
- char[] sArr = s.toCharArray();
- char[] pArr = p.toCharArray();
- // 保存当前窗口的字符出现次数的哈希表
- char[] sLetters = new char[26];
- // 保存目标字符串字符出现次数的哈希表
- char[] pLetters = new char[26];
- ArrayList ans = new ArrayList<>(sl / pl);
- // 填充目标字符串的哈希表
- for (int i = 0; i < pl; i++) {
- pLetters[pArr[i] - 'a']++;
- }
- // 滑动窗口
- int left = 0;
- int right = 0;
- while (right < sl) {
- // 当前字符在数组中的索引
- int cur = sArr[right++] - 'a';
- // 记录窗口中字符的出现次数
- sLetters[cur]++;
- // 如果在窗口中的当前字符的出现次数大于目标字符串中该字符的出现次数,即不符合条件,则右移窗口。
- // 无论是字符出现次数多余目标字符串还是字符不在目标字符串数组中,右移窗口后都可以解决。
- while (pLetters[cur] < sLetters[cur]) {
- // 这里将位于left上的字符(滑动窗口最左边的字符)从sLetters(记录窗口中字符出现次数的哈希表)中减去(值减一,抽象上等同于把该字符移出滑动窗口),同时left++,完成窗口右移。
- sLetters[sArr[left++] - 'a']--;
- }
- // 窗口调整完成后,判断当前窗口是否满足条件,即窗口长度和目标字符串长度是否相等。
- if (right - left == pl) ans.add(left);
- }
-
- return ans;
- }
-
- public static void main(String[] args) {
- //new Solution2().findAnagrams("cbaebabacd", "abc").forEach(System.out::print);
- //System.out.println();
- new Solution3().findAnagrams("abab", "ab").forEach(System.out::print);
- System.out.println();
- //new Solution2().findAnagrams("", "a").forEach(System.out::print);//错误数据
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Performance.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Performance.java"
deleted file mode 100644
index d9e6b3c0..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Performance.java"
+++ /dev/null
@@ -1,49 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-import java.lang.reflect.Method;
-import java.lang.Class;
-
-// 比较这个工程中 Solution1, Solution5, Solution6, Solution4 和 Solution3 的算法运行效率
-public class Performance {
-
- public static void testPerformance(String algoClassName, String algoName, String s){
-
- try{
- Class algoClass = Class.forName(algoClassName);
- Object solution = algoClass.newInstance();
-
- // 通过排序函数的Class对象获得排序方法
- Method algoMethod = algoClass.getMethod(algoName, String.class);
-
- long startTime = System.currentTimeMillis();
- // 调用算法
- Object resObj = algoMethod.invoke(solution, s);
- long endTime = System.currentTimeMillis();
-
- int res = (Integer)resObj;
- System.out.print(algoClassName + " : res = " + res + " ");
- System.out.println("Time = " + (endTime-startTime) + " ms" );
- }
- catch(Exception e){
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) {
-
- int n = 10000000;
-
- StringBuilder s = new StringBuilder(n);
- for(int i = 0 ; i < n ; i ++)
- s.append((char)(Math.random()*95 + 32));
-
- System.out.println("Test: 10,000,000 length of completely random string:");
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution1", "lengthOfLongestSubstring", s.toString());
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution2", "lengthOfLongestSubstring", s.toString());
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution3", "lengthOfLongestSubstring", s.toString());
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution4", "lengthOfLongestSubstring", s.toString());
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution5", "lengthOfLongestSubstring", s.toString());
- testPerformance("cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium.Solution6", "lengthOfLongestSubstring", s.toString());
-
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution1.java"
deleted file mode 100644
index d7c5d7eb..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution1.java"
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/submissions/
- * 核心思想:滑动窗口
- * 时间复杂度: O(len(s))
- * 空间复杂度: O(len(charset))
- */
- public int lengthOfLongestSubstring(String s) {
- int[] freq = new int[256];
- int l = 0, r = 0;
- int res = 0;
- char[] chars = s.toCharArray();
- while (l < chars.length) {
- if (r < chars.length && freq[chars[r]] == 0) {
- freq[chars[r++]]++;
- } else {
- freq[chars[l++]]--;
- }
- res = Math.max(res, (r - l));
- }
- return res;
- }
-
- //public int lengthOfLongestSubstring(String s) {
- // int[] freq = new int[256];
- // int l = 0, r = 0;
- // int res = 0;
- // while (l < s.length()) {
- // if (r < s.length() && freq[s.charAt(r)] == 0) {
- // freq[s.charAt(r++)]++;
- // } else {
- // freq[s.charAt(l++)]--;
- // }
- // res = Math.max(res, (r - l));
- // }
- // return res;
- //}
-
- public static void main(String[] args) {
- System.out.println(new Solution1().lengthOfLongestSubstring("abcabcbb"));
- System.out.println(new Solution1().lengthOfLongestSubstring("bbbbb"));
- System.out.println(new Solution1().lengthOfLongestSubstring("pwwkew"));
- System.out.println(new Solution1().lengthOfLongestSubstring(" "));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution2.java"
deleted file mode 100644
index 06470611..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution2.java"
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/submissions/
- * 核心思想:滑动窗口,在Solution1的基础上优化
- * 时间复杂度: O(len(s))
- * 空间复杂度: O(len(charset))
- */
- public int lengthOfLongestSubstring(String s) {
- byte[] freq = new byte[256];
- int l = 0, r = 0;
- int res = 0;
- char[] chars = s.toCharArray();
- while (l < chars.length) {
- while (r < chars.length && freq[chars[r]] == 0) {
- freq[chars[r++]]++;
- }
- res = Math.max(res, (r - l));
- freq[chars[l++]]--;
- }
- return res;
- }
-
- //public int lengthOfLongestSubstring(String s) {
- // byte[] freq = new byte[256];
- // int l = 0, r = 0;
- // int res = 0;
- // while (l < s.length()) {
- // while (r < s.length() && freq[s.charAt(r)] == 0) {
- // freq[s.charAt(r++)]++;
- // }
- // res = Math.max(res, (r - l));
- // freq[s.charAt(l++)]--;
- // }
- // return res;
- //}
-
- public static void main(String[] args) {
- System.out.println(new Solution2().lengthOfLongestSubstring("abcabcbb"));
- System.out.println(new Solution2().lengthOfLongestSubstring("bbbbb"));
- System.out.println(new Solution2().lengthOfLongestSubstring("pwwkew"));
- System.out.println(new Solution2().lengthOfLongestSubstring(" "));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution3.java"
deleted file mode 100644
index 2aa5abb1..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution3.java"
+++ /dev/null
@@ -1,40 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;// 3. Longest Substring Without Repeating Characters
-// https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
-//
-// 滑动窗口
-// 其中使用last[c]保存字符c上一次出现的位置, 用于在右边界发现重复字符时, 快速移动左边界
-// 使用这种方法, 时间复杂度依然为O(n), 但是只需要动r指针, 实际上对整个s只遍历了一次
-// 相较而言, 之前的方法, 需要移动l和r两个指针, 相对于对s遍历了两次
-
-import java.util.Arrays;
-
-// 时间复杂度: O(len(s))
-// 空间复杂度: O(len(charset))
-public class Solution3 {
-
- public int lengthOfLongestSubstring(String s) {
-
- int[] last = new int[256];
- Arrays.fill(last, -1);
- int l = 0, r = -1; //滑动窗口为s[l...r]
- int res = 0;
- while (r + 1 < s.length()) {
- r++;
- if (last[s.charAt(r)] != -1)
- l = Math.max(l, last[s.charAt(r)] + 1);
- res = Math.max(res, r - l + 1);
- last[s.charAt(r)] = r;
- }
-
- return res;
- }
-
- public static void main(String[] args) {
-
- System.out.println((new Solution3()).lengthOfLongestSubstring("abcabcbb"));
- System.out.println((new Solution3()).lengthOfLongestSubstring("bbbbb"));
- System.out.println((new Solution3()).lengthOfLongestSubstring("pwwkew"));
- System.out.println((new Solution3()).lengthOfLongestSubstring(""));
- System.out.println((new Solution3()).lengthOfLongestSubstring(" "));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution4.java"
deleted file mode 100644
index ce8e8179..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution4.java"
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-// 3. Longest Substring Without Repeating Characters
-// https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
-//
-// 课程问答区 @yatkun 提出的方法,
-// l每次可以向前跳跃, 而不仅仅是+1
-// 但代价是, 为了获得这个跳跃的位置, 每次需要遍历整个窗口的字符串
-//
-// 时间复杂度: O(len(s)*len(charset))
-// 空间复杂度: O(1)
-public class Solution4{
-
- public int lengthOfLongestSubstring(String s) {
-
- int l = 0, r = 0; //滑动窗口为s[l...r]
- int res = 0;
-
- while(r < s.length()){
-
- int index = isDuplicateChar(s, l, r);
-
- // 如果s[r]之前出现过
- // l可以直接跳到s[r+1]之前出现的位置 + 1的地方
- if(index != -1)
- l = index + 1;
-
- res = Math.max(res, r-l+1);
- r ++;
- }
-
- return res;
- }
-
- // 查看s[l...r-1]之间是否存在s[r]
- // 若存在,返回相应的索引, 否则返回-1
- private int isDuplicateChar(String s, int l, int r){
- for(int i = l ; i < r ; i ++)
- if(s.charAt(i) == s.charAt(r))
- return i;
- return -1;
- }
-
- public static void main(String[] args) {
-
- System.out.println((new Solution4()).lengthOfLongestSubstring( "abcabcbb" ));
- System.out.println((new Solution4()).lengthOfLongestSubstring( "bbbbb" ));
- System.out.println((new Solution4()).lengthOfLongestSubstring( "pwwkew" ));
- System.out.println((new Solution4()).lengthOfLongestSubstring( "" ));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution5.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution5.java"
deleted file mode 100644
index 41abf904..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution5.java"
+++ /dev/null
@@ -1,38 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-// 3. Longest Substring Without Repeating Characters
-// https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
-//
-// 滑动窗口
-// 时间复杂度: O(len(s))
-// 空间复杂度: O(len(charset))
-public class Solution5 {
- public int lengthOfLongestSubstring(String s) {
-
- int[] freq = new int[256];
-
- int l = 0, r = -1; //滑动窗口为s[l...r]
- int res = 0;
-
- // 在这里, 循环中止的条件可以是 r + 1 < s.length(), 想想看为什么?
- // 感谢课程QQ群 @千千 指出 :)
- while( r + 1 < s.length() ){
-
- if( r + 1 < s.length() && freq[s.charAt(r+1)] == 0 )
- freq[s.charAt(++r)] ++;
- else //freq[s[r+1]] == 1
- freq[s.charAt(l++)] --;
-
- res = Math.max(res, r-l+1);
- }
-
- return res;
- }
-
- public static void main(String[] args) {
- System.out.println((new Solution5()).lengthOfLongestSubstring( "abcabcbb" ));
- System.out.println((new Solution5()).lengthOfLongestSubstring( "bbbbb" ));
- System.out.println((new Solution5()).lengthOfLongestSubstring( "pwwkew" ));
- System.out.println((new Solution5()).lengthOfLongestSubstring( "" ));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution6.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution6.java"
deleted file mode 100644
index 9ae65b79..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262_3_Medium/Solution6.java"
+++ /dev/null
@@ -1,42 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.无重复字符的最长子串_3_Medium;
-
-// 3. Longest Substring Without Repeating Characters
-// https://leetcode.com/problems/longest-substring-without-repeating-characters/description/
-//
-// 滑动窗口的另一个实现, 仅做参考
-// 时间复杂度: O(len(s))
-// 空间复杂度: O(len(charset))
-public class Solution6 {
- public int lengthOfLongestSubstring(String s) {
-
- int[] freq = new int[256];
-
- int l = 0, r = -1; //滑动窗口为s[l...r]
- int res = 0;
-
- while(r + 1 < s.length()){
-
- while(r + 1 < s.length() && freq[s.charAt(r+1)] == 0)
- freq[s.charAt(++r)] ++;
-
- res = Math.max(res, r - l + 1);
-
- if(r + 1 < s.length()){
- freq[s.charAt(++r)] ++;
- assert(freq[s.charAt(r)] == 2);
- while(l <= r && freq[s.charAt(r)] == 2)
- freq[s.charAt(l++)] --;
- }
- }
-
- return res;
- }
-
- public static void main(String[] args) {
-
- System.out.println((new Solution6()).lengthOfLongestSubstring( "abcabcbb" ));
- System.out.println((new Solution6()).lengthOfLongestSubstring( "bbbbb" ));
- System.out.println((new Solution6()).lengthOfLongestSubstring( "pwwkew" ));
- System.out.println((new Solution6()).lengthOfLongestSubstring( "" ));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java"
deleted file mode 100644
index b3891057..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution1.java"
+++ /dev/null
@@ -1,81 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.最小覆盖子串_76_hard;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/minimum-window-substring/
- * 核心思想:滑动窗口
- * 超时
- */
- public String minWindow(String s, String t) {
- if (s.length() < t.length()) return "";//"a", "aa"
- if (s.equals(t)) return s;//"a", "a"
- // 用于判断s子串是否包含t
- int[] map = new int[128];
- String target = "";//"abc", "ac";"a", "b"
- int l = 0, r = 0;
- while (l <= s.length() && r <= s.length()) {
- if (!isSub(s.substring(l, r), t, map)) {
- // 不断增加 r 指针扩大窗口 [l, r],直到窗口中的字符串符合要求
- r++;
- } else {
- // 不断增加 l 指针缩小窗口 [l, r],直到窗口中的字符串不再符合要求
- if ("".equals(target)) {
- target = s.substring(l, r);
- } else {
- target = target.length() > s.substring(l, r).length() ? s.substring(l, r) : target;
- }
- l++;
- }
-
- }
- return target;
- }
-
- /**
- * sub是否包含t
- */
- public boolean isSub(String sub, String t, int[] map) {
- if (sub.length() < t.length()) return false;//过滤肯定不包含
- boolean flag = true;
- for (int i = 0; i < sub.length(); i++) {
- map[sub.charAt(i)] += 1;
- }
- // 检验t在sub是否完全出现过
- for (int i = 0; i < t.length(); i++) {
- if (map[t.charAt(i)] > 0) {
- //t在sub出现过
- map[t.charAt(i)] -= 1;
- } else {
- //t在sub没出现过
- flag = false;
- }
- }
- // 检验sub是否完全包含t
- for (int i = 0; i < t.length(); i++) {
- if (map[t.charAt(i)] < 0) {
- flag = false;
- }
- }
- // 清空
- for (int i = 0; i < sub.length(); i++) {
- map[sub.charAt(i)] = 0;
- }
- return flag;
- }
-
- public static void main(String[] args) {
- System.out.println("target:" + new Solution1().minWindow("ADOBECODEBANC", "ABC"));
- System.out.println("target:" + new Solution1().minWindow("a", "a"));
- System.out.println("target:" + new Solution1().minWindow("a", "aa"));
- System.out.println("target:" + new Solution1().minWindow("a", "b"));
- System.out.println("target:" + new Solution1().minWindow("abc", "ac"));
- System.out.println("target:" + new Solution1().minWindow("bbaa", "aba"));
- System.out.println("target:" + new Solution1().minWindow("abbc", "abc"));
- //int[] arr = new int[128];
- //System.out.println(new Solution1().isSub("ADCB", "ABC", arr));
- //System.out.println(new Solution1().isSub("ADQCB", "ABC", arr));
- //System.out.println(new Solution1().isSub("ADeB", "ABC", arr));
- //System.out.println(new Solution1().isSub("abbc", "abc", arr));
- //System.out.println(new Solution1().isSub("bbaa", "aba", arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java"
deleted file mode 100644
index acc9e6ec..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution2.java"
+++ /dev/null
@@ -1,82 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.最小覆盖子串_76_hard;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/minimum-window-substring/
- * 核心思想:滑动窗口
- * 超时
- */
- public String minWindow(String s, String t) {
- if (s.length() < t.length()) return "";//"a", "aa"
- if (s.equals(t)) return s;//"a", "a"
- char[] ss = s.toCharArray();
- // 用于判断s子串是否包含t
- int[] map = new int[128];
- String target = "";//"abc", "ac";"a", "b"
- int l = 0, r = 0;
- while (l <= ss.length && r <= ss.length) {
- if (!isSub(ss, l, r, t, map)) {
- // 不断增加 r 指针扩大窗口 [l, r],直到窗口中的字符串符合要求
- r++;
- } else {
- // 不断增加 l 指针缩小窗口 [l, r],直到窗口中的字符串不再符合要求
- if ("".equals(target)) {
- target = s.substring(l, r);
- } else {
- target = target.length() > s.substring(l, r).length() ? s.substring(l, r) : target;
- }
- l++;
- }
-
- }
- return target;
- }
-
- /**
- * sub是否包含t
- */
- public boolean isSub(char[] sub, int start, int end, String t, int[] map) {
- if (sub.length < t.length()) return false;//过滤肯定不包含
- boolean flag = true;
- for (int i = start; i < end; i++) {
- map[sub[i]] += 1;
- }
- // 检验t在sub是否完全出现过
- for (int i = 0; i < t.length(); i++) {
- if (map[t.charAt(i)] > 0) {
- //t在sub出现过
- map[t.charAt(i)] -= 1;
- } else {
- //t在sub没出现过
- flag = false;
- }
- }
- // 检验sub是否完全包含t
- for (int i = 0; i < t.length(); i++) {
- if (map[t.charAt(i)] < 0) {
- flag = false;
- }
- }
- // 清空
- for (int i = start; i < end; i++) {
- map[sub[i]] = 0;
- }
- return flag;
- }
-
- public static void main(String[] args) {
- System.out.println("target:" + new Solution2().minWindow("ADOBECODEBANC", "ABC"));
- System.out.println("target:" + new Solution2().minWindow("a", "a"));
- System.out.println("target:" + new Solution2().minWindow("a", "aa"));
- System.out.println("target:" + new Solution2().minWindow("a", "b"));
- System.out.println("target:" + new Solution2().minWindow("abc", "ac"));
- System.out.println("target:" + new Solution2().minWindow("bbaa", "aba"));
- System.out.println("target:" + new Solution2().minWindow("abbc", "abc"));
- //int[] arr = new int[128];
- //System.out.println(new Solution2().isSub("ADCB", "ABC", arr));
- //System.out.println(new Solution2().isSub("ADQCB", "ABC", arr));
- //System.out.println(new Solution2().isSub("ADeB", "ABC", arr));
- //System.out.println(new Solution2().isSub("abbc", "abc", arr));
- //System.out.println(new Solution2().isSub("bbaa", "aba", arr));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java"
deleted file mode 100644
index c7521ecb..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution3.java"
+++ /dev/null
@@ -1,87 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.最小覆盖子串_76_hard;
-
-import java.util.HashMap;
-import java.util.Map;
-
-class Solution3 {
- public String minWindow(String s, String t) {
-
- if (s.length() == 0 || t.length() == 0) {
- return "";
- }
-
- // Dictionary which keeps a count of all the unique characters in t.
- Map dictT = new HashMap();
- for (int i = 0; i < t.length(); i++) {
- int count = dictT.getOrDefault(t.charAt(i), 0);
- dictT.put(t.charAt(i), count + 1);
- }
-
- // Number of unique characters in t, which need to be present in the desired window.
- int required = dictT.size();
-
- // Left and Right pointer
- int l = 0, r = 0;
-
- // formed is used to keep track of how many unique characters in t
- // are present in the current window in its desired frequency.
- // e.g. if t is "AABC" then the window must have two A's, one B and one C.
- // Thus formed would be = 3 when all these conditions are met.
- int formed = 0;
-
- // Dictionary which keeps a count of all the unique characters in the current window.
- Map windowCounts = new HashMap();
-
- // ans list of the form (window length, left, right)
- int[] ans = {-1, 0, 0};
-
- while (r < s.length()) {
- // Add one character from the right to the window
- char c = s.charAt(r);
- int count = windowCounts.getOrDefault(c, 0);
- windowCounts.put(c, count + 1);
-
- // If the frequency of the current character added equals to the
- // desired count in t then increment the formed count by 1.
- if (dictT.containsKey(c) && windowCounts.get(c).intValue() == dictT.get(c).intValue()) {
- formed++;
- }
-
- // Try and co***act the window till the point where it ceases to be 'desirable'.
- while (l <= r && formed == required) {
- c = s.charAt(l);
- // Save the smallest window until now.
- if (ans[0] == -1 || r - l + 1 < ans[0]) {
- ans[0] = r - l + 1;
- ans[1] = l;
- ans[2] = r;
- }
-
- // The character at the position pointed by the
- // `Left` pointer is no longer a part of the window.
- windowCounts.put(c, windowCounts.get(c) - 1);
- if (dictT.containsKey(c) && windowCounts.get(c).intValue() < dictT.get(c).intValue()) {
- formed--;
- }
-
- // Move the left pointer ahead, this would help to look for a new window.
- l++;
- }
-
- // Keep expanding the window once we are done co***acting.
- r++;
- }
-
- return ans[0] == -1 ? "" : s.substring(ans[1], ans[2] + 1);
- }
-
- public static void main(String[] args) {
- System.out.println("target:" + new Solution3().minWindow("ADOBECODEBANC", "ABC"));
- System.out.println("target:" + new Solution3().minWindow("a", "a"));
- System.out.println("target:" + new Solution3().minWindow("a", "aa"));
- System.out.println("target:" + new Solution3().minWindow("a", "b"));
- System.out.println("target:" + new Solution3().minWindow("abc", "ac"));
- System.out.println("target:" + new Solution3().minWindow("bbaa", "aba"));
- System.out.println("target:" + new Solution3().minWindow("abbc", "abc"));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java"
deleted file mode 100644
index fce81bdb..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\346\234\200\345\260\217\350\246\206\347\233\226\345\255\220\344\270\262_76_hard/Solution4.java"
+++ /dev/null
@@ -1,49 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.最小覆盖子串_76_hard;
-
-class Solution4 {
- public String minWindow(String s, String t) {
- //把字符串转换为字符数组
- char[] sChars = s.toCharArray();
- char[] pChars = t.toCharArray();
- //
- int[] pMap = new int[128];
- //左指针,右指针
- int i = 0, j = 0; // 考察窗口[i,j-1]
- //还没有覆盖的字符数量
- int count = pChars.length;
-
- //初始化记录答案的变量
- int minLen = s.length() + 1, l = 0, r = 0;
-
- //记录t串中每种字符出现的次数
- for (char pChar : pChars)
- pMap[pChar]++;
-
- while (j < sChars.length) {
-
- //减小计数
- if (pMap[sChars[j]] > 0)
- count--;
- pMap[sChars[j]]--;
- j++;
-
- //计数为 0说明区间[i,j-1] 包含 p
- while (count == 0) {
-
- //更新答案
- if (j - i < minLen) {
- minLen = j - i;
- l = i;
- r = j;
- }
-
- pMap[sChars[i]]++;
- // 增加计数
- if (pMap[sChars[i]] > 0)
- count++;
- i++;
- }
- }
- return minLen == s.length() + 1 ? "" : s.substring(l, r);
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution1.java"
deleted file mode 100644
index 898b86b7..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution1.java"
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.长度最小的子数组_209_Medium;
-
-/**
- * @author lastwhisper
- */
-public class Solution1 {
- /**
- * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- * 暴力解法
- * 时间复杂度:O(n^3)
- * 空间复杂度:O(1)
- */
- public int minSubArrayLen(int s, int[] nums) {
- if (s <= 0 || nums == null) {
- throw new IllegalArgumentException("Illegal Argument");
- }
- int res = nums.length + 1;
- for (int l = 0; l < nums.length; l++) {
- for (int r = l; r < nums.length; r++) {
- int sum = 0;
- // 求[l...r]子数组之和
- for (int i = l; i < r; i++) {
- sum += nums[i];
- }
- if (sum >= s) {
- res = Math.min(res, r - l + 1);
- }
- }
- }
- if (res == nums.length + 1) {
- return 0;
- }
- return res;
- }
-
- public static void main(String[] args) {
- int[] nums = {2, 3, 1, 2, 4, 3};
- int s = 7;
- System.out.println((new Solution1()).minSubArrayLen(s, nums));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution2.java"
deleted file mode 100644
index 85d3de20..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution2.java"
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.长度最小的子数组_209_Medium;
-
-/**
- * 209. 长度最小的子数组
- * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- * @author lastwhisper
- */
-public class Solution2 {
- // 优化暴力解法
-
- public int minSubArrayLen(int s, int[] nums) {
- if (s <= 0 || nums == null) {
- throw new IllegalArgumentException("Illegal Argument");
- }
-
- int[] sum = new int[nums.length + 1];
- sum[0] = 0;
- // nums=> 2, 3, 1, 2, 4, 3
- // sum=>0, 2, 5, 6, 8, 12,7
- // sums[i]存放nums[0...i-1]的和
- for (int i = 1; i <= nums.length; i++) {
- sum[i] = sum[i - 1] + nums[i - 1];
- }
-
- int res = nums.length + 1;
- for (int l = 0; l < nums.length; l++) {
- for (int r = l; r < nums.length; r++) {
- // sum[r + 1] - sum[l]快速求出nums[l...r]之和
- if (sum[r + 1] - sum[l] >= s) {
- res = Math.min(res, r - l + 1);
- }
- }
- }
-
- if (res == nums.length + 1) {
- res = 0;
- }
- return res;
- }
-
- public static void main(String[] args) {
- int[] nums = {2, 3, 1, 2, 4, 3};
- int s = 7;
- System.out.println((new Solution2()).minSubArrayLen(s, nums));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution3.java"
deleted file mode 100644
index e3d5ced6..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution3.java"
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.长度最小的子数组_209_Medium;
-
-/**
- * @author lastwhisper
- */
-public class Solution3 {
- /**
- * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- * 核心思想:滑动窗口,两个指针从起始点向前推进,维护一个窗口
- * 时间复杂度:O(n)
- * 空间复杂度:O(1)
- */
- public int minSubArrayLen(int s, int[] nums) {
- if (s <= 0 || nums == null) {
- throw new IllegalArgumentException("Illegal Argument");
- }
- // nums[l...r]是一个滑动窗口
- int l = 0, r = -1;
- int sum = 0;
- int res = nums.length + 1;
- // 窗口的左边界在数组范围内,则循环继续
- while (l < nums.length) {
- if (r < nums.length - 1 && sum < s) {
- //r未到头且sums,需要动态缩小窗口左边界
- sum -= nums[l];
- l++;
- }
- if (sum >= s) {
- res = Math.min(res, r - l + 1);
- }
- }
-
- if (res == nums.length + 1) {
- res = 0;
- }
- return res;
- }
-
- public static void main(String[] args) {
- int[] nums = {2, 3, 1, 2, 4, 3};
- int s = 7;
- System.out.println((new Solution3()).minSubArrayLen(s, nums));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution4.java"
deleted file mode 100644
index 0e014fc2..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution4.java"
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.长度最小的子数组_209_Medium;
-
-/**
- * 209. 长度最小的子数组
- * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- * @author lastwhisper
- */
-public class Solution4 {
- // 滑动窗口
- // 时间复杂度:O(n)
- // 空间复杂度:O(1)
- public int minSubArrayLen(int s, int[] nums) {
- if (s <= 0 || nums == null) {
- throw new IllegalArgumentException("Illegal Argument");
- }
-
- // nums[l...r]是一个滑动窗口
- int l = 0, r = -1;
- int sum = 0;
- int res = nums.length + 1;
- // 窗口的右边界在数组范围内,则循环继续
- while (r < nums.length - 1) {
- while (r < nums.length - 1 && sum < s) {
- r++;
- sum += nums[r];
- }
- if (sum >= s) {
- res = Math.min(res, r - l + 1);
- }
- while (l < nums.length && sum >= s) {
- sum -= nums[l];
- l++;
- if (sum >= s) {
- res = Math.min(res, r - l + 1);
- }
- }
- }
-
- if (res == nums.length + 1) {
- res = 0;
- }
- return res;
- }
-
- public static void main(String[] args) {
- int[] nums = {2, 3, 1, 2, 4, 3};
- int s = 7;
- System.out.println((new Solution4()).minSubArrayLen(s, nums));
- }
-
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution5.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution5.java"
deleted file mode 100644
index 3143d09b..00000000
--- "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\346\273\221\345\212\250\347\252\227\345\217\243/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_Medium/Solution5.java"
+++ /dev/null
@@ -1,71 +0,0 @@
-package cn.lastwhisper.leetcode.array.滑动窗口.长度最小的子数组_209_Medium;
-
-/**
- * 209. 长度最小的子数组
- * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
- * @author lastwhisper
- */
-public class Solution5 {
- // 二分搜索
- // 扩展 Solution5 的方法。对于每一个l, 可以使用二分搜索法搜索r
- // 时间复杂度: O(nlogn)
- // 空间复杂度: O(n)
- public int minSubArrayLen(int s, int[] nums) {
-
- if(s <= 0 || nums == null)
- throw new IllegalArgumentException("Illigal Arguments");
-
- // sums[i]存放nums[0...i-1]的和
- int[] sums = new int[nums.length + 1];
- sums[0] = 0;
- for(int i = 1 ; i <= nums.length ; i ++)
- sums[i] = sums[i-1] + nums[i-1];
-
- int res = nums.length + 1;
- for(int l = 0 ; l < nums.length - 1 ; l ++){
- // Java类库中没有内置的lowerBound方法,
- // 我们需要自己实现一个基于二分搜索的lowerBound:)
- int r = lowerBound(sums, sums[l] + s);
- if(r != sums.length){
- res = Math.min(res, r - l);
- }
- }
-
- if(res == nums.length + 1)
- return 0;
- return res;
- }
-
- // 在有序数组nums中寻找大于等于target的最小值
- // 如果没有(nums数组中所有值都小于target),则返回nums.length
- private int lowerBound(int[] nums, int target){
-
- if(nums == null /*|| !isSorted(nums)*/)
- throw new IllegalArgumentException("Illegal argument nums in lowerBound.");
-
- int l = 0, r = nums.length; // 在nums[l...r)的范围里寻找解
- while(l != r){
- int mid = l + (r - l) / 2;
- if(nums[mid] >= target)
- r = mid;
- else
- l = mid + 1;
- }
-
- return l;
- }
-
- private boolean isSorted(int[] nums){
- for(int i = 1 ; i < nums.length ; i ++)
- if(nums[i] < nums[i-1])
- return false;
- return true;
- }
-
- public static void main(String[] args) {
-
- int[] nums = {2, 3, 1, 2, 4, 3};
- int s = 7;
- System.out.println((new Solution5()).minSubArrayLen(s, nums));
- }
-}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..5b285110
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,31 @@
+package cn.lastwhisper.leetcode.array.盛最多水的容器_11_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/container-with-most-water/
+ * 编号:11
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力组合高和底
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ */
+ public int maxArea(int[] height) {
+ int max = Integer.MIN_VALUE, h;
+ for (int i = 0; i < height.length; i++) {
+ for (int j = i + 1; j < height.length; j++) {
+ h = Math.min(height[i], height[j]);// 最小高度
+ max = Math.max(max, h * (j - i));
+ }
+ }
+ return max;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(49, new Solution1().maxArea(new int[]{1, 8, 6, 2, 5, 4, 8, 3, 7}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..2c7c9213
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\233\233\346\234\200\345\244\232\346\260\264\347\232\204\345\256\271\345\231\250_11_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.array.盛最多水的容器_11_中等;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/container-with-most-water/
+ * 编号:11
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:双指针(对撞指针)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int maxArea(int[] height) {
+ int l = 0, r = height.length - 1, max = Integer.MIN_VALUE;
+ while (l < r) {
+ if (height[l] < height[r]) {
+ max = Math.max(max, height[l] * (r - l));
+ l++;
+ } else {
+ max = Math.max(max, height[r] * (r - l));
+ r--;
+ }
+ }
+ return max;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(49, new Solution2().maxArea(new int[]{1, 8, 6, 2, 5, 4, 8, 3, 7}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..08cf49e7
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,44 @@
+package cn.lastwhisper.leetcode.array.移动零_283_简单;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Solution1 {
+ /**
+ * 题目地址:https://leetcode.cn/problems/move-zeroes/
+ * 编号:283
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public void moveZeroes(int[] nums) {
+ // 缓存非0元素
+ List nonZeroElements = new ArrayList<>();
+ // 找出非0元素并将它缓存进nonZeroElements
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] != 0) {
+ nonZeroElements.add(nums[i]);
+ }
+ }
+ // 将非0元素放入原数组中
+ for (int i = 0; i < nonZeroElements.size(); i++) {
+ nums[i] = nonZeroElements.get(i);
+ }
+ // 将原数组剩余的位置放置为0
+ for (int i = nonZeroElements.size(); i < nums.length; i++) {
+ nums[i] = 0;
+ }
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] arr = {0, 1, 0, 3, 12};
+ new Solution1().moveZeroes(arr);
+ System.out.println(Arrays.toString(arr));
+ }
+}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..b55ff636
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.array.移动零_283_简单;
+
+
+import java.util.Arrays;
+
+public class Solution2 {
+ /**
+ * 题目地址:https://leetcode.cn/problems/move-zeroes/
+ * 编号:283
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void moveZeroes(int[] nums) {
+ // k保证从[0,...,k)均为非零元素
+ int k = 0;
+ // 遍历到第i个元素后,保证[0,...,i]中所有非零元素,
+ // 都按顺序排列在[0,...,k)中
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] != 0) {
+ nums[k] = nums[i];
+ k++;
+ }
+ }
+ // 同时保证[k,...,nums.length]中均为零元素
+ for (int i = k; i < nums.length; i++) {
+ nums[i] = 0;
+ }
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ int[] arr = {0, 1, 0, 3, 12};
+ new Solution2().moveZeroes(arr);
+ System.out.println(Arrays.toString(arr));
+ }
+}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..b96bbb3c
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\345\212\250\351\233\266_283_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,44 @@
+package cn.lastwhisper.leetcode.array.移动零_283_简单;
+
+
+import java.util.Arrays;
+
+public class Solution3 {
+ /**
+ * 题目地址:https://leetcode.cn/problems/move-zeroes/
+ * 编号:283
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:快慢指针
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void moveZeroes(int[] nums) {
+ // k保证从[0,...,k)均为非零元素,k 表示0的索引
+ int k = 0;
+ // temp用于交换时暂存数据
+ int temp;
+ // 遍历到第i个元素后,保证[0,...,i]中所有非零元素,都按顺序排列在[0,...,k)中
+ // 同时保证[k,...,i]中均为零元素
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] != 0) {
+ if (i != k) { // 防止数组本身就是“有序”,这里的有序指
+ temp = nums[k];
+ nums[k] = nums[i];
+ nums[i] = temp;
+ }
+ k++;
+ }
+ }
+ }
+
+ //以下为测试代码
+ public static void main(String[] args) {
+ //int[] arr = {0, 1, 0, 3, 12};
+ int[] arr = {0, 0, 0, 0, 0};
+ new Solution3().moveZeroes(arr);
+ System.out.println(Arrays.toString(arr));
+ }
+}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..e5be0ff3
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.array.移除元素_27_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/min-stack/
+ * 编号:27
+ * -------------------------------------------------------------------
+ * 思考:
+ * 特殊场景1:数组本身“有序”
+ * num=[1,1,1,1,1],Val=1
+ * -------------------------------------------------------------------
+ * 思路:
+ * 快慢指针
+ * 1、记录val的索引slow
+ * 2、遍历,找到非val的索引i后,交换i和pos位置的值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int removeElement(int[] nums, int val) {
+ // 特判
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ // 区间[0,...,slow)均为不等于val的元素,slow为val的索引
+ int slow = 0;
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] != val) {
+ if (slow != i) { // 防止数组本身就是“有序”
+ nums[slow] = nums[i];
+ }
+ slow++;
+ }
+ }
+ return slow;
+ }
+
+ public static void main(String[] args) {
+ //Assert.assertEquals(2, new Solution1().removeElement(new int[]{3, 2, 2, 3}, 3));
+ Assert.assertEquals(2, new Solution1().removeElement(new int[]{2, 2, 3, 3}, 3));
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..62da8322
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\247\273\351\231\244\345\205\203\347\264\240_27_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.array.移除元素_27_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/min-stack/
+ * 编号:27
+ * -------------------------------------------------------------------
+ * 思考:
+ * 特殊场景2:数组中只有少量待删除数据
+ * num=[1,2,3,5,4],Val=4
+ * num=[4,1,2,3,5],Val=4
+ * -------------------------------------------------------------------
+ * 思路:
+ * 快慢指针
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int removeElement(int[] nums, int val) {
+ // 特判
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ // 区间[0,...,slow)均为不等于val的元素,slow为val的索引
+ int i = 0;
+ int n = nums.length - 1;
+ while (i < n) {
+ if (nums[i] == val) {
+ nums[i] = nums[n];
+ n--;
+ } else {
+ i++;
+ }
+ }
+
+ return i;
+ }
+
+ public static void main(String[] args) {
+ //Assert.assertEquals(2, new Solution1().removeElement(new int[]{3, 2, 2, 3}, 3));
+ Assert.assertEquals(2, new Solution2().removeElement(new int[]{2, 2, 3, 3}, 3));
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution1.java"
new file mode 100644
index 00000000..c5426aee
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution1.java"
@@ -0,0 +1,61 @@
+package cn.lastwhisper.leetcode.array.缺失的第一个正数_41_困难;
+
+class Solution1 {
+
+ /**
+ * https://leetcode-cn.com/problems/first-missing-positive/
+ * 核心思路:输入数组值映射到数组下标,修改下标对应的值标识该数组值出现过,
+ * 最后统计数组第一个未标识的下标即为结果
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ * -------------------------------------------------------------------
+ * 此思路无法应对输入数组中存在一个很大的值
+ */
+ public int firstMissingPositive(int[] nums) {
+ //特殊情况三:输入数组为空
+ if (nums.length <= 0) {
+ return 1;
+ }
+ int max = nums[0];
+ for (int i = 0; i < nums.length; i++) {
+ // 特殊情况一:数组中有负数
+ if (nums[i] < 0) {
+ nums[i] = 0;
+ }
+ if (nums[i] > max) {
+ max = nums[i];
+ }
+ }
+ int[] arr = new int[max + 2];
+ for (int num : nums) {
+ arr[num]++;
+ }
+
+ for (int i = 0; i < arr.length; i++) {
+ // 特殊情况二:输入数组第一个数值大于1
+ if (i == 0 && arr[i] == 0) {
+ continue;
+ }
+ if (arr[i] == 0) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * 题目: 给定一个未排序的整数数组,找出其中没有出现的最小的正整数
+ * 说明: 你的算法的时间复杂度应为O(n),并且只能使用常数级别的空间。
+ */
+ public static void main(String[] args) {
+ //int[] arr = new int[]{1, 2, 0};//3
+ //int[] arr = new int[]{3, 4, -1, 1};//2 //特殊情况一:输入数组中有负数
+ //int[] arr = new int[]{7, 8, 9, 11, 12};//1 //特殊情况二:输入数组第一个数值大于1
+ //int[] arr = new int[]{};//1 //特殊情况三:输入数组为空
+ int[] arr = new int[]{1, 2, 3, 10, 2147483647, 9};//1 //特殊情况四:输入数组值过大
+ System.out.println(new Solution1().firstMissingPositive(arr));
+ //System.out.println(Integer.MAX_VALUE==2147483647);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution2.java"
new file mode 100644
index 00000000..4748e957
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/Solution2.java"
@@ -0,0 +1,80 @@
+package cn.lastwhisper.leetcode.array.缺失的第一个正数_41_困难;
+
+class Solution2 {
+
+ /**
+ * https://leetcode-cn.com/problems/first-missing-positive/
+ * 核心思路:使用数组值当做下标
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ *
+ */
+ public int firstMissingPositive(int[] nums) {
+
+ // 处理负数和0,置为大于输入数组长度的一个整数即可
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] <= 0) {
+ nums[i] = Integer.MAX_VALUE;
+ }
+ }
+
+ // 将所有出现的正整数,且值在数组长度内,置为负数
+ for (int i = 0; i < nums.length; i++) {
+ int absNum = Math.abs(nums[i]);
+ /*
+ * 将[数组值-1]的值当做下标,并将该下标的值置为负,
+ * 没有被置为负数的数组值,说明它没有后一位数
+ *
+ * absNum>nums.length,有三种情况
+ * 1.负数
+ * 2.0
+ * 3.输入数组中本身就有一个很大的值(此时数组肯定不连续)
+ */
+ if (absNum <= nums.length) {
+ /*
+ * 这个负数不能随便写,一定是-nums[absNum - 1]
+ * 比如nums={2,2}
+ * 情况一:nums[absNum - 1] = -Math.abs(nums[absNum - 1])
+ * 第一次循环nums={2,-2},第二次循环还是nums={2,-2}
+ * 情况二:随便写一个负数,nums[absNum - 1] = -1
+ * 第一次循环nums={2,-1},第二次循环还是nums={-1,-1}
+ *
+ */
+ nums[absNum - 1] = -Math.abs(nums[absNum - 1]);
+ }
+ }
+ /*
+ * 处理不连续的数组和连续的数组
+ * (1)长度为5的数组里面有一个100——此时缺失的数一定小于100,
+ * 且为一个没有帮它置为负数的值
+ * (2)长度为100的连续数组,最大值100——此时缺失的数一定为100+1
+ */
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] > 0) {
+ return i + 1;
+ }
+ }
+
+ // 处理空数组
+ return nums.length + 1;
+ }
+
+ /**
+ * 题目: 给定一个未排序的整数数组,找出其中没有出现的最小的正整数
+ * 说明: 你的算法的时间复杂度应为O(n),并且只能使用常数级别的空间。
+ */
+ public static void main(String[] args) {
+ //int[] arr = new int[]{1, 2, 0};//3
+ //int[] arr = new int[]{3, 4, -1, 1};//2 //特殊情况一:输入数组中有负数
+ //int[] arr = new int[]{7, 8, 9, 11, 12};//1 //特殊情况二:输入数组第一个数值大于1
+ //int[] arr = new int[]{};//1 //特殊情况三:输入数组为空
+ //int[] arr = new int[]{1, 2, 3, 10, 2147483647, 9};//1 //特殊情况四:输入数组值过大
+ //int[] arr = new int[]{1};//2
+ //int[] arr = new int[]{0};//1
+ //int[] arr = new int[]{2,2};//1
+ int[] arr = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};//10
+ System.out.println(new Solution2().firstMissingPositive(arr));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/YourVersion1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/YourVersion1.java"
new file mode 100644
index 00000000..84f9bdd0
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\347\274\272\345\244\261\347\232\204\347\254\254\344\270\200\344\270\252\346\255\243\346\225\260_41_\345\233\260\351\232\276/YourVersion1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.array.缺失的第一个正数_41_困难;
+
+class YourVersion1 {
+
+ public int firstMissingPositive(int[] nums) {
+
+ // 处理负数和0
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] <= 0) {
+ nums[i] = Integer.MAX_VALUE;
+ }
+ }
+
+ for (int i = 0; i < nums.length; i++) {
+ int absNum = Math.abs(nums[i]);
+ if (absNum <= nums.length) {
+ nums[absNum - 1] = -Math.abs(nums[absNum - 1]);
+ }
+ }
+
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] > 0) {
+ return i + 1;
+ }
+ }
+
+ return nums.length + 1;
+ }
+
+ /**
+ * 题目: 给定一个未排序的整数数组,找出其中没有出现的最小的正整数
+ * 说明: 你的算法的时间复杂度应为O(n),并且只能使用常数级别的空间。
+ */
+ public static void main(String[] args) {
+ //int[] arr = new int[]{1, 2, 0};//3
+ //int[] arr = new int[]{3, 4, -1, 1};//2 //特殊情况一:输入数组中有负数
+ //int[] arr = new int[]{7, 8, 9, 11, 12};//1 //特殊情况二:输入数组第一个数值大于1
+ //int[] arr = new int[]{};//1 //特殊情况三:输入数组为空
+ //int[] arr = new int[]{1, 2, 3, 10, 2147483647, 9};//1 //特殊情况四:输入数组值过大
+ //int[] arr = new int[]{1};//2
+ //int[] arr = new int[]{0};//1
+ int[] arr = new int[]{2, 2};//1
+ System.out.println(new YourVersion1().firstMissingPositive(arr));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\350\236\272\346\227\213\347\237\251\351\230\265_54_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\350\236\272\346\227\213\347\237\251\351\230\265_54_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..494ce3ce
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\350\236\272\346\227\213\347\237\251\351\230\265_54_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.array.螺旋矩阵_54_中等;
+
+import java.util.ArrayList;
+import java.util.List;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/spiral-matrix/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public List spiralOrder(int[][] matrix) {
+ if (matrix == null || matrix.length == 0) return new ArrayList<>();
+ List result = new ArrayList<>(matrix.length * matrix[0].length);
+ // nowColumn当前所在列、totalColumn总列数、nowRow当前所在行、totalRow总行数
+ int nowColumn = 0, totalColumn = matrix[0].length - 1, nowRow = 0, totalRow = matrix.length - 1;
+ // 顺时针遍历
+ while (nowColumn <= totalColumn && nowRow <= totalRow) {
+ //只有一列,不需要从左到右
+ for (int i = nowColumn; i <= totalColumn; i++) {//第一步 从左到右
+ result.add(matrix[nowRow][i]);
+ }
+ //只有一行,不需要从上到下
+ for (int i = nowRow + 1; i <= totalRow; i++) {//第二步 从上到下
+ result.add(matrix[i][totalColumn]);
+ }
+ if (nowRow != totalRow) {//同行,不需要从右向左遍历
+ for (int i = totalColumn - 1; i >= nowColumn; i--) {//第三步 从右向左
+ result.add(matrix[totalRow][i]);
+ }
+ }
+ if (nowColumn != totalColumn) {//同列,不需要从下到上遍历
+ for (int i = totalRow - 1; i > nowRow; i--) {// 第四步 从下到上
+ result.add(matrix[i][nowColumn]);
+ }
+ }
+ nowColumn++;
+ nowRow++;
+ totalColumn--;
+ totalRow--;
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ int[][] matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
+ System.out.println(new Solution1().spiralOrder(matrix));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..e37115a5
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,62 @@
+package cn.lastwhisper.leetcode.array.错误的集合_645_简单;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+class Solution1 {
+ /**
+ * https://leetcode-cn.com/problems/set-mismatch/
+ * -------------------------------------------------------------------
+ * 数据特征:
+ * 输入:数组、1~n整数、无序、存在重复数据、不一定包含丢失数据
+ * 输出:数组[重复数据,丢失数据]、1~n+1整数、
+ * -------------------------------------------------------------------
+ * 思路:
+ * 使用两个set集合,set1找出重复数据,set2记录1~length+1,
+ * set2.removeAll(set1)得到丢失数据。
+ * 特殊情况:[1,1]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int[] findErrorNums(int[] nums) {
+ if (nums.length == 2) {
+ if (nums[0] == 1 && nums[1] == 1) return new int[]{1, 2};
+ }
+
+ Set allSet = new HashSet<>();
+ Set numsSet = new HashSet<>();
+ int duplicate = -1, miss = -1;
+ for (Integer num : nums) {
+ // 找到重复,并将所有元素放到numsSet
+ if (numsSet.contains(num)) {
+ duplicate = num;
+ } else {
+ numsSet.add(num);
+ }
+
+ }
+ for (int i = 1; i <= nums.length + 1; i++) {
+ allSet.add(i);
+ }
+ allSet.removeAll(numsSet);
+ for (Integer num : allSet) {
+ miss = num;
+ break;
+ }
+
+ return new int[]{duplicate, miss};
+ }
+
+ public static void main(String[] args) {
+ // example
+ //int[] arr = {1, 2, 2, 4};//2,3
+ //int[] arr = {2, 2};//2,1
+ // error example
+ //int[] arr = {3, 2, 2};//2,1
+ //int[] arr = {1, 1};//1,2
+ int[] arr = {1, 5, 3, 2, 2, 7, 6, 4, 8, 9};
+ System.out.println(Arrays.toString(new Solution1().findErrorNums(arr)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..b604915c
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.array.错误的集合_645_简单;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution2 {
+ /**
+ * https://leetcode-cn.com/problems/set-mismatch/
+ * -------------------------------------------------------------------
+ * 数据特征:
+ * 输入:数组、1~n整数、无序、存在重复数据、不一定包含丢失数据
+ * 输出:数组[重复数据,丢失数据]、1~n+1整数、
+ * -------------------------------------------------------------------
+ * 思路:
+ * 遍历输入数组,使用map存储数组值出现的频率
+ * 正常数据1~length每一个出现的频率都为1,将1~length每一个值当做key查询map,
+ * frequency=2的为重复数据,frequency=null为丢失数据
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ * -------------------------------------------------------------------
+ * 改进:
+ * 将数组值当做数据下标,统计该值出现的频率
+ * map需要使用2n的额外空间,使用额外数组当做map,只需要使用n的额外空间
+ */
+ public int[] findErrorNums(int[] nums) {
+ Map numFreMap = new HashMap<>();
+ int duplicate = -1, miss = -1;
+ for (int num : nums) {
+ numFreMap.put(num, numFreMap.getOrDefault(num, 0) + 1);
+ }
+ for (int i = 1; i <= nums.length; i++) {
+ Integer frequency = numFreMap.get(i);
+ if (frequency == null) {
+ miss = i;
+ } else if (frequency == 2) {
+ duplicate = i;
+ }
+ }
+ return new int[]{duplicate, miss};
+ }
+
+ public static void main(String[] args) {
+ // example
+ //int[] arr = {1, 2, 2, 4};//2,3
+ //int[] arr = {2, 2};//2,1
+ // error example
+ //int[] arr = {3, 2, 2};//2,1
+ //int[] arr = {1, 1};//1,2
+ int[] arr = {1, 5, 3, 2, 2, 7, 6, 4, 8, 9};
+ System.out.println(Arrays.toString(new Solution2().findErrorNums(arr)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..277ee841
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,19 @@
+package cn.lastwhisper.leetcode.array.错误的集合_645_简单;
+
+class Solution3 {
+ public int[] findErrorNums(int[] nums) {
+ int[] copy = new int[nums.length + 1];
+ for (int n : nums) {
+ copy[n]++;
+ }
+
+ int[] res = new int[2];
+ for (int i = 1; i < copy.length; i++) {
+ if (copy[i] == 0)
+ res[1] = i;
+ if (copy[i] >= 2)
+ res[0] = i;
+ }
+ return res;
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..da9c2807
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\224\231\350\257\257\347\232\204\351\233\206\345\220\210_645_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,52 @@
+package cn.lastwhisper.leetcode.array.错误的集合_645_简单;
+
+import java.util.Arrays;
+
+class Solution4 {
+ /**
+ * https://leetcode-cn.com/problems/set-mismatch/
+ * -------------------------------------------------------------------
+ * 数据特征:
+ * 输入:数组、1~n整数、无序、存在重复数据、不一定包含丢失数据
+ * 输出:数组[重复数据,丢失数据]、1~n+1整数、
+ * -------------------------------------------------------------------
+ * 思路:将数组中的每一个值当做下标,按下标-1找到数组对应的值,并更新为负数,
+ * 在更新之前检查这个值是否已经是负数,如果已经是负数,说明这个值是重复数据。
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ * 相似题目:https://leetcode-cn.com/problems/first-missing-positive/
+ */
+ public int[] findErrorNums(int[] nums) {
+ // 丢失数据初始值为1,
+ int duplicate = -1, miss = 1;
+ for (int num : nums) {
+ if (nums[Math.abs(num) - 1] < 0) {
+ // 重复出现的下标
+ duplicate = Math.abs(num);
+ } else {
+ nums[Math.abs(num) - 1] *= -1;
+ }
+ }
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] > 0) {
+ miss = i + 1;
+ }
+ }
+ return new int[]{duplicate, miss};
+ }
+
+ public static void main(String[] args) {
+ // example
+ //int[] arr = {1, 2, 2, 4};//2,3
+ //int[] arr = {2, 2};//2,1
+ // error example
+ //int[] arr = {3, 2, 2};//2,1
+ //int[] arr = {1, 1};//1,2
+ //int[] arr = {1, 5, 3, 2, 2, 7, 6, 4, 8, 9};//10
+ //int[] arr = {2, 3, 2};
+ int[] arr = {3,3,1};
+ System.out.println(Arrays.toString(new Solution4().findErrorNums(arr)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..1c23fde0
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:二层循环暴力组合,一层循环计算组合范围值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(1)
+ */
+ public int minSubArrayLen(int s, int[] nums) {
+ if (s <= 0 || nums == null) {
+ throw new IllegalArgumentException("Illegal Argument");
+ }
+ // 子数组长度有可能等于 nums.length
+ int ans = Integer.MAX_VALUE;
+ for (int i = 0; i < nums.length; i++) {
+ for (int j = i; j < nums.length; j++) {
+ int sum = 0;
+ // 计算 [i,j] 子数组的和
+ for (int k = i; k <= j; k++) {
+ sum += nums[k];
+ }
+ if (sum >= s) {
+ ans = Math.min(ans, j - i + 1);// i=0,j=1 ————> ans=2
+ j = nums.length;// 退出内循环
+ }
+ }
+ }
+ // 子数组长度等于 nums.length+1,说明无解
+ if (ans == Integer.MAX_VALUE)
+ return 0;
+ return ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution1().minSubArrayLen(7, new int[]{2, 3, 1, 2, 4, 3}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..e9082877
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:二层循环暴力组合
+ * 组合的和提前计算
+ * (1)提前将 sum[0...n] 计算出来, sum[0] = 0; sum[i] = sum[i-1] + num[i-1]
+ * (2)nums[i...j] 的和 = sum[j+1]-sum[i]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int minSubArrayLen(int s, int[] nums) {
+ if (s <= 0 || nums == null) {
+ throw new IllegalArgumentException("Illegal Argument");
+ }
+ // nums=> 2, 3, 1, 2, 4, 3
+ // sum=>0, 2, 5, 6, 8, 12, 15
+ // sums[i] 存放 nums[0...i-1] 的和
+ int[] sum = new int[nums.length + 1];
+ sum[0] = 0;
+ for (int i = 1; i <= nums.length; i++) {
+ sum[i] = sum[i - 1] + nums[i - 1];
+ }
+ // 子数组长度有可能等于 nums.length
+ int ans = Integer.MAX_VALUE;
+ for (int i = 0; i < nums.length; i++) {
+ for (int j = i; j < nums.length; j++) {
+ // sum[j+1] - sum[0] = num[0,j]的和,sum[0]==0
+ // sum[j+1] - sum[i] = num[i,j]的和
+ if (sum[j + 1] - sum[i] >= s) {
+ ans = Math.min(ans, j - i + 1);
+ //j = nums.length;// 退出内循环
+ break;
+ }
+ }
+ }
+ // 子数组长度等于 nums.length+1,说明无解
+ if (ans == Integer.MAX_VALUE)
+ return 0;
+ return ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution2().minSubArrayLen(7, new int[]{2, 3, 1, 2, 4, 3}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..f34de047
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+import org.junit.Assert;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * (1)双指针 l、r 维护一个滑动窗口
+ * (2)窗口的左边界在数组范围内,则循环继续
+ * (3)r未到数组尾且 sums 需要动态缩小窗口左边界
+ * (5)循环内每次找 sum >= s 时的最小长度
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // l 和 r 指针同时遍历了一遍数组 O(2n)
+ * 空间复杂度:O(1)
+ */
+ public int minSubArrayLen(int s, int[] nums) {
+ if (s <= 0 || nums == null) {
+ throw new IllegalArgumentException("Illegal Argument");
+ }
+ // 初始窗口 [l,r] 是一个空集,所以 r 初值为 -1,后面需要先加才能使用
+ int l = 0, r = -1;
+ int ans = Integer.MAX_VALUE, sum = 0;
+ // 维护窗口,通过窗口内 sum 与 s 的关系,触发窗口的扩容或缩小
+ // 窗口的左边界在数组范围内,说明窗口还能继续扩容或者缩小
+ while (l < nums.length) {
+ // 因为 r 先加再用所以要保证 r + 1 < nums.length
+ if (r + 1 < nums.length && sum < s) {
+ sum += nums[++r];
+ } else {
+ sum -= nums[l++];
+ }
+ if (sum >= s) {
+ ans = Math.min(ans, (r - l + 1));
+ }
+ }
+ if (ans == Integer.MAX_VALUE) {
+ ans = 0;
+ }
+ return ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution3().minSubArrayLen(7, new int[]{2, 3, 1, 2, 4, 3}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution4.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution4.java"
new file mode 100644
index 00000000..32800e20
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution4.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+import org.junit.Assert;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n) // l 和 r 指针同时遍历了一遍数组 O(2n)
+ * 空间复杂度:O(1)
+ */
+ public int minSubArrayLen(int s, int[] nums) {
+ int l = 0, sum = 0, ans = Integer.MAX_VALUE;
+ for (int r = 0; r < nums.length; r++) {
+ sum += nums[r];
+ while (sum >= s) {
+ ans = Math.min(ans, r - l + 1);
+ sum -= nums[l++];
+ }
+ }
+ return ans == Integer.MAX_VALUE ? 0 : ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution4().minSubArrayLen(7, new int[]{2, 3, 1, 2, 4, 3}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution5.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution5.java"
new file mode 100644
index 00000000..95b5835d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution5.java"
@@ -0,0 +1,69 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+/**
+ * 209. 长度最小的子数组
+ * https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * @author lastwhisper
+ */
+public class Solution5 {
+ // 二分搜索
+ // 扩展 Solution5 的方法。对于每一个l, 可以使用二分搜索法搜索r
+ // 时间复杂度: O(nlogn)
+ // 空间复杂度: O(n)
+ public int minSubArrayLen(int s, int[] nums) {
+ if(s <= 0 || nums == null)
+ throw new IllegalArgumentException("Illegal Arguments");
+
+ // sums[i]存放nums[0...i-1]的和
+ int[] sums = new int[nums.length + 1];
+ sums[0] = 0;
+ for(int i = 1 ; i <= nums.length ; i ++)
+ sums[i] = sums[i-1] + nums[i-1];
+
+ int res = Integer.MAX_VALUE;
+ for(int l = 0 ; l < nums.length - 1 ; l ++){
+ // Java类库中没有内置的lowerBound方法,
+ // 我们需要自己实现一个基于二分搜索的lowerBound:)
+ int r = lowerBound(sums, sums[l] + s);
+ if(r != sums.length){
+ res = Math.min(res, r - l);
+ }
+ }
+
+ if(res == Integer.MAX_VALUE)
+ return 0;
+ return res;
+ }
+
+ // 在有序数组nums中寻找大于等于target的最小值
+ // 如果没有(nums数组中所有值都小于target),则返回nums.length
+ private int lowerBound(int[] nums, int target){
+ if(nums == null /*|| !isSorted(nums)*/)
+ throw new IllegalArgumentException("Illegal argument nums in lowerBound.");
+
+ int l = 0, r = nums.length; // 在nums[l...r)的范围里寻找解
+ while(l != r){
+ int mid = l + (r - l) / 2;
+ if(nums[mid] >= target)
+ r = mid;
+ else
+ l = mid + 1;
+ }
+
+ return l;
+ }
+
+ private boolean isSorted(int[] nums){
+ for(int i = 1 ; i < nums.length ; i ++)
+ if(nums[i] < nums[i-1])
+ return false;
+ return true;
+ }
+
+ public static void main(String[] args) {
+
+ int[] nums = {2, 3, 1, 2, 4, 3};
+ int s = 7;
+ System.out.println((new Solution5()).minSubArrayLen(s, nums));
+ }
+}
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution6.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution6.java"
new file mode 100644
index 00000000..ffb08944
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204_209_\344\270\255\347\255\211/Solution6.java"
@@ -0,0 +1,52 @@
+package cn.lastwhisper.leetcode.array.长度最小的子数组_209_中等;
+
+import org.junit.Assert;
+
+class Solution6 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
+ * 编号:209
+ * -------------------------------------------------------------------
+ * 思考:边界值一定要考虑取还是不取,为什么?
+ * -------------------------------------------------------------------
+ * 思路:滑动窗口
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int minSubArrayLen(int s, int[] nums) {
+ if (s <= 0 || nums == null) {
+ throw new IllegalArgumentException("Illegal Argument");
+ }
+ // 初始窗口 [l,r] 是一个空集,所以 r 初值为 -1,后面需要先加才能使用
+ int l = 0, r = -1;
+ int ans = Integer.MAX_VALUE, sum = 0;
+ // 维护窗口,通过窗口内 sum 与 s 的关系,触发窗口的扩容或缩小
+ // 窗口的右边界在数组范围内,说明窗口还能继续扩容或者缩小
+ while (r + 1 < nums.length) {
+ // 因为 r 先加再用所以 r < nums.length - 1
+ while (r + 1 < nums.length && sum < s) {
+ r++;
+ sum += nums[r];
+ }
+ if (sum >= s) {
+ ans = Math.min(ans, (r + 1 - l));
+ }
+ while (l < nums.length && sum >= s) {
+ sum -= nums[l];
+ l++;
+ if (sum >= s) {
+ ans = Math.min(ans, (r + 1 - l));
+ }
+ }
+ }
+ if (ans == Integer.MAX_VALUE) {
+ ans = 0;
+ }
+ return ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution6().minSubArrayLen(7, new int[]{2, 3, 1, 2, 4, 3}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..17a33f1c
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.array.颜色分类_75_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/sort-colors/
+ * 编号:75
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:只有0,1,2
+ * -------------------------------------------------------------------
+ * 思路:
+ * 计数排序,统计每一个数出现的频率
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void sortColors(int[] nums) {
+ // freq 统计0、1、2的频率
+ int[] freq = new int[3];
+ for (int num : nums) {
+ freq[num]++;
+ }
+ int idx = 0;
+ for (int i = 0; i < freq.length; i++) {
+ while (freq[i]-- > 0) {
+ nums[idx++] = i;
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ int[] arr = new int[]{2, 0, 2, 1, 1, 0};
+ new Solution1().sortColors(arr);
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 2}, arr);
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..d169835d
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\242\234\350\211\262\345\210\206\347\261\273_75_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.array.颜色分类_75_中等;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/sort-colors/
+ * 编号:75
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:只有0,1,2
+ * -------------------------------------------------------------------
+ * 思路:
+ * 三路快速排序的思想,对整个数组只遍历了一遍
+ * (1)双指针 left=-1,right=n
+ * (2)下标 i 遍历数组,num[i]==1,i++
+ * (3)num[i]==0,将 0 移动到数组最前位置,swap(num,++left,i++)
+ * i++,即使 num[++left]==0,这次的交换和位移也是正确的
+ * (4)num[i]==2,将 2 移动到数组最后位置,swap(num,--right,i)
+ * i不变,因为有可能num[--right]==2
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public void sortColors(int[] nums) {
+ int left = -1, right = nums.length;
+ for (int i = 0; i < right; ) {
+ if (nums[i] == 1) {
+ i++;
+ } else if (nums[i] == 0) {
+ swap(nums, ++left, i++);
+ } else if (nums[i] == 2) {
+ swap(nums, --right, i);
+ }
+ }
+ }
+
+ public void swap(int[] num, int i, int j) {
+ if (i != j) {
+ int temp = num[j];
+ num[j] = num[i];
+ num[i] = temp;
+ }
+ }
+
+ public static void main(String[] args) {
+ int[] arr = new int[]{2, 0, 2, 1, 1, 0};
+ new Solution2().sortColors(arr);
+ Assert.assertArrayEquals(new int[]{0, 0, 1, 1, 2, 2}, arr);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..1db21830
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.array.验证回文串_125_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/valid-palindrome/
+ * 编号:125
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 对撞指针遍历比较
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public boolean isPalindrome(String s) {
+ String upperS = s.toUpperCase();
+ int l = 0, r = upperS.length() - 1;
+ // 这里不能等于
+ while (l < r) {
+ while (l < r && !valid(upperS.charAt(l))) {
+ l++;
+ }
+ while (l < r && !valid(upperS.charAt(r))) {
+ r--;
+ }
+ if (upperS.charAt(l) != upperS.charAt(r)) {
+ return false;
+ }
+ l++;
+ r--;
+ }
+ return true;
+ }
+ // 只考虑字母和数字字符
+ private boolean valid(char c) {
+ return ((c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122));
+ }
+
+ public static void main(String[] args) {
+ //String s = "A man, a plan, a canal: Panama";
+ //String s = "race a car";
+ String s = "a";
+ Assert.assertTrue(new Solution1().isPalindrome(s));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..2720acde
--- /dev/null
+++ "b/algorithms/leetcode/array/src/main/java/cn/lastwhisper/leetcode/array/\351\252\214\350\257\201\345\233\236\346\226\207\344\270\262_125_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.array.验证回文串_125_简单;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/valid-palindrome/
+ * 编号:125
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 对撞指针遍历比较
+ * 统一转成大写:ch & 0b11011111 简写:ch & 0xDF
+ * 统一转成小写:ch | 0b00100000 简写:ch | 0x20
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public boolean isPalindrome(String s) {
+ int l = 0, r = s.length() - 1;
+ while (l < r) {// 这里不能等于
+ while (l < r && !valid(s.charAt(l))) l++;
+ while (l < r && !valid(s.charAt(r))) r--;
+ if ((s.charAt(l++) & 0xDF) != (s.charAt(r--) & 0xDF)) return false;
+ }
+ return true;
+ }
+
+ // 只考虑字母和数字字符
+ private boolean valid(char c) {
+ return ((c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122));
+ }
+
+ public static void main(String[] args) {
+ String s = "A man, a plan, a canal: Panama";
+ //String s = "race a car";
+ //String s = "a";
+ Assert.assertTrue(new Solution2().isPalindrome(s));
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/binarysearch/pom.xml b/algorithms/leetcode/binarysearch/pom.xml
new file mode 100644
index 00000000..2427d876
--- /dev/null
+++ b/algorithms/leetcode/binarysearch/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ leetcode
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ binarysearch
+
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..355ab5b7
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.binarysearch.pow_50_中等;
+
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/shu-zhi-de-zheng-shu-ci-fang-lcof/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 一、n=-2147483648无法处理
+ * 二、二分优化n^8=n^4^2=n^2^2^2
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public double myPow(double x, int n) {
+ if (x == 0) {
+ return 0;
+ }
+ // x底数 n指数
+ double result;
+
+ int absExponent = n;
+ if (n < 0) absExponent = -n;
+ result = pow(x, absExponent);
+
+ if (n < 0) {
+ result = 1.0 / result;
+ }
+
+ return result;
+ }
+
+ public double pow(double base, int exponent) {
+ double result = 1.0;
+ for (int i = 0; i < exponent; i++) {
+ result *= base;
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ //System.err.println(new Solution1().myPow(2.00000, 2));
+ //System.err.println(new Solution1().myPow(2.00000, -2));
+ //System.err.println(new Solution1().myPow(2.00000, 0));
+ System.err.println(new Solution1().myPow(0, 0));
+ System.err.println(new Solution1().myPow(-1, 0));
+ System.err.println(new Solution1().myPow(2.00000, 10));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..46b08d04
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.binarysearch.pow_50_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/shu-zhi-de-zheng-shu-ci-fang-lcof/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public double myPow(double x, int n) {
+ double res = 1.0;
+ for (int i = n; i != 0; i /= 2) {
+ if (i % 2 != 0) {
+ res *= x;
+ }
+ x *= x;
+ }
+ return n < 0 ? 1 / res : res;
+ }
+
+ public static void main(String[] args) {
+ //System.err.println(new Solution2().myPow(2.00000, 2));
+ //System.err.println(new Solution2().myPow(2.00000, -2));
+ //System.err.println(new Solution2().myPow(2.00000, 0));
+ //System.err.println(new Solution2().myPow(0, 0));
+ //System.err.println(new Solution2().myPow(-1, 0));
+ //System.err.println(new Solution2().myPow(2.00000, 10));
+ System.err.println(new Solution2().myPow(2.00000, -2147483648));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..f78d0303
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/pow_50_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,25 @@
+package cn.lastwhisper.leetcode.binarysearch.pow_50_中等;
+
+class Solution3 {
+ public double myPow(double x, int n) {
+ // 指数-偶数
+ if (n == 0) {
+ return 1;
+ }
+ // 指数-奇数
+ if (n == 1) {
+ return x;
+ }
+ // 指数-负数
+ if (n == -1) {
+ return 1 / x;
+ }
+ double half = myPow(x, n / 2);//n>>1
+ double base = myPow(x, n % 2);
+ return half * half * base;
+ }
+
+ public static void main(String[] args){
+ System.err.println(new Solution3().myPow(34.00515,-3));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..74a71577
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,53 @@
+package cn.lastwhisper.leetcode.binarysearch.二分查找_704_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/binary-search/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 二分搜索防加法溢出,遍历和递归两种写法
+ * -------------------------------------------------------------------
+ * 思路:
+ * 遍历
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(logn)
+ * 空间复杂度:O(1)
+ */
+ public int search(int[] nums, int target) {
+ /*
+ * 为什么是[0,nums.length - 1]?
+ * 仅仅是数组范围
+ */
+ int start = 0, end = nums.length - 1, middle;
+ /*
+ * 为什么是end >= start?
+ * 由于middle+1和middle-1的存在,所以合法的[start,end]范围内肯定是待搜索的
+ */
+ while (end >= start) {
+ /*
+ * 如何避免middle = (end + start) / 2;加法溢出?
+ */
+ middle = (end - start) / 2 + start;
+ if (nums[middle] == target) {
+ return middle;
+ } else if (nums[middle] > target) {
+ /*
+ * 为什么middle - 1?(两个方面)
+ * 1.为了跳出while循环
+ * 2.nums[middle] > target时,middle本身不在搜索范围
+ */
+ end = middle - 1;
+ } else {
+ start = middle + 1;
+ }
+ }
+ return -1;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {-1, 0, 3, 5, 9, 12};
+ //int target = 9;
+ int target = 2;
+ System.out.println(new Solution1().search(nums, target));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..62789934
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\344\272\214\345\210\206\346\237\245\346\211\276_704_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.binarysearch.二分查找_704_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/binary-search/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 二分搜索防加法溢出,遍历和递归两种写法
+ * -------------------------------------------------------------------
+ * 思路:
+ * 递归写法
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(logn)
+ * 空间复杂度:O(logn)
+ */
+ public int search(int[] nums, int target) {
+ return binarySearch(nums, target, 0, nums.length - 1);
+ }
+
+ public int binarySearch(int[] nums, int target, int start, int end) {
+ if (end < start) {
+ return -1;
+ }
+ int middle = (end - start) / 2 + start;
+ if (nums[middle] == target) {
+ return middle;
+ } else if (nums[middle] > target) {
+ end = middle - 1;
+ } else {
+ start = middle + 1;
+ }
+ return binarySearch(nums, target, start, end);
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {-1, 0, 3, 5, 9, 12};
+ int target = 9;
+ //int target = 2;
+ System.out.println(new Solution2().search(nums, target));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution1.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution1.java"
new file mode 100644
index 00000000..a54fd952
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution1.java"
@@ -0,0 +1,57 @@
+package cn.lastwhisper.leetcode.binarysearch.寻找旋转排序数组中的最小值II_154_困难;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 输入特征:
+ * 1、两个连续有序部分
+ * 2、nums[0]>=num[n]
+ * 3、数组内无重复
+ * -------------------------------------------------------------------
+ * 思路:
+ * 一、遍历
+ * 二、二分
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(logn)
+ * 空间复杂度:O(n)
+ */
+ public int findMin(int[] nums) {
+ int left = 0, right = nums.length - 1, middle = left;
+
+ while (nums[left] >= nums[right]) {
+ // 找到最小值
+ if (right - left == 1) {
+ middle = right;
+ break;
+ }
+ middle = (right - left) / 2 + left;
+
+ // 无法界定middle属于前数组还是后数组 {1, 0, 1, 1, 1};//01111
+ if (nums[left] == nums[middle] && nums[right] == nums[middle]) {
+ return sequenceSearch(left, right, nums);
+ }
+
+ if (nums[middle] >= nums[left]) {
+ left = middle;
+ } else if (nums[middle] <= nums[right]) {
+ right = middle;
+ }
+ }
+ return nums[middle];
+ }
+
+ // 顺序查找
+ public int sequenceSearch(int left, int right, int[] nums) {
+ int min = nums[left];
+ for (int i = left + 1; i <= right; i++) {
+ if (nums[i] < min) {
+ min = nums[i];
+ }
+ }
+ return min;
+ }
+
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution2.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution2.java"
new file mode 100644
index 00000000..fa277246
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274II_154_\345\233\260\351\232\276/Solution2.java"
@@ -0,0 +1,23 @@
+package cn.lastwhisper.leetcode.binarysearch.寻找旋转排序数组中的最小值II_154_困难;
+
+class Solution2 {
+ public int findMin(int[] nums) {
+ int left = 0, right = nums.length - 1;
+ while (left < right) {
+ int mid = (left + right) / 2;
+ if (nums[mid] > nums[right]) left = mid + 1;
+ else if (nums[mid] < nums[right]) right = mid;
+ else right = right - 1;
+ }
+ return nums[left];
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = new int[]{3, 4, 5, 1, 2};
+ //int[] nums = new int[]{0,0,0,0};
+ int[] nums = new int[]{1, 0, 1, 1, 1};//01111
+ //int[] nums = new int[]{1,1,1,0,1};//01111
+ //int[] nums = new int[]{0, 1, 1, 1, 1};//01111
+ System.err.println(new Solution2().findMin(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274_153_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274_153_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..0bf96aa3
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\345\257\273\346\211\276\346\227\213\350\275\254\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\347\232\204\346\234\200\345\260\217\345\200\274_153_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,47 @@
+package cn.lastwhisper.leetcode.binarysearch.寻找旋转排序数组中的最小值_153_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 输入特征:
+ * 1、两个连续有序部分
+ * 2、nums[0]>num[n]
+ * 3、数组内无重复
+ * -------------------------------------------------------------------
+ * 思路:
+ * 一、遍历
+ * 二、二分
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(logn)
+ * 空间复杂度:O(n)
+ */
+ public int findMin(int[] nums) {
+ int left = 0, right = nums.length - 1, middle = left;
+
+ while (nums[left] > nums[right]) {
+ // 找到最小值
+ if (right - left == 1) {
+ middle = right;
+ break;
+ }
+ middle = (right - left) / 2 + left;
+
+ if (nums[middle] > nums[left]) {
+ // middle在左数组
+ left = middle;
+ } else if (nums[middle] < nums[right]) {
+ // middle在右数组
+ right = middle;
+ }
+ }
+ return nums[middle];
+ }
+
+ public static void main(String[] args) {
+ int[] nums = new int[]{3,4,5,1,2};
+
+ System.err.println(new Solution1().findMin(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..aaa8dfcb
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,30 @@
+package cn.lastwhisper.leetcode.binarysearch.搜索插入位置_35_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/search-insert-position/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:线性遍历
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int searchInsert(int[] nums, int target) {
+ for (int i = 0; i < nums.length; i++) {
+ // 起始,中间
+ if (nums[i] >= target) {
+ return i;
+ }
+ }
+ // 最后
+ return nums.length;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 3, 5, 6};
+ int target = 5;
+ System.out.println(new Solution1().searchInsert(nums, target));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..5f51047c
--- /dev/null
+++ "b/algorithms/leetcode/binarysearch/src/main/java/cn/lastwhisper/leetcode/binarysearch/\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256_35_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.binarysearch.搜索插入位置_35_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/search-insert-position/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:二分查找
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int searchInsert(int[] nums, int target) {
+ int left = 0, right = nums.length - 1;
+ while (left <= right) {
+ int mid = (left + right) / 2;
+ if (nums[mid] == target) {
+ // 中间
+ return mid;
+ } else if (nums[mid] < target) {
+ left = mid + 1;
+ } else {
+ right = mid - 1;
+ }
+ }
+ //起始和最后
+ return left;
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/binarytree/pom.xml b/algorithms/leetcode/binarytree/pom.xml
index b2f47839..0d0a8aab 100644
--- a/algorithms/leetcode/binarytree/pom.xml
+++ b/algorithms/leetcode/binarytree/pom.xml
@@ -12,5 +12,11 @@
cn.lastwhisper.leetcode
binarytree
-
+
+
+ cn.lastwhisper
+ leetcode-common
+ 1.0-SNAPSHOT
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..09897e63
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.binarytree.二叉搜索树的最近公共祖先_235_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归
+ * 二叉树排序树:根大于左子树小于右子树
+ * 情况一:pq同时大于root,说明pq的最近公共祖先在右子树
+ * 情况一:pq同时小于root,说明pq的最近公共祖先在左子树
+ * 情况一:pq不同时大于或小于root,说明root为最近公共祖先
+ * pq分别在左右子树,root为最近公共祖先
+ * p在root上,q在左或右子树,p=root为最近公共祖先
+ * q在root上,p在左或右子树,q=root为最近公共祖先
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
+
+ if (p.val > root.val && q.val > root.val) {
+ return lowestCommonAncestor(root.right, p, q);
+ }
+ if (p.val < root.val && q.val < root.val) {
+ return lowestCommonAncestor(root.left, p, q);
+ }
+
+ return root;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().lowestCommonAncestor(
+ createTree(6, 2, 8, 0, 4, 7, 9, null, null, 3, 5), new TreeNode(2), new TreeNode(8)).val);
+ System.out.println(new Solution1().lowestCommonAncestor(
+ createTree(6, 2, 8, 0, 4, 7, 9, null, null, 3, 5), new TreeNode(2), new TreeNode(4)).val);
+
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..e12d84ce
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210_235_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.binarytree.二叉搜索树的最近公共祖先_235_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:迭代-找到分隔点
+ * 二叉树排序树:根大于左子树小于右子树
+ * 情况一:pq同时大于root,说明pq的最近公共祖先在右子树
+ * 情况一:pq同时小于root,说明pq的最近公共祖先在左子树
+ * 情况一:pq不同时大于或小于root,说明root为最近公共祖先
+ * pq分别在左右子树,root为最近公共祖先
+ * p在root上,q在左或右子树,p=root为最近公共祖先
+ * q在root上,p在左或右子树,q=root为最近公共祖先
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(N)
+ * 空间复杂度:O(1)
+ */
+ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
+ while (root!=null){
+ if (p.val > root.val && q.val > root.val) {
+ root=root.right;
+ } else if (p.val < root.val && q.val < root.val) {
+ root=root.left;
+ }else {
+ return root;
+ }
+ }
+ return null;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().lowestCommonAncestor(
+ createTree(6, 2, 8, 0, 4, 7, 9, null, null, 3, 5), new TreeNode(2), new TreeNode(8)).val);
+ System.out.println(new Solution2().lowestCommonAncestor(
+ createTree(6, 2, 8, 0, 4, 7, 9, null, null, 3, 5), new TreeNode(2), new TreeNode(4)).val);
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\273\223\347\202\271\346\234\200\345\260\217\350\267\235\347\246\273_783_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\273\223\347\202\271\346\234\200\345\260\217\350\267\235\347\246\273_783_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..0de79d03
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\273\223\347\202\271\346\234\200\345\260\217\350\267\235\347\246\273_783_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,60 @@
+package cn.lastwhisper.leetcode.binarytree.二叉搜索树结点最小距离_783_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-distance-between-bst-nodes/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:bst中序遍历就是从小到大
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int minDiffInBST(TreeNode root) {
+ List list = new ArrayList<>();
+ middleDfs(root, list);
+
+ int min = Integer.MAX_VALUE;
+ for (int i = 0; i < list.size() - 1; i++) {
+ min = Math.min(min, list.get(i + 1) - list.get(i));
+ }
+ return min;
+ }
+
+ public void middleDfs(TreeNode root, List list) {
+ if (root == null) {
+ return;
+ }
+ LinkedList stack = new LinkedList<>();
+ while (root != null || !stack.isEmpty()) {
+ while (root != null) {
+ stack.push(root);
+ root = root.left;
+ }
+ root = stack.pop();
+ list.add(root.val);
+ root = root.right;
+ }
+ }
+
+ //public void middleDfs(TreeNode root, List list) {
+ // if (root != null) {
+ // middleDfs(root.left, list);
+ // list.add(root.val);
+ // middleDfs(root.right, list);
+ // }
+ //}
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().minDiffInBST(createTree(4, 2, 6, 1, 3, null, null)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..ce85bab8
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,47 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的所有路径_257_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.print.PrintUtil.printList;
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/binary-tree-paths/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public List binaryTreePaths(TreeNode root) {
+ List result = new ArrayList<>();
+ if (root == null) {
+ return result;
+ }
+ binaryTreePathsHelper(root, result, String.valueOf(root.val));
+ return result;
+ }
+
+ public void binaryTreePathsHelper(TreeNode root, List result, String path) {
+ if (root.left == null && root.right == null) {
+ result.add(path);
+ }
+ if (root.left != null) {
+ binaryTreePathsHelper(root.left, result, path + "->" + root.left.val);
+ }
+ if (root.right != null) {
+ binaryTreePathsHelper(root.right, result, path + "->" + root.right.val);
+ }
+ }
+
+
+ public static void main(String[] args) {
+ printList(new Solution1().binaryTreePaths(createTree(1, 2, 3, null, 5)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..b5aa12b8
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204_257_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,52 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的所有路径_257_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import javafx.util.Pair;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.print.PrintUtil.printList;
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/binary-tree-paths/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public List binaryTreePaths(TreeNode root) {
+ List result = new ArrayList<>();
+ if (root == null) {
+ return result;
+ }
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, String.valueOf(root.val)));
+
+ while (!stack.isEmpty()) {
+ Pair pair = stack.pop();
+ root = pair.getKey();
+ String path = pair.getValue();
+ if (root.left == null && root.right == null) {
+ result.add(path);
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, path + "->" + root.left.val));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, path + "->" + root.right.val));
+ }
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ printList(new Solution2().binaryTreePaths(createTree(1, 2, 3, null, 5)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..a64d7d02
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,33 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的最大深度_104_简单;
+
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:递归结束条件?
+ * A:当前TreeNode为null
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:不平衡O(n)、平衡O(logn)
+ */
+ public int maxDepth(TreeNode root) {
+ // 递归结束条件
+ if (root == null) {
+ return 0;
+ }
+ // 递归过程
+ return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().maxDepth(TreeUtil.createTree()));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..9f1c06d8
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246_104_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,47 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的最大深度_104_简单;
+
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:不平衡O(n)、平衡O(logn)
+ */
+ public int maxDepth(TreeNode root) {
+ LinkedList> stack = new LinkedList<>();
+ if (root != null) {
+ stack.push(new Pair<>(root, 0));
+ }
+ int maxDepth = 0;
+ // stack模拟递归系统栈
+ while (!stack.isEmpty()) {
+ Pair pair = stack.poll();
+ root = pair.getKey();
+ Integer height = pair.getValue();
+ // dfs过程中更新最大深度
+ maxDepth = Math.max(maxDepth, height);
+ if (root != null) {
+ stack.push(new Pair<>(root.right, height + 1));
+ stack.push(new Pair<>(root.left, height + 1));
+ }
+ }
+
+ return maxDepth;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().maxDepth(TreeUtil.createTree()));
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..71dd7713
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,40 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的最小深度_111_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:何为二叉树的深度?
+ * A:从根节点到叶子节点的路径上的节点数量
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int minDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ // 叶子节点
+ if ((root.left == null) && (root.right == null)) {
+ return 1;
+ }
+
+ int min_depth = Integer.MAX_VALUE;
+ if (root.left != null) {
+ min_depth = Math.min(minDepth(root.left), min_depth);
+ }
+ if (root.right != null) {
+ min_depth = Math.min(minDepth(root.right), min_depth);
+ }
+ return min_depth + 1;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().minDepth(TreeUtil.createTree()));
+ }
+}
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..ccba9434
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,57 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的最小深度_111_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:何为二叉树的深度?
+ * A:从根节点到叶子节点的路径上的节点数量
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:最坏O(n),可能保存整颗树
+ */
+ public int minDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, 1));
+
+ int minDepth = Integer.MAX_VALUE;
+ while (!stack.isEmpty()) {
+ Pair pair = stack.pop();
+ root = pair.getKey();
+ Integer depth = pair.getValue();
+ if (root.left == null && root.right == null) {
+ minDepth = Math.min(minDepth, depth);
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, depth + 1));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, depth + 1));
+ }
+ }
+ return minDepth;
+ }
+
+ public static void main(String[] args) {
+ /*
+ * 3
+ * / \
+ * 9 20
+ * / \
+ * 15 7
+ */
+ System.out.println(new Solution2().minDepth(TreeUtil.createTree(3,9,20,null,null,15,7)));
+ }
+}
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..27c4da84
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246_111_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,60 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的最小深度_111_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:从根节点到叶子节点的路径上的节点数量。BFS按照树的层次去迭代,
+ * 第一个访问到的叶子就是最小深度的节点,这样就不要遍历所有的节点了。
+ * -------------------------------------------------------------------
+ * 思路:BFS迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:最多访问n/2个节点,O(n)
+ * 空间复杂度:最多队列中保存n/2个节点,O(n)
+ */
+ public int minDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ LinkedList> queue = new LinkedList<>();
+ queue.add(new Pair<>(root, 1));
+
+ // 当前深度
+ int currentDepth = 0;
+ Pair pair = null;
+ while (!queue.isEmpty()) {
+ pair = queue.poll();
+ root = pair.getKey();
+ currentDepth = pair.getValue();
+ // 找到层中第一个叶子节点
+ if (root.left == null && root.right == null) {
+ break;
+ }
+ if (root.left != null) {
+ queue.add(new Pair<>(root.left, currentDepth + 1));
+ }
+ if (root.right != null) {
+ queue.add(new Pair<>(root.right, currentDepth + 1));
+ }
+
+ }
+ return currentDepth;
+ }
+
+ public static void main(String[] args) {
+ /*
+ * 3
+ * / \
+ * 9 20
+ * / \
+ * 15 7
+ */
+ System.out.println(new Solution2().minDepth(TreeUtil.createTree(3,9,20,null,null,15,7)));
+ }
+}
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\347\233\264\345\276\204_543_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\347\233\264\345\276\204_543_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..99d1d4aa
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\344\272\214\345\217\211\346\240\221\347\232\204\347\233\264\345\276\204_543_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.binarytree.二叉树的直径_543_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import cn.lastwhisper.leetcode.common.tree.TreeUtil;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/diameter-of-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ *
+ * -------------------------------------------------------------------
+ * 思路:
+ * 1.普通情况,找左子树和右子树最大高度和
+ * 2.特殊情况,不一定经过根节点
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int diameterOfBinaryTree(TreeNode root) {
+ int max = 0;
+ if (root != null) {
+ max = Math.max(max, sumHeight(root));
+ max = Math.max(max, diameterOfBinaryTree(root.left));
+ max = Math.max(max, diameterOfBinaryTree(root.right));
+ }
+ return max;
+ }
+
+ // node结点左右子树最大高度和
+ private int sumHeight(TreeNode node) {
+ if (node == null) {
+ return 0;
+ }
+ return height(node.left) + height(node.right);
+ }
+
+ // node结点最大高度
+ private int height(TreeNode node) {
+ if (node == null) {
+ return 0;
+ }
+ return Math.max(height(node.left), height(node.right)) + 1;
+ }
+
+ public static void main(String[] args) {
+ Integer[] nums = new Integer[]{4, -7, -3, null, null, -9, -3, 9, -7, -4, null, 6, null, -6, -6, null, null, 0, 6, 5, null, 9, null, null, -1, -4, null, null, null, -2};
+ TreeNode tree = TreeUtil.createTree(nums);
+ System.out.println(new Solution1().diameterOfBinaryTree(tree));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\215\225\350\257\215\347\232\204\345\216\213\347\274\251\347\274\226\347\240\201_820_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\215\225\350\257\215\347\232\204\345\216\213\347\274\251\347\274\226\347\240\201_820_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..691c0a9d
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\215\225\350\257\215\347\232\204\345\216\213\347\274\251\347\274\226\347\240\201_820_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,66 @@
+package cn.lastwhisper.leetcode.binarytree.单词的压缩编码_820_中等;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/short-encoding-of-words/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 按长度排序,逆序插入字典树,
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int minimumLengthEncoding(String[] words) {
+ int len = 0;
+ // 先对单词列表根据单词长度由长到短排序
+ Arrays.sort(words, (s1, s2) -> s2.length() - s1.length());
+ Trie trie = new Trie();
+ // 单词插入trie,返回该单词增加的编码长度
+ for (String word : words) {
+ len += trie.insert(word);
+ }
+ return len;
+ }
+
+ static class TrieNode {
+ TrieNode[] children = new TrieNode[26];
+ public TrieNode() {}
+ }
+
+ static class Trie {
+
+ private TrieNode root;
+
+ public Trie() {
+ root = new TrieNode();
+ }
+
+ public int insert(String word) {
+ TrieNode cur = root;
+ boolean isNew = false;
+ // 倒着插入单词
+ for (int i = word.length() - 1; i >= 0; i--) {
+ int c = word.charAt(i) - 'a';
+ if (cur.children[c] == null) {
+ isNew = true;
+ cur.children[c] = new TrieNode();
+ }
+ cur = cur.children[c];
+ }
+ // +1是#
+ return isNew ? word.length() + 1 : 0;
+ }
+ }
+
+ public static void main(String[] args) {
+
+ Assert.assertEquals(10,new Solution1().minimumLengthEncoding(new String[]{"time", "me", "bell"}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..a3f262df
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,28 @@
+package cn.lastwhisper.leetcode.binarytree.完全二叉树的节点个数_222_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/count-complete-tree-nodes/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:遍历时计数-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:最坏O(n)
+ */
+ public int countNodes(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ return countNodes(root.left) + countNodes(root.right) + 1;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().countNodes(createTree(1, 2, 3, 4, 5, 6, null)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..06775da1
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,40 @@
+package cn.lastwhisper.leetcode.binarytree.完全二叉树的节点个数_222_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/count-complete-tree-nodes/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:遍历时计数-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:最坏O(n)
+ */
+ public int countNodes(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ LinkedList stack = new LinkedList<>();
+ stack.push(root);
+ int count = 0;
+ // 根-左-右
+ while (!stack.isEmpty()) {
+ root = stack.pop();
+ count++;
+ if (root.right != null) stack.push(root.right);
+ if (root.left != null) stack.push(root.left);
+ }
+ return count;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().countNodes(createTree(1, 2, 3, 4, 5, 6, null)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..a529f89c
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260_222_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.binarytree.完全二叉树的节点个数_222_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/count-complete-tree-nodes/
+ * -------------------------------------------------------------------
+ * 思考:完全二叉树,左右子树肯定存在一颗满二叉树
+ * -------------------------------------------------------------------
+ * 思路:利用二叉树的特点
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:最坏O(n)
+ */
+ public int countNodes(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ int left = maxDepth(root.left);
+ int right = maxDepth(root.right);
+ if (left == right) {
+ /*
+ * 左子树肯定是满二叉树,左子树节点总数=2^left-1,加上root,正好是2^left
+ * 再对右子树进行递归统计。
+ */
+ return (1 << left) + countNodes(root.right);//2^left
+ } else {
+ /*
+ * 右子树肯定是满二叉树,右子树节点总数=2^right-1,加上root,正好是2^right
+ * 再对左子树进行递归统计。
+ */
+ return (1 << right) + countNodes(root.left);
+ }
+ }
+
+ private int maxDepth(TreeNode root) {
+ int level = 0;
+ while (root != null) {
+ level++;
+ root = root.left;
+ }
+ return level;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().countNodes(createTree(1, 2, 3, 4, 5, 6, null)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\236\347\216\260Trie\345\211\215\347\274\200\346\240\221_208_\344\270\255\347\255\211/Trie.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\236\347\216\260Trie\345\211\215\347\274\200\346\240\221_208_\344\270\255\347\255\211/Trie.java"
new file mode 100644
index 00000000..f21bad54
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\256\236\347\216\260Trie\345\211\215\347\274\200\346\240\221_208_\344\270\255\347\255\211/Trie.java"
@@ -0,0 +1,101 @@
+package cn.lastwhisper.leetcode.binarytree.实现Trie前缀树_208_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TrieNode;
+import org.junit.Assert;
+
+class Trie {
+
+ private TrieNode root;
+
+ /**
+ * 功能:
+ * 找到具有同一前缀的全部键值。
+ * 按词典序枚举字符串的数据集。
+ *
+ * 与哈希表相比,Trie 树在存储多个具有相同前缀的键时可以使用较少的空间。
+ * 此时 Trie 树只需要 O(m) 的时间复杂度,其中 m 为键长。而在平衡树中查找键值需要 O(mlogn) 时间复杂度。
+ *
+ * https://leetcode-cn.com/problems/implement-trie-prefix-tree/solution/shi-xian-trie-qian-zhui-shu-by-leetcode/
+ */
+ public Trie() {
+ root = new TrieNode();
+ }
+
+ /**
+ * 通过搜索 Trie 树来插入一个键。我们从根开始搜索它对应于第一个键字符的链接。有两种情况:
+ * 链接存在。沿着链接移动到树的下一个子层。算法继续搜索下一个键字符。
+ * 链接不存在。创建一个新的节点,并将它与父节点的链接相连,该链接与当前的键字符相匹配。
+ * 重复以上步骤,直到到达键的最后一个字符,然后将当前节点标记为结束节点,算法完成。
+ *
+ * 时间复杂度:O(m),其中 m 为键长。在算法的每次迭代中,我们要么检查要么创建一个节点,直到到达键尾。只需要 m 次操作。
+ * 空间复杂度:O(m)。最坏的情况下,新插入的键和 Trie 树中已有的键没有公共前缀。此时需要添加 m 个结点,使用 O(m) 空间。
+ */
+ public void insert(String word) {
+ TrieNode node = root;
+ for (int i = 0; i < word.length(); i++) {
+ char currentChar = word.charAt(i);
+ if (!node.containsKey(currentChar)) {
+ node.put(currentChar, new TrieNode());
+ }
+ node = node.get(currentChar);
+ }
+ node.setEnd();
+ }
+
+ /**
+ * 功能:查找word在是否在前缀树中
+ *
+ * 每个键在trie中表示为从根到内部节点或叶的路径。我们用第一个键字符从根开始,检查当前节点中与键字符对应的链接。
+ * 有两种情况:
+ * 1.存在链接。我们移动到该链接后面路径中的下一个节点,并继续搜索下一个键字符。
+ * 2.不存在链接。若已无键字符,且当前结点标记为 isEnd,则返回 true。否则有两种可能,均返回 false :
+ * 还有键字符剩余,但无法跟随 Trie 树的键路径,找不到键。
+ * 没有键字符剩余,但当前结点没有标记为 isEnd。也就是说,待查找键只是Trie树中另一个键的前缀。
+ */
+ public boolean search(String word) {
+ TrieNode node = searchPrefix(word);
+ return node != null && node.isEnd();
+ }
+
+ // search a prefix or whole key in trie and
+ // returns the node where search ends
+ /**
+ *
+ * 时间复杂度 : O(m)
+ * 空间复杂度 : O(1)
+ */
+ private TrieNode searchPrefix(String word) {
+ TrieNode node = root;
+ for (int i = 0; i < word.length(); i++) {
+ char curLetter = word.charAt(i);
+ if (node.containsKey(curLetter)) {
+ node = node.get(curLetter);
+ } else {
+ return null;
+ }
+ }
+ return node;
+ }
+
+ /**
+ * 功能:查找prefix在是否在前缀树中
+ *
+ * 时间复杂度 : O(m)
+ * 空间复杂度 : O(1)
+ */
+ public boolean startsWith(String prefix) {
+ TrieNode node = searchPrefix(prefix);
+ return node != null;
+ }
+
+ public static void main(String[] args) {
+ Trie trie = new Trie();
+
+ trie.insert("apple");
+ Assert.assertTrue(trie.search("apple")); // 返回 true
+ Assert.assertFalse(trie.search("app")); // 返回 false
+ Assert.assertTrue(trie.startsWith("app")); // 返回 true
+ trie.insert("app");
+ Assert.assertTrue(trie.search("app")); // 返回 true
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..5f3468c6
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.binarytree.对称二叉树_101_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/symmetric-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n),因为我们遍历整个输入树一次,所以总的运行时间为 O(n),其中 nn 是树中节点的总数。
+ * 空间复杂度:递归调用的次数受树的高度限制。在最糟糕情况下,树是线性的,其高度为 O(n)。
+ * 因此,在最糟糕的情况下,由栈上的递归调用造成的空间复杂度为 O(n)。
+ */
+ public boolean isSymmetric(TreeNode root) {
+ if (root == null) {
+ return true;
+ }
+ return isMirror(root.left, root.right);
+ }
+
+ public boolean isMirror(TreeNode p, TreeNode q) {
+ if (p == null && q == null) {
+ return true;
+ }
+ if (p == null || q == null) {
+ return false;
+ }
+ if (p.val != q.val) {
+ return false;
+ }
+ return isMirror(p.left, q.right) && isMirror(p.right, q.left);
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().isSymmetric(createTree(1, 2, 2, 3, 4, 4, 3))); // true
+ System.out.println(new Solution1().isSymmetric(createTree(1, 2, 2, null, 3, null, 3))); //false
+ System.out.println(new Solution1().isSymmetric(createTree(2, 3, 3, 4, 5, 5))); //false
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..b4e7dd56
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.binarytree.对称二叉树_101_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/symmetric-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSymmetric(TreeNode root) {
+ LinkedList stack = new LinkedList<>();
+ stack.push(root);
+ stack.push(root);
+
+ while (!stack.isEmpty()) {
+ TreeNode p = stack.pop();
+ TreeNode q = stack.pop();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ stack.push(p.left);
+ stack.push(q.right);
+ stack.push(q.left);
+ stack.push(p.right);
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().isSymmetric(createTree(1, 2, 2, 3, 4, 4, 3))); // true
+ System.out.println(new Solution2().isSymmetric(createTree(1, 2, 2, null, 3, null, 3))); //false
+ System.out.println(new Solution2().isSymmetric(createTree(2, 3, 3, 4, 5, 5))); //false
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..5e5b322d
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.binarytree.对称二叉树_101_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/symmetric-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:层次遍历(BFS)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n),因为我们遍历整个输入树一次,所以总的运行时间为 O(n),其中 nn 是树中节点的总数。
+ * 空间复杂度:递归调用的次数受树的高度限制。在最糟糕情况下,树是线性的,其高度为 O(n)。
+ * 因此,在最糟糕的情况下,由栈上的递归调用造成的空间复杂度为 O(n)。
+ */
+ public boolean isSymmetric(TreeNode root) {
+ Queue q = new LinkedList<>();
+ q.add(root);
+ q.add(root);
+ while (!q.isEmpty()) {
+ TreeNode t1 = q.poll();
+ TreeNode t2 = q.poll();
+ if (t1 == null && t2 == null) continue;
+ if (t1 == null || t2 == null) return false;
+ if (t1.val != t2.val) return false;
+ q.add(t1.left);
+ q.add(t2.right);
+ q.add(t1.right);
+ q.add(t2.left);
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().isSymmetric(createTree(1, 2, 2, 3, 4, 4, 3))); // true
+ System.out.println(new Solution3().isSymmetric(createTree(1, 2, 2, null, 3, null, 3))); //false
+ System.out.println(new Solution3().isSymmetric(createTree(2, 3, 3, 4, 5, 5))); //false
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution6.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution6.java"
new file mode 100644
index 00000000..42322e65
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221_101_\347\256\200\345\215\225/Solution6.java"
@@ -0,0 +1,58 @@
+package cn.lastwhisper.leetcode.binarytree.对称二叉树_101_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution6 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/symmetric-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 1.将二叉树的左子节点或者右子节点左右翻转
+ * 2.比较左右子节点是否相同
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSymmetric(TreeNode root) {
+ if (root == null) {
+ return true;
+ }
+ TreeNode right = invertTree(root.right);
+ return isSameTree(root.left, right);
+ }
+
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ // 递归结束条件
+ if (p == null && q == null) {
+ return true;
+ }
+ if (p == null || q == null) {
+ return false;
+ }
+ if (p.val != q.val) {
+ return false;
+ }
+ // 递归体
+ return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
+ }
+
+ public TreeNode invertTree(TreeNode root) {
+ if (root == null)
+ return null;
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = root.left;
+
+ root.left = invertTree(root.right);
+ root.right = invertTree(tempNode);
+ return root;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution6().isSymmetric(createTree()));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution.java"
new file mode 100644
index 00000000..795ff180
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution.java"
@@ -0,0 +1,29 @@
+package cn.lastwhisper.leetcode.binarytree.左叶子之和_404_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution {
+ public int sumOfLeftLeaves(TreeNode root) {
+ return helper(root);
+ }
+
+ public int helper(TreeNode node) {
+ int sum = 0;
+ if (node == null) {
+ return 0;
+ }
+ if (node.left != null && (node.left.left == null && node.left.right == null)) {
+ sum += node.left.val;
+ }
+ sum += helper(node.left) + helper(node.right);
+ return sum;
+ }
+
+ public static void main(String[] args) {
+ //System.out.println(new Solution().sumOfLeftLeaves(createTree(1, 2, 3, 4, 5)));
+ //System.out.println(new Solution().sumOfLeftLeaves(createTree(1, null, 2)));
+ System.out.println(new Solution().sumOfLeftLeaves(createTree(3, 9, 20, null, null, 15, 7)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..ecc08b4f
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,69 @@
+package cn.lastwhisper.leetcode.binarytree.左叶子之和_404_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/sum-of-left-leaves/
+ * -------------------------------------------------------------------
+ * 思考:左叶子之和
+ * 注意:叶子之和
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int sumOfLeftLeaves(TreeNode root) {
+ return sumOfLeftLeavesHelper(root, false);
+ }
+
+ // 先序遍历求所有左叶子节点值之和
+ public int sumOfLeftLeavesHelper(TreeNode root, boolean flag) {
+ if (root == null) {
+ return 0;
+ }
+ int leave = 0;
+ // 左叶子节点
+ if (flag && root.left == null && root.right == null) {
+ leave = root.val;
+ }
+ int left = sumOfLeftLeavesHelper(root.left, true);
+ int right = sumOfLeftLeavesHelper(root.right, false);
+ return left + right + leave;
+ }
+
+ // 先序遍历求所有叶子节点值之和
+ public int sumOfLeaves(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ int leave = 0;
+ // 叶子节点
+ if (root.left == null && root.right == null) {
+ leave = root.val;
+ }
+ int left = sumOfLeaves(root.left);
+ int right = sumOfLeaves(root.right);
+ return left + right + leave;
+ }
+
+ // 先序遍历求所有节点值之和
+ public int sumOfTrees(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ int leave = root.val;
+ int left = sumOfTrees(root.left);
+ int right = sumOfTrees(root.right);
+ return left + right + leave;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().sumOfLeftLeaves(createTree(1, 2, 3, 4, 5)));
+ //System.out.println(new Solution1().sumOfLeftLeaves(createTree(1, null, 2)));
+ //System.out.println(new Solution1().sumOfLeftLeaves(createTree(3, 9, 20, null, null, 15, 7)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..188e1cf6
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214_404_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,52 @@
+package cn.lastwhisper.leetcode.binarytree.左叶子之和_404_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/sum-of-left-leaves/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:将递归改成迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int sumOfLeftLeaves(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, false));
+
+ int sum = 0;
+ Boolean flag;
+ while (!stack.isEmpty()) {
+ Pair pair = stack.pop();
+ root = pair.getKey();
+ flag = pair.getValue();
+ if (flag && root.left == null && root.right == null) {
+ sum += root.val;
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, true));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, false));
+ }
+ }
+ return sum;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().sumOfLeftLeaves(createTree(1, 2, 3, 4, 5)));
+ //System.out.println(new Solution1().sumOfLeftLeaves(createTree(1, null, 2)));
+ //System.out.println(new Solution1().sumOfLeftLeaves(createTree(3, 9, 20, null, null, 15, 7)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..24674fc9
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,81 @@
+package cn.lastwhisper.leetcode.binarytree.平衡二叉树_110_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/balanced-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isBalanced(TreeNode root) {
+ //它是一棵空树
+ if (root == null) {
+ return true;
+ }
+ //它的左右两个子树的高度差的绝对值不超过1
+ int leftDepth = getTreeDepth(root.left);
+ int rightDepth = getTreeDepth(root.right);
+ if (Math.abs(leftDepth - rightDepth) > 1) {
+ return false;
+ }
+ //左右两个子树都是一棵平衡二叉树
+ return isBalanced(root.left) && isBalanced(root.right);
+
+ }
+
+ private int getTreeDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ int leftDepth = getTreeDepth(root.left);
+ int rightDepth = getTreeDepth(root.right);
+ return Math.max(leftDepth, rightDepth) + 1;
+ }
+
+ public static void main(String[] args) {
+ /*
+ * 1
+ * \
+ * 2
+ * /
+ * 3
+ */
+ //System.out.println(new Solution1().isBalanced(createTree(1, null, 2, null, 3)));//false
+ /*
+ * 3
+ * / \
+ * 9 20
+ * / \
+ * 15 7
+ */
+ //System.out.println(new Solution1().isBalanced(createTree(3, 9, 20, null, null, 15, 7)));//true
+ /*
+ * 1
+ * / \
+ * 2 2
+ * / \
+ * 3 3
+ * / \
+ * 4 4
+ */
+ //System.out.println(new Solution1().isBalanced(createTree(1, 2, 2, 3, null, null, 3, 4, null, null, 4)));//false
+ /*
+ * 1
+ * / \
+ * 2 2
+ * / \
+ * 3 3
+ * / \
+ * 4 4
+ */
+ System.out.println(new Solution1().isBalanced(createTree(1, 2, 2, 3, 3, null, null, 4, 4)));//false
+ }
+}
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..9788109f
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221_110_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,79 @@
+package cn.lastwhisper.leetcode.binarytree.平衡二叉树_110_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/balanced-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isBalanced(TreeNode root) {
+ return getTreeDepth(root) != -1;
+ }
+
+ private int getTreeDepth(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ int leftDepth = getTreeDepth(root.left);
+ if (leftDepth == -1) {
+ return -1;
+ }
+ int rightDepth = getTreeDepth(root.right);
+ if (rightDepth == -1) {
+ return -1;
+ }
+ if (Math.abs(leftDepth - rightDepth) > 1) {
+ return -1;
+ }
+ return Math.max(leftDepth, rightDepth) + 1;
+ }
+
+
+ public static void main(String[] args) {
+ /*
+ * 1
+ * \
+ * 2
+ * /
+ * 3
+ */
+ //System.out.println(new Solution2().isBalanced(createTree(1, null, 2, null, 3)));//false
+ /*
+ * 3
+ * / \
+ * 9 20
+ * / \
+ * 15 7
+ */
+ //System.out.println(new Solution2().isBalanced(createTree(3, 9, 20, null, null, 15, 7)));//true
+ /*
+ * 1
+ * / \
+ * 2 2
+ * / \
+ * 3 3
+ * / \
+ * 4 4
+ */
+ //System.out.println(new Solution2().isBalanced(createTree(1, 2, 2, 3, null, null, 3, 4, null, null, 4)));//false
+ /*
+ * 1
+ * / \
+ * 2 2
+ * / \
+ * 3 3
+ * / \
+ * 4 4
+ */
+ System.out.println(new Solution2().isBalanced(createTree(1, 2, 2, 3, 3, null, null, 4, 4)));//false
+ }
+}
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..38996df2
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.binarytree.求根到叶子节点数字之和_129_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/binary-tree-paths/
+ * -------------------------------------------------------------------
+ * 思考:二叉树的所有路径_257
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int sumNumbers(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+ List result = new ArrayList<>();
+ binaryTreePathsHelper(root, result, String.valueOf(root.val));
+ int sum = 0;
+ for (String s : result) {
+ sum += Integer.parseInt(s);
+ }
+ return sum;
+ }
+
+ public void binaryTreePathsHelper(TreeNode root, List result, String path) {
+ if (root.left == null && root.right == null) {
+ result.add(path);
+ }
+ if (root.left != null) {
+ binaryTreePathsHelper(root.left, result, path + root.left.val);
+ }
+ if (root.right != null) {
+ binaryTreePathsHelper(root.right, result, path + root.right.val);
+ }
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().sumNumbers(createTree(1, 2, 3)));
+ System.out.println(new Solution1().sumNumbers(createTree(4,9,0,5,1)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..a4070533
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214_129_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,58 @@
+package cn.lastwhisper.leetcode.binarytree.求根到叶子节点数字之和_129_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import javafx.util.Pair;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/sum-root-to-leaf-numbers/
+ * -------------------------------------------------------------------
+ * 思考:二叉树的所有路径_257
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int sumNumbers(TreeNode root) {
+ if (root == null) {
+ return 0;
+ }
+
+ List result = new ArrayList<>();
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, String.valueOf(root.val)));
+
+ while (!stack.isEmpty()) {
+ Pair pair = stack.pop();
+ root = pair.getKey();
+ String path = pair.getValue();
+ if (root.left == null && root.right == null) {
+ result.add(path);
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, path + root.left.val));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, path + root.right.val));
+ }
+ }
+
+ int sum = 0;
+ for (String s : result) {
+ sum += Integer.parseInt(s);
+ }
+ return sum;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().sumNumbers(createTree(1, 2, 3)));
+ System.out.println(new Solution2().sumNumbers(createTree(4,9,0,5,1)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..55cb44d5
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,40 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.*;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:递归结束条件?
+ * 1.两个节点都为null,返回true
+ * 2.两个节点有一个不为null,返回false
+ * 3.两个节点值不同,返回false
+ * -------------------------------------------------------------------
+ * 思路:先序遍历
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ // 递归结束条件
+ if (p == null && q == null) {
+ return true;
+ }
+ if (p == null || q == null) {
+ return false;
+ }
+ if (p.val != q.val) {
+ return false;
+ }
+ // 递归体
+ return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().isSameTree(createTree(), createTree()));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..17868463
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,75 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:思路三对条件进行优化
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * 情况一:q或p为null false
+ * 情况二:q与p为null true
+ * 情况二:q!=p true
+ * 情况三:q左子树或p左子树为null false
+ * 情况四:q右子树或p右子树为null false
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+
+ if (p == null && q == null) {
+ return true;
+ }
+ if (p == null || q == null) {
+ return false;
+ }
+
+ LinkedList pStaCK = new LinkedList<>();
+ LinkedList qStaCK = new LinkedList<>();
+ pStaCK.push(p);
+ qStaCK.push(q);
+ while (!pStaCK.isEmpty() && !qStaCK.isEmpty()) {
+ p = pStaCK.pop();
+ q = qStaCK.pop();
+ if (p.val != q.val) {
+ return false;
+ }
+
+ //p、q左子树有一个为null
+ if ((p.left == null && q.left != null) || (p.left != null && q.left == null)) {
+ return false;
+ }
+ //p、q右子树有一个为null
+ if ((p.right == null && q.right != null) || (p.right != null && q.right == null)) {
+ return false;
+ }
+
+ if (p.left != null) {
+ pStaCK.push(p.left);
+ }
+ if (p.right != null) {
+ pStaCK.push(p.right);
+ }
+ if (q.left != null) {
+ qStaCK.push(q.left);
+ }
+ if (q.right != null) {
+ qStaCK.push(q.right);
+ }
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().isSameTree(createTree(1, 2, 3), createTree(1, 2, 3)));
+ System.out.println(new Solution2().isSameTree(createTree(1, 2), createTree(1, null, 2)));
+ System.out.println(new Solution2().isSameTree(createTree(1, 2, 1), createTree(1, 1, 2)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..6bc50c58
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ LinkedList pStack = new LinkedList<>();
+ LinkedList qStack = new LinkedList<>();
+ pStack.push(p);
+ qStack.push(q);
+ while (!pStack.isEmpty() && !qStack.isEmpty()) {
+ p = pStack.pop();
+ q = qStack.pop();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ pStack.push(p.left);
+ pStack.push(p.right);
+ qStack.push(q.left);
+ qStack.push(q.right);
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().isSameTree(createTree(1, 2, 3), createTree(1, 2, 3)));
+ System.out.println(new Solution3().isSameTree(createTree(1, 2), createTree(1, null, 2)));
+ System.out.println(new Solution3().isSameTree(createTree(1, 2, 1), createTree(1, 1, 2)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..bbf69363
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ LinkedList stack = new LinkedList<>();
+ stack.push(p);
+ stack.push(q);
+ while (!stack.isEmpty()) {
+ p = stack.pop();
+ q = stack.pop();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ stack.push(p.left);
+ stack.push(q.left);
+ stack.push(p.right);
+ stack.push(q.right);
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution4().isSameTree(createTree(1, 2, 3), createTree(1, 2, 3)));
+ System.out.println(new Solution4().isSameTree(createTree(1, 2), createTree(1, null, 2)));
+ System.out.println(new Solution4().isSameTree(createTree(1, 2, 1), createTree(1, 1, 2)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution5.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution5.java"
new file mode 100644
index 00000000..5e70cdcd
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution5.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution5 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:层次遍历-迭代
+ * 使用两个队列分别遍历两颗树
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ LinkedList pQueue = new LinkedList<>();
+ LinkedList qQueue = new LinkedList<>();
+ pQueue.add(p);
+ qQueue.add(q);
+ while (!pQueue.isEmpty() && !qQueue.isEmpty()) {
+ p = pQueue.poll();
+ q = qQueue.poll();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ pQueue.add(p.left);
+ pQueue.add(p.right);
+ qQueue.add(q.left);
+ qQueue.add(q.right);
+ }
+ return true;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution5().isSameTree(createTree(1, 2, 3), createTree(1, 2, 3)));//true
+ System.out.println(new Solution5().isSameTree(createTree(1, 2), createTree(1, null, 2)));//false
+ System.out.println(new Solution5().isSameTree(createTree(1, 2, 1), createTree(1, 1, 2)));//false
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution6.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution6.java"
new file mode 100644
index 00000000..cfe0f756
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\233\270\345\220\214\347\232\204\346\240\221_100_\347\256\200\345\215\225/Solution6.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.binarytree.相同的树_100_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution6 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/same-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:层次遍历-迭代
+ * 使用1个队列同时遍历两颗树
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public boolean isSameTree(TreeNode p, TreeNode q) {
+ LinkedList queue = new LinkedList<>();
+ queue.add(p);
+ queue.add(q);
+ while (!queue.isEmpty()) {
+ p = queue.poll();
+ q = queue.poll();
+
+ if (p == null && q == null) continue;
+ if (p == null || q == null) return false;
+ if (p.val != q.val) return false;
+
+ queue.add(p.left);
+ queue.add(q.left);
+ queue.add(p.right);
+ queue.add(q.right);
+ }
+ return true;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution6().isSameTree(createTree(1, 2, 3), createTree(1, 2, 3)));//true
+ System.out.println(new Solution6().isSameTree(createTree(1, 2), createTree(1, null, 2)));//false
+ System.out.println(new Solution6().isSameTree(createTree(1, 2, 1), createTree(1, 1, 2)));//false
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..d1cefea3
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.binarytree.翻转二叉树_226_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.*;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/invert-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历,递归DFS
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:最坏O(n)、最好O(logn)
+ */
+ public TreeNode invertTree(TreeNode root) {
+ if (root == null)
+ return null;
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = root.left;
+ root.left = root.right;
+ root.right = tempNode;
+ // left与right已经交换,所以right写前面
+ invertTree(root.right);
+ invertTree(root.left);
+ return root;
+ }
+
+ public TreeNode invertTree1(TreeNode root) {
+ if (root == null)
+ return null;
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = root.left;
+ root.left = invertTree1(root.right);
+ root.right = invertTree1(tempNode);
+ return root;
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(4,2,7,1,3,6,9));
+ System.out.println("-------------------------------------");
+ printLevelOrder(new Solution1().invertTree(createTree(4,2,7,1,3,6,9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..14367309
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,44 @@
+package cn.lastwhisper.leetcode.binarytree.翻转二叉树_226_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.*;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/invert-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:将先序遍历(递归)利用Stack改成迭代。使用Stack模拟系统递归栈
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public TreeNode invertTree(TreeNode root) {
+ LinkedList stack = new LinkedList<>();
+ if (root != null) {
+ stack.push(root);
+ }
+ TreeNode current = null;
+ while (!stack.isEmpty()) {
+ current = stack.poll();
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = current.left;
+ current.left = current.right;
+ current.right = tempNode;
+ // 此时left与right已经交换,栈先进先出,所以入栈顺序left->right
+ if (current.left != null) stack.push(current.left);
+ if (current.right != null) stack.push(current.right);
+ }
+ return root;
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(4,2,7,1,3,6,9));
+ System.out.println("-------------------------------------");
+ printLevelOrder(new Solution2().invertTree(createTree(4,2,7,1,3,6,9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..5fc5055d
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.binarytree.翻转二叉树_226_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.*;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/invert-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:迭代BFS,层级遍历翻转(二叉树的层次遍历_102)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public TreeNode invertTree(TreeNode root) {
+ Queue queue = new LinkedList<>();
+ if (root != null) {
+ queue.add(root);
+ }
+ TreeNode current = null;
+ while (!queue.isEmpty()) {
+ //int size = queue.size();
+ //for (int i = 0; i < size; i++) {
+ current = queue.poll();
+ // 翻转当前节点的左右子节点
+ TreeNode tempNode = current.left;
+ current.left = current.right;
+ current.right = tempNode;
+
+ if (current.right != null) queue.add(current.right);
+ if (current.left != null) queue.add(current.left);
+ //}
+ }
+ return root;
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(4,2,7,1,3,6,9));
+ System.out.println("-------------------------------------");
+ printLevelOrder(new Solution3().invertTree(createTree(4,2,7,1,3,6,9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..2697a199
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,35 @@
+package cn.lastwhisper.leetcode.binarytree.翻转二叉树_226_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.printLevelOrder;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/invert-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:中序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public TreeNode invertTree(TreeNode root) {
+ if (root == null) return null;
+ invertTree(root.left); // 递归找到左节点
+ TreeNode rightNode = root.right; // 保存右节点
+ root.right = root.left;
+ root.left = rightNode;
+ // 递归找到右节点 继续交换 : 因为此时左右节点已经交换了,所以此时的右节点为root.left
+ invertTree(root.left);
+ return root;
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(4, 2, 7, 1, 3, 6, 9));
+ System.out.println("-------------------------------------");
+ printLevelOrder(new Solution4().invertTree(createTree(4, 2, 7, 1, 3, 6, 9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution5.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution5.java"
new file mode 100644
index 00000000..60e8195f
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221_226_\347\256\200\345\215\225/Solution5.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.binarytree.翻转二叉树_226_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.printLevelOrder;
+
+class Solution5 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/invert-binary-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:后序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public TreeNode invertTree(TreeNode root) {
+ // 后序遍历-- 从下向上交换
+ if (root == null) return null;
+ TreeNode leftNode = invertTree(root.left);
+ TreeNode rightNode = invertTree(root.right);
+ root.right = leftNode;
+ root.left = rightNode;
+ return root;
+ }
+
+ public static void main(String[] args) {
+ printLevelOrder(createTree(4, 2, 7, 1, 3, 6, 9));
+ System.out.println("-------------------------------------");
+ printLevelOrder(new Solution5().invertTree(createTree(4, 2, 7, 1, 3, 6, 9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..8d057a72
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_112_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归先序遍历递归
+ * 先序遍历,sum-路径上节点的值,减到叶子节点,返回结果是否等于0
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean hasPathSum(TreeNode root, int sum) {
+ // 当前节点不为空
+ if (root == null) {
+ return false;
+ }
+ // 根节点到叶子节点中间路径和等于sum不行,叶子节点为终结才行
+ if (root.left == null && root.right == null) {
+ return sum - root.val == 0;
+ }
+ return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val);
+ }
+
+ public static void main(String[] args) {
+ TreeNode tree = createTree(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1);
+ //TreeNode tree = createTree(5, null, 8, null, null, 13, 4);
+ int sum = 22;
+ System.out.println(new Solution1().hasPathSum(tree, sum));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..5e2a58c6
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,52 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_112_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代;
+ * 在根节点到叶子节点的路径总和=sum即可
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean hasPathSum(TreeNode root, int sum) {
+ if (root == null) {
+ return false;
+ }
+ // 节点
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, 0));
+
+ Pair pair;
+ Integer parentVal;
+ while (!stack.isEmpty()) {
+ pair = stack.pop();
+ root = pair.getKey();
+ parentVal = pair.getValue();
+ if (root.left == null && root.right == null) {
+ if (root.val + parentVal == sum) {
+ return true;
+ }
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, root.val + parentVal));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, root.val + parentVal));
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution5.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution5.java"
new file mode 100644
index 00000000..b8b5f2b4
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_112_\347\256\200\345\215\225/Solution5.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_112_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution5 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代;
+ * 在根节点到叶子节点的路径总和=sum即可
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public boolean hasPathSum(TreeNode root, int sum) {
+ if (root == null) {
+ return false;
+ }
+ // 节点
+ LinkedList> stack = new LinkedList<>();
+ stack.push(new Pair<>(root, sum));
+ Pair pair;
+ // 暂存当前位置sum还剩下的值
+ Integer parentSum;
+ while (!stack.isEmpty()) {
+ pair = stack.pop();
+ root = pair.getKey();
+ parentSum = pair.getValue();
+ if (root.left == null && root.right == null) {
+ if (parentSum - root.val == 0) {
+ return true;
+ }
+ }
+ if (root.left != null) {
+ stack.push(new Pair<>(root.left, parentSum - root.val));
+ }
+ if (root.right != null) {
+ stack.push(new Pair<>(root.right, parentSum - root.val));
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ TreeNode tree = createTree(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1);
+ int sum = 22;
+ System.out.println(new Solution5().hasPathSum(tree, sum));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_III_437_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_III_437_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..b786a6bc
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_III_437_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_III_437_简单;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum-iii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * 找每一个节点的pathSum
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ // 从root找到路径和等于sum的数量
+ public int pathSum(TreeNode root, int sum) {
+ if(root==null){
+ return 0;
+ }
+ int res = findPathSum(root, sum);
+ res+=pathSum(root.left,sum);
+ res+=pathSum(root.right,sum);
+ return res;
+ }
+
+ // 从node找到路径和等于sum的数量
+ public int findPathSum(TreeNode node, int sum) {
+ if (node == null) {
+ return 0;
+ }
+ int res = 0;
+ if (node.val == sum) {
+ res++;
+ }
+ res += findPathSum(node.left, sum - node.val);
+ res += findPathSum(node.right, sum - node.val);
+
+ return res;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().pathSum(createTree(10, 5, -3, 3, 2, null, 11, 3, -2, null, 1), 8));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..704f3ab1
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_II_113_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+import static cn.lastwhisper.leetcode.common.print.PrintUtil.printLists;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum-ii/
+ * -------------------------------------------------------------------
+ * 思考:路径总和(112)+二叉树的所有路劲(257)
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public List> pathSum(TreeNode root, int sum) {
+ List> result = new ArrayList<>();
+ if (root == null) {
+ return result;
+ }
+ pathSumHelper(root, String.valueOf(root.val), root.val, result, sum);
+ return result;
+ }
+
+ public void pathSumHelper(TreeNode root, String path, int partSum, List> result, int sum) {
+ if (root.left == null && root.right == null && partSum == sum) {
+ String[] arr = path.split(",");
+ List list = new ArrayList<>(arr.length);
+ for (String a : arr) {
+ list.add(Integer.parseInt(a));
+ }
+ result.add(list);
+ }
+ if (root.left != null) {
+ pathSumHelper(root.left, path + "," + root.left.val, partSum + root.left.val, result, sum);
+ }
+ if (root.right != null) {
+ pathSumHelper(root.right, path + "," + root.right.val, partSum + root.right.val, result, sum);
+ }
+ }
+
+ public static void main(String[] args) {
+ printLists(new Solution1().pathSum(createTree(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1), 22));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..c9a5f6ff
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\350\267\257\345\276\204\346\200\273\345\222\214_II_113_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,71 @@
+package cn.lastwhisper.leetcode.binarytree.路径总和_II_113_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+import static cn.lastwhisper.leetcode.common.print.PrintUtil.printLists;
+
+class Solution2 {
+ static class DTO {
+ public TreeNode treeNode;
+ public String path;
+ public Integer sum;
+
+ public DTO(TreeNode treeNode, String path, Integer sum) {
+ this.treeNode = treeNode;
+ this.path = path;
+ this.sum = sum;
+ }
+ }
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/path-sum-ii/
+ * -------------------------------------------------------------------
+ * 思考:路径总和(112)+二叉树的所有路劲(257)
+ * -------------------------------------------------------------------
+ * 思路:先序遍历-迭代
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public List> pathSum(TreeNode root, int sum) {
+ List> result = new ArrayList<>();
+ if (root == null) {
+ return result;
+ }
+ LinkedList stack = new LinkedList<>();
+ stack.push(new DTO(root, String.valueOf(root.val), root.val));
+
+ while (!stack.isEmpty()) {
+ DTO dto = stack.pop();
+ root = dto.treeNode;
+ String path = dto.path;
+ Integer partSum = dto.sum;
+
+ if (root.left == null && root.right == null && partSum == sum) {
+ String[] arr = path.split(",");
+ List list = new ArrayList<>(arr.length);
+ for (String a : arr) {
+ list.add(Integer.parseInt(a));
+ }
+ result.add(list);
+ }
+
+ if (root.left != null) {
+ stack.push(new DTO(root.left, path + "," + root.left.val, partSum + root.left.val));
+ }
+ if (root.right != null) {
+ stack.push(new DTO(root.right, path + "," + root.right.val, partSum + root.right.val));
+ }
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ printLists(new Solution2().pathSum(createTree(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1), 22));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..5722bed9
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,41 @@
+package cn.lastwhisper.leetcode.binarytree.验证二叉搜索树_98_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/validate-binary-search-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:bst中序遍历就是从小到大
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public boolean isValidBST(TreeNode root) {
+ double inorder = -Double.MAX_VALUE;
+ LinkedList stack = new LinkedList<>();
+ while (root != null || !stack.isEmpty()) {
+ while (root != null) {
+ stack.push(root);
+ root = root.left;
+ }
+ root = stack.pop();
+ // 每一个节点值都应该比前一个值大
+ if (root.val <= inorder) return false;
+ inorder = root.val;
+ root = root.right;
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().isValidBST(createTree(5, 1, 4, null, null, 3, 6)));
+ System.out.println(new Solution1().isValidBST(createTree(1, 1)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..dbd6dc14
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,35 @@
+package cn.lastwhisper.leetcode.binarytree.验证二叉搜索树_98_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import static cn.lastwhisper.leetcode.common.tree.TreeUtil.createTree;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/validate-binary-search-tree/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public boolean isValidBST(TreeNode root) {
+ return isValidBST(root, null, null);
+ }
+
+ private boolean isValidBST(TreeNode root, TreeNode min, TreeNode max) {
+ if (root == null) return true;
+ // 右子树>root
+ if (min != null && root.val <= min.val) return false;
+ // 左子树= max.val) return false;
+ return isValidBST(root.left, min, root) && isValidBST(root.right, root, max);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().isValidBST(createTree(5, 1, 4, null, null, 3, 6)));
+ System.out.println(new Solution2().isValidBST(createTree(1, 1)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..8eb75135
--- /dev/null
+++ "b/algorithms/leetcode/binarytree/src/main/java/cn/lastwhisper/leetcode/binarytree/\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221_98_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,36 @@
+package cn.lastwhisper.leetcode.binarytree.验证二叉搜索树_98_中等;
+
+import cn.lastwhisper.leetcode.common.tree.TreeNode;
+
+import java.util.LinkedList;
+
+class Solution3 {
+ private LinkedList stack = new LinkedList<>();
+ private LinkedList uppers = new LinkedList<>();
+ private LinkedList lowers = new LinkedList<>();
+
+ private void update(TreeNode node, Integer lower, Integer upper) {
+ stack.add(node);
+ lowers.add(lower);
+ uppers.add(upper);
+ }
+
+ public boolean isValidBST(TreeNode root) {
+ Integer lower = null, upper = null, val;
+ update(root, lower, upper);
+
+ while (!stack.isEmpty()) {
+ root = stack.poll();
+ lower = lowers.poll();
+ upper = uppers.poll();
+
+ if (root == null) continue;
+ val = root.val;
+ if (lower != null && val <= lower) return false;
+ if (upper != null && val >= upper) return false;
+ update(root.right, val, upper);
+ update(root.left, lower, val);
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/bitoperation/pom.xml b/algorithms/leetcode/bitoperation/pom.xml
new file mode 100644
index 00000000..dc6566c3
--- /dev/null
+++ b/algorithms/leetcode/bitoperation/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ leetcode
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ bitoperation
+
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/bitoperation/src/main/java/cn/lastwhisper/leetcode/bitoperation/\344\275\2151\347\232\204\344\270\252\346\225\260_191_\347\256\200\345\215\225/Solution.java" "b/algorithms/leetcode/bitoperation/src/main/java/cn/lastwhisper/leetcode/bitoperation/\344\275\2151\347\232\204\344\270\252\346\225\260_191_\347\256\200\345\215\225/Solution.java"
new file mode 100644
index 00000000..4980b5ec
--- /dev/null
+++ "b/algorithms/leetcode/bitoperation/src/main/java/cn/lastwhisper/leetcode/bitoperation/\344\275\2151\347\232\204\344\270\252\346\225\260_191_\347\256\200\345\215\225/Solution.java"
@@ -0,0 +1,17 @@
+package cn.lastwhisper.leetcode.bitoperation.位1的个数_191_简单;
+
+class Solution {
+ // you need to treat n as an unsigned value
+ public int hammingWeight(int n) {
+ int count = 0;
+ while (n != 0) {
+ // n=10011101,n-1=10011100
+ // &全1则1,否则0
+ // n & (n - 1)=10011101&10011100=10011100
+ // n=10011100
+ n = n & (n - 1);
+ count++;
+ }
+ return count;
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/dfsbfs/pom.xml b/algorithms/leetcode/dfsbfs/pom.xml
new file mode 100644
index 00000000..7390dea6
--- /dev/null
+++ b/algorithms/leetcode/dfsbfs/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ leetcode
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dfsbfs
+
+
+
+ leetcode-common
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git "a/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\234\260\345\233\276\345\210\206\346\236\220_1162_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\234\260\345\233\276\345\210\206\346\236\220_1162_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..4a36d1f8
--- /dev/null
+++ "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\234\260\345\233\276\345\210\206\346\236\220_1162_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,55 @@
+package cn.lastwhisper.leetcode.dfsbfs.地图分析_1162_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/as-far-from-land-as-possible/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:广度优先搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int maxDistance(int[][] grid) {
+ int max = 0;
+
+ //boolean[][] visited = new boolean[grid.length][grid[0].length];
+ for (int i = 0; i < grid.length; i++) {
+ for (int j = 0; j < grid[0].length; j++) {
+ if (grid[i][j] == 1) {
+ max = Math.max(dfs(grid, i, j), max);
+ }
+ }
+ }
+ return max;
+ }
+
+ public int dfs(int[][] grid, int i, int j) {
+ int max = 0;
+ for (int k = 0; k < grid.length; k++) {
+ for (int l = 0; l < grid[0].length; l++) {
+ //if (k == i && l == j) {
+ // continue;
+ //}
+ if (grid[k][l] == 0) {
+ max = Math.max(manhattanDistance(i, k, j, l), max);
+ }
+ }
+ }
+ return max;
+ }
+
+ /**
+ * 曼哈顿距离
+ */
+ public int manhattanDistance(int x0, int x1, int y0, int y1) {
+ return Math.abs(x0 - x1) + Math.abs(y0 - y1);
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(2, new Solution1().maxDistance(new int[][]{{1, 0, 1}, {0, 0, 0}, {1, 0, 1}}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257_695_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257_695_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..48665435
--- /dev/null
+++ "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257_695_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,64 @@
+package cn.lastwhisper.leetcode.dfsbfs.岛屿的最大面积_695_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/max-area-of-island/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:深度优先搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int maxAreaOfIsland(int[][] grid) {
+ int max = 0;
+ boolean[][] visited = new boolean[grid.length][grid[0].length];
+ for (int i = 0; i < grid.length; i++) {
+ for (int j = 0; j < grid[0].length; j++) {
+ if (grid[i][j] == 1) {
+ max = Math.max(dfs(grid, i, j, visited), max);
+ }
+ }
+ }
+ return max;
+ }
+
+ /**
+ * @param grid 岛屿
+ * @param x 当前所处的x
+ * @param y 当前所处的y
+ * @param visited 已经被访问的
+ */
+ public int dfs(int[][] grid, int x, int y, boolean[][] visited) {
+ if (x < 0 || x > grid.length - 1 || y < 0 || y > grid[0].length - 1 || visited[x][y] || grid[x][y] == 0) {
+ return 0;
+ }
+ int count = 1;
+ visited[x][y] = true;// 不需要回溯,因为到过的地方下次不会再去
+ count += dfs(grid, x - 1, y, visited);//上
+ count += dfs(grid, x, y + 1, visited);//右
+ count += dfs(grid, x + 1, y, visited);//下
+ count += dfs(grid, x, y - 1, visited);//左
+ return count;
+ }
+
+ public static void main(String[] args) {
+ //int[][] grid = {{0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
+ // {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
+ // {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
+ // {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0},
+ // {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0},
+ // {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
+ // {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
+ // {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0}
+ //};
+ int[][] grid = {{1, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0},
+ {0, 0, 0, 1, 1},
+ {0, 0, 0, 1, 1}};
+ Assert.assertEquals(4, new Solution1().maxAreaOfIsland(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\350\205\220\347\203\202\347\232\204\346\251\230\345\255\220_994_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\350\205\220\347\203\202\347\232\204\346\251\230\345\255\220_994_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..f70e4922
--- /dev/null
+++ "b/algorithms/leetcode/dfsbfs/src/main/java/cn/lastwhisper/leetcode/dfsbfs/\350\205\220\347\203\202\347\232\204\346\251\230\345\255\220_994_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,80 @@
+package cn.lastwhisper.leetcode.dfsbfs.腐烂的橘子_994_简单;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/rotting-oranges/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:广度优先搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int orangesRotting(int[][] grid) {
+ int m = grid.length;
+ int n = grid[0].length;
+ Queue queue = new LinkedList<>();
+
+ int count = 0; // count 表示新鲜橘子的数量
+ for (int r = 0; r < m; r++) {
+ for (int c = 0; c < n; c++) {
+ if (grid[r][c] == 1) {//新鲜
+ count++;
+ } else if (grid[r][c] == 2) {//腐烂
+ queue.add(new int[]{r, c});
+ }
+ }
+ }
+
+ int round = 0; // round 表示腐烂的轮数,或者分钟数
+ while (count > 0 && !queue.isEmpty()) {
+ round++;
+ int size = queue.size();
+ for (int i = 0; i < size; i++) {
+ int[] orange = queue.poll();
+ // 腐烂橘子的坐标
+ int r = orange[0];
+ int c = orange[1];
+ // 上下左右查看,是新鲜的就给它腐烂
+ // 腐烂橘子上面的橘子
+ if (r - 1 >= 0 && grid[r - 1][c] == 1) {
+ grid[r - 1][c] = 2;
+ count--;
+ queue.add(new int[]{r - 1, c});
+ }
+ // 腐烂橘子下面的橘子
+ if (r + 1 < m && grid[r + 1][c] == 1) {
+ grid[r + 1][c] = 2;
+ count--;
+ queue.add(new int[]{r + 1, c});
+ }
+ // 腐烂橘子左面的橘子
+ if (c - 1 >= 0 && grid[r][c - 1] == 1) {
+ grid[r][c - 1] = 2;
+ count--;
+ queue.add(new int[]{r, c - 1});
+ }
+ // 腐烂橘子右面的橘子
+ if (c + 1 < n && grid[r][c + 1] == 1) {
+ grid[r][c + 1] = 2;
+ count--;
+ queue.add(new int[]{r, c + 1});
+ }
+ }
+ }
+
+ if (count > 0) {
+ return -1;
+ } else {
+ return round;
+ }
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/divide/pom.xml b/algorithms/leetcode/divide/pom.xml
new file mode 100644
index 00000000..4fe344f5
--- /dev/null
+++ b/algorithms/leetcode/divide/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ leetcode
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ divide
+
+
+
+ cn.lastwhisper
+ leetcode-common
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/algorithms/leetcode/dynamic/README.md b/algorithms/leetcode/dynamic/README.md
new file mode 100644
index 00000000..93d3aba6
--- /dev/null
+++ b/algorithms/leetcode/dynamic/README.md
@@ -0,0 +1,156 @@
+### 动态规划题目特点
+
+##### 1. 计数
+
+- 有多少种方式走到右下角
+- 有多少种方法选出k个数使得和是sum
+
+##### 2.求最大最小值
+
+- 从左上角走到右下角路径的最大数字和
+- 最长上升子序列长度
+
+##### 3.求存在性
+
+- 取石子游戏,先手是否必胜
+- 能不能选出k个数使得和是sum
+
+### 动态规划四个组成部分:
+
+- 确定状态
+ - 研究最优策略的最后一步
+ - 化为子问题
+- 转移方程
+ - 根据子问题定义直接得到
+- **初始条件和边界情况**
+- 计算顺序
+ - 利用之前的计算结果
+
+### 最值型动态规划
+
+> Coin Change
+> 假设你有三种硬币,分别面值2元,5元和7元,每种硬币都有足够多,买一本书需要27元,如何用最少的硬币组合正好付清,不需要对方找钱。
+
+#### 动态规划组成部分一:确定状态
+
+- 状态是动态规划的核心
+- 解动态规划时需要定义一个数组,数组的每一个元素`f[i]`或者`f[j][j]`代表什么
+- 确定状态需要两个意识:
+ - 最后一步
+ - 子问题
+
+> **最后一步**
+> 1-不知道最优策略,但最优策略肯定是K枚硬币面值加起来是27
+> 2-所以肯定有一枚最后的硬币:
+> **关键点1:**不关心前面`k-1`枚硬币如何拼出,甚至不知道,但是确定了前面的硬币拼出了
+> **关键点2:**因为是最优策略,所以拼出的硬币数一定要最少,否则矛盾。
+> **子问题**
+> 1 - 需要求出最少用多少枚硬币可以拼出
+> 2 - 原问题是最少用多少枚硬币拼出27
+> 3 - 原问题转化成了一个规模更小的子问题:
+> 4 - 设状态%20%3D%20%E6%9C%80%E5%B0%91%E7%94%A8%E5%A4%9A%E5%B0%91%E6%9E%9A%E7%A1%AC%E5%B8%81%E6%8B%BC%E5%87%BAX)
+> 最后一枚硬币只可能是2,5或7
+> 若,)应该是%20%2B%201)(加上最后的一枚硬币2)
+> 若,)应该是%20%2B%201)(加上最后的一枚硬币5)
+> 若,)应该是%20%2B%201)(加上最后的一枚硬币7)
+> 要求最少的硬币数:
+> %20%3D%20min%7Bf(27%20-%202)%2C%20f(27%20-%205)%2C%20f(27%20-%207)%7D%20%2B%201)
+
+#### 动态规划组成部分二:转移方程
+
+- 设状态%20%3D) 最少用多少枚硬币拼出
+- 对于任意,%20%3D%20min%7Bf(27%20-%202)%2C%20f(27%20-%205)%2C%20f(27%20-%207)%7D%20%2B%201)
+
+#### 动态规划组成部分三:初始条件和边界情况
+
+- 时,%20%3D%20%2B%5Cinfty)
+- 初始条件:%20%3D%200)
+
+#### 动态规划组成部分三:计算顺序
+
+- 初始条件:%20%3D%200)
+- 然后计算%2Cf(2)%2C...%2Cf(27))
+- 大多数情况都是从小到大地算,这样当算)时,前面的%2Cf(x-5)%E5%92%8Cf(x-7))都已经算过了。
+
+### 求最值型动态规划小结
+
+- 1.确定状态
+ - 最后一步(最优策略中使用的最后一枚硬币)
+ - 化成子问题(最少的硬币拼出更小的面值
+- 2.转移方程
+ - %20%3D%20min%7Bf(X%20-%202)%2C%20f(X%20-%205)%2C%20f(X%20-%207)%7D%20%2B%201)
+- 3.初始条件和边界情况
+ - %20%3D%200),如果不能拼出,%20%3D%20%2B%5Cinfty)
+- 4.计算顺序
+ - %2Cf(1)%2C...)
+
+### 计数型动态规划
+
+> Unique Paths
+>
+>
+>
+> 给定m行n列的网格,有一个机器人从左上角(0, 0)出发,每一步可以向下或者向右走一步,问有多少种不同的方式走到右下角
+>
+> 
+
+#### 动态规划组成部分一:确定状态
+
+- 最后一步:机器人走到右下角之前的最后一步:
+
+ 向右或者向下
+
+ 
+
+- 右下角坐标为(m - 1, n - 1),那么前一步机器人一定是在(m - 2, n - 1)或者(m - 1, n - 2)
+
+- 子问题 ——从左上角走到(m - 2, n - 1)和从左上角走到(m - 1, n - 2);假设从左上角走到(m - 2, n - 1)有种方式,从左上角走到(m - 1, n - 2)有种方式,那么走到(m - 1, n - 1)就有种方式。
+ 问题转化为机器人有多少种方式从左上角走到(m - 2, n - 1)和(m - 1, n - 2)
+
+- 状态:设![f[i][j]](https://math.jianshu.com/math?formula=f%5Bi%5D%5Bj%5D)为机器人有多少种方式从左上角走到)
+
+#### 动态规划组成部分二:转移方程
+
+- 对于任意坐标),![f[i][j] = f[i - 1][j] + f[i][j - 1]](https://math.jianshu.com/math?formula=f%5Bi%5D%5Bj%5D%20%3D%20f%5Bi%20-%201%5D%5Bj%5D%20%2B%20f%5Bi%5D%5Bj%20-%201%5D)
+
+#### 动态规划组成部分三:初始条件和边界情况
+
+- 初始条件:![f[0][0] = 1](https://math.jianshu.com/math?formula=f%5B0%5D%5B0%5D%20%3D%201),机器人只有一种方式到左上角
+- 边界情况:,则前一步只能有一个方向过来
+
+#### 动态规划组成部分四:计算顺序
+
+- ![f[0][0] = 1](https://math.jianshu.com/math?formula=f%5B0%5D%5B0%5D%20%3D%201)
+- 计算第0行:![f[0][0],f[0][1],...,f[0][n-1]](https://math.jianshu.com/math?formula=f%5B0%5D%5B0%5D%2Cf%5B0%5D%5B1%5D%2C...%2Cf%5B0%5D%5Bn-1%5D)
+- 计算第1行:![f[1][0],f[1][1],...,f[1][n-1]](https://math.jianshu.com/math?formula=f%5B1%5D%5B0%5D%2Cf%5B1%5D%5B1%5D%2C...%2Cf%5B1%5D%5Bn-1%5D)
+- 
+- 计算第m-1行:![f[m-1][0],f[m-1][1],...,f[m-1][n-1]](https://math.jianshu.com/math?formula=f%5Bm-1%5D%5B0%5D%2Cf%5Bm-1%5D%5B1%5D%2C...%2Cf%5Bm-1%5D%5Bn-1%5D)
+- 答案是![f[m-1][n-1]](https://math.jianshu.com/math?formula=f%5Bm-1%5D%5Bn-1%5D)
+ 时间复杂度和空间复杂度都是)
+
+### 存在性型动态规划
+
+> 有块石头分别在x轴的位置,一只青蛙在石头,想跳到石头,如果青蛙在第块石头上,它最多可以向右跳距离,问青蛙能否跳到石头。
+
+#### 动态规划组成部分一:确定状态
+
+- 最后一步:如果青蛙能跳到最后一块石头,考虑它跳的最后一步是从石头跳过来的,
+- 需要满足两个条件:1. 青蛙可以跳到石头 2.最后一步不超过跳跃的最大距离:
+- 子问题——青蛙能不能跳到石头))
+
+#### 动态规划组成部分三:初始条件和边界情况
+
+- 设![f[j]](https://math.jianshu.com/math?formula=f%5Bj%5D)表示青蛙能不能跳到石头
+- 初始条件:![f[0] = True](https://math.jianshu.com/math?formula=f%5B0%5D%20%3D%20True),青蛙一开始就在石头
+
+#### 动态规划组成部分四:计算顺序
+
+- 初始化![f[0] = True](https://math.jianshu.com/math?formula=f%5B0%5D%20%3D%20True)
+- 计算![f[1],f[2],...,f[n-1]](https://math.jianshu.com/math?formula=f%5B1%5D%2Cf%5B2%5D%2C...%2Cf%5Bn-1%5D)
+- 答案是![f[n-1]](https://math.jianshu.com/math?formula=f%5Bn-1%5D)
+ 时间复杂度:),空间复杂度:)
\ No newline at end of file
diff --git a/algorithms/leetcode/dynamic/pom.xml b/algorithms/leetcode/dynamic/pom.xml
index e7c48bb8..6f55f76b 100644
--- a/algorithms/leetcode/dynamic/pom.xml
+++ b/algorithms/leetcode/dynamic/pom.xml
@@ -13,4 +13,13 @@
dynamic
+
+
+
+ leetcode-common
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution1.java b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution1.java
new file mode 100644
index 00000000..a68c90c0
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution1.java
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.dynamic.knapsack01;
+
+/**
+ * 01背包
+ * @author lastwhisper
+ * @date 2020/2/20
+ */
+public class Solution1 {
+
+
+ private int bestValue(int[] w, int[] v, int index, int capacity) {
+ if (index < 0 || capacity <= 0) {
+ return 0;
+ }
+ // 尝试[0,index-1]的商品
+ int res = bestValue(w, v, index - 1, capacity);
+ if (capacity >= w[index]) {
+ // 尝试index的商品和[0,index-1]时capacity等于减去w[index]的商品
+ res = Math.max(res, v[index] + bestValue(w, v, index - 1, capacity - w[index]));
+ }
+ return res;
+ }
+
+ /**
+ * 01背包 递归
+ *
+ * F(n,c)考虑将n个物品放进容量为c的背包,使得价值最大
+ * F(i,c) = max(F(i-1,c),v[i]+F(i-1,c-w[i]))
+ *
+ * @param w 每个商品对应的重量
+ * @param v 每个商品对应的价值
+ * @param capacity 背包容量
+ * @return int 最大价值
+ */
+ public int knapsack01(int[] w, int[] v, int capacity) {
+ int n = w.length;
+ return bestValue(w, v, n - 1,capacity );
+ }
+
+ /**
+ * 容量为:5
+ * 三个物品:
+ * w 1 2 3
+ * v 6 10 12
+ *
+ * 最大价值22
+ */
+ public static void main(String[] args) {
+ int[] w = new int[]{1, 2, 3};
+ int[] v = new int[]{6, 10, 12};
+ int capacity = 5;
+ System.out.println(new Solution1().knapsack01(w, v, capacity));
+ }
+}
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution2.java b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution2.java
new file mode 100644
index 00000000..9c4b23c2
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution2.java
@@ -0,0 +1,57 @@
+package cn.lastwhisper.leetcode.dynamic.knapsack01;
+
+/**
+ * 01背包
+ * @author lastwhisper
+ * @date 2020/2/20
+ */
+public class Solution2 {
+
+
+ private int bestValue(int[] w, int[] v, int index, int capacity, int[][] memo) {
+ if (index < 0 || capacity <= 0) {
+ return 0;
+ }
+ if (memo[index][capacity] != 0) {
+ return memo[index][capacity];
+ }
+ // 尝试[0,index-1]的商品
+ int res = bestValue(w, v, index - 1, capacity, memo);
+ if (capacity >= w[index]) {
+ // 尝试index的商品和[0,index-1]时capacity等于减去w[index]的商品
+ res = Math.max(res,v[index] + bestValue(w, v, index - 1, capacity - w[index], memo));
+ }
+ memo[index][capacity] = res;
+ return res;
+ }
+
+ /**
+ * 01背包
+ * 递归+备忘录
+ *
+ * @param w 每个商品对应的重量
+ * @param v 每个商品对应的价值
+ * @param capacity 背包容量
+ * @return int 最大价值
+ */
+ public int knapsack01(int[] w, int[] v, int capacity) {
+ int n = w.length;
+ int[][] memo = new int[n][capacity + 1];
+ return bestValue(w, v,n-1, capacity, memo);
+ }
+
+ /**
+ * 容量为:5
+ * 三个物品:
+ * w 1 2 3
+ * v 6 10 12
+ *
+ * 最大价值22
+ */
+ public static void main(String[] args) {
+ int[] w = new int[]{1, 2, 3};
+ int[] v = new int[]{6, 10, 12};
+ int capacity = 5;
+ System.out.println(new Solution2().knapsack01(w, v, capacity));
+ }
+}
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution3.java b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution3.java
new file mode 100644
index 00000000..5e60824d
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution3.java
@@ -0,0 +1,67 @@
+package cn.lastwhisper.leetcode.dynamic.knapsack01;
+
+/**
+ * 01背包
+ * @author lastwhisper
+ * @date 2020/2/20
+ */
+public class Solution3 {
+
+ /**
+ * 01背包 动态规划
+ *
+ * 时间复杂度:O(n*c)
+ * 空间复杂度:O(n*c)
+ *
+ * F(n,c)考虑将n个物品放进容量为c的背包,使得价值最大
+ * F(i,c) = max(F(i-1,c),v[i]+F(i-1,c-w[i]))
+ *
+ * @param w 每个商品对应的重量
+ * @param v 每个商品对应的价值
+ * @param c 背包容量
+ * @return int 最大价值
+ */
+ public int knapsack01(int[] w, int[] v, int c) {
+ int n = w.length;
+ if (n == 0) {
+ return 0;
+ }
+
+ int[][] dp = new int[n][c + 1];
+
+ // 初始化第一行
+ for (int i = 0; i <= c; i++) {
+ dp[0][i] = i >= w[0] ? v[0] : 0;
+ }
+
+ // 外循环,当前可选商品
+ for (int i = 1; i < n; i++) {
+ // 内循环,当前可用背包大小
+ for (int j = 0; j <= c; j++) {
+ // 不考虑当前商品
+ dp[i][j] = dp[i - 1][j];
+ // 考虑当前商品+剩余容量时剩下商品
+ if (j >= w[i]) {
+ dp[i][j] = Math.max(dp[i][j], v[i] + dp[i - 1][j - w[i]]);
+ }
+ }
+ }
+
+ return dp[n - 1][c];
+ }
+
+ /**
+ * 容量为:5
+ * 三个物品:
+ * w 1 2 3
+ * v 6 10 12
+ *
+ * 最大价值22
+ */
+ public static void main(String[] args) {
+ int[] w = new int[]{1, 2, 3};
+ int[] v = new int[]{6, 10, 12};
+ int capacity = 5;
+ System.out.println(new Solution3().knapsack01(w, v, capacity));
+ }
+}
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution4.java b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution4.java
new file mode 100644
index 00000000..82ec5b1c
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution4.java
@@ -0,0 +1,71 @@
+package cn.lastwhisper.leetcode.dynamic.knapsack01;
+
+/**
+ * 01背包
+ * @author lastwhisper
+ * @date 2020/2/20
+ */
+public class Solution4 {
+
+ /**
+ * 01背包 动态规划
+ *
+ * 时间复杂度:O(n*c)
+ * 空间复杂度:O(2*c)
+ *
+ * F(n,c)考虑将n个物品放进容量为c的背包,使得价值最大
+ * F(i,c) = max(F(i-1,c),v[i]+F(i-1,c-w[i]))
+ *
+ * 空间优化:
+ * 第i行元素只依赖于第i-1行元素。理论上,只需要保持两行元素。
+ * 空间复杂度:O( 2 * C ) = O(C)
+ *
+ * @param w 每个商品对应的重量
+ * @param v 每个商品对应的价值
+ * @param c 背包容量
+ * @return int 最大价值
+ */
+ public int knapsack01(int[] w, int[] v, int c) {
+ int n = w.length;
+ if (n == 0) {
+ return 0;
+ }
+
+ int[][] dp = new int[2][c + 1];
+
+ // 初始化第一行
+ for (int i = 0; i <= c; i++) {
+ dp[0][i] = i >= w[0] ? v[0] : 0;
+ }
+
+ // 外循环,当前可选商品
+ for (int i = 1; i < n; i++) {
+ // 内循环,当前可用背包大小
+ for (int j = 0; j <= c; j++) {
+ // 不考虑当前商品
+ dp[i % 2][j] = dp[(i - 1) % 2][j];
+ // 考虑当前商品+剩余容量时剩下商品
+ if (j >= w[i % 2]) {
+ dp[i % 2][j] = Math.max(dp[i % 2][j], v[i% 2] + dp[(i - 1) % 2][j - w[i % 2]]);
+ }
+ }
+ }
+
+ return dp[(n - 1) % 2][c];
+ }
+
+ /**
+ * 容量为:5
+ * 三个物品:
+ * w 1 2 3
+ * v 6 10 12
+ *
+ * 最大价值22
+ */
+ public static void main(String[] args) {
+ int[] w = new int[]{1, 2, 3};
+ int[] v = new int[]{6, 10, 12};
+ int capacity = 5;
+ System.out.println(new Solution4().knapsack01(w, v, capacity));
+ }
+}
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution5.java b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution5.java
new file mode 100644
index 00000000..c335d37e
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/Solution5.java
@@ -0,0 +1,66 @@
+package cn.lastwhisper.leetcode.dynamic.knapsack01;
+
+/**
+ * 01背包
+ * @author lastwhisper
+ * @date 2020/2/20
+ */
+public class Solution5 {
+
+ /**
+ * 01背包 动态规划
+ *
+ * 时间复杂度:O(n*c)
+ * 空间复杂度:O(c)
+ *
+ * F(n,c)考虑将n个物品放进容量为c的背包,使得价值最大
+ * F(i,c) = max(F(i-1,c),v[i]+F(i-1,c-w[i]))
+ *
+ * 空间优化:
+ *
+ *
+ * @param w 每个商品对应的重量
+ * @param v 每个商品对应的价值
+ * @param c 背包容量
+ * @return int 最大价值
+ */
+ public int knapsack01(int[] w, int[] v, int c) {
+ int n = w.length;
+ if (n == 0) {
+ return 0;
+ }
+
+ int[] dp = new int[c + 1];
+
+ // 初始化第一行
+ for (int i = 0; i <= c; i++) {
+ dp[i] = i >= w[0] ? v[0] : 0;
+ }
+
+ // 外循环,当前可选商品
+ for (int i = 1; i < n; i++) {
+ // 内循环,当前可用背包大小
+ for (int j = c; j >= w[i]; j--) {
+ // 不考虑当前商品 vs 当前商品+剩余容量时剩下商品
+ dp[j] = Math.max(dp[j], v[i] + dp[j - w[i]]);
+ }
+ }
+
+ return dp[c];
+ }
+
+ /**
+ * 容量为:5
+ * 三个物品:
+ * w 1 2 3
+ * v 6 10 12
+ *
+ * 最大价值22
+ */
+ public static void main(String[] args) {
+ int[] w = new int[]{1, 2, 3};
+ int[] v = new int[]{6, 10, 12};
+ int capacity = 5;
+ System.out.println(new Solution5().knapsack01(w, v, capacity));
+ }
+}
diff --git a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/knapsack01.md b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/knapsack01.md
new file mode 100644
index 00000000..7431ee35
--- /dev/null
+++ b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/knapsack01/knapsack01.md
@@ -0,0 +1,15 @@
+| id | 0 | 1 | 2 |
+| ------ | ---- | ---- | ---- |
+| weight | 1 | 2 | 3 |
+| value | 6 | 10 | 12 |
+
+
+
+
+
+| 物品编号\背包容量 | 0 | 1 | 2 | 3 | 4 | 5 |
+|-----------| ---- | ---- | ---- | ---- | ---- | ---- |
+| 0 | 0 | 6 | 6 | 6 | 6 | 6 |
+| 1 | 0 | 6 | 10 | 16 | 16 | 16 |
+| 2 | 0 | 6 | 10 | 16 | 18 | 22 |
+
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/README.md" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/README.md"
new file mode 100644
index 00000000..68f2ea3d
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/README.md"
@@ -0,0 +1 @@
+https://leetcode-cn.com/problems/triangle/solution/javadong-tai-gui-hua-si-lu-yi-ji-dai-ma-shi-xian-b/
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..a2ac0362
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,82 @@
+package cn.lastwhisper.leetcode.dynamic.三角形最小路径和_120_中等;
+
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.array.ArrayUtil.createList;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/triangle/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——自顶向下
+ * triangle={
+ * [2],
+ * [3,4],
+ * [6,5,7],
+ * [4,1,8,3]
+ * }
+ * 1、状态定义:dp[i][j]表示包含第i行第j列元素的最小路径和
+ * 2、状态分析
+ * 初始化:
+ * dp[0][0]=triangle[0][0]
+ * 常规:
+ * triangle[i][j]一定会经过triangle[i-1][j]或者triangle[i-1][j-1]
+ * 所以状态dp[i][j]一定等于dp[i-1][j]或者dp[i-1][j-1]的最小值+triangle[i][j]
+ * 特殊:
+ * triangle[i][0]没有左上角 只能从triangle[i-1][j]经过
+ * triangle[i][row[0].length]没有上面 只能从triangle[i-1][j-1]经过
+ * 3、转换方程:dp[i][j]=min(dp[i-1][j],dp[i-1][j-1])+triangle[i][j]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public int minimumTotal(List> triangle) {
+ // 特判
+ if (triangle == null || triangle.size() == 0) {
+ return 0;
+ }
+
+ int row = triangle.size();
+ int column = triangle.get(row - 1).size();
+
+ int[][] dp = new int[row][column];
+ dp[0][0] = triangle.get(0).get(0);
+
+ for (int i = 1; i < row; i++) {
+ //对每一行的元素进行最小路径和推导
+ List rows = triangle.get(i);
+ for (int j = 0; j <= i; j++) {
+ if (j == 0) {
+ // 最左端特殊处理
+ dp[i][j] = dp[i - 1][j] + rows.get(j);
+ } else if (j == i) {
+ // 最右端特殊处理
+ dp[i][j] = dp[i - 1][j - 1] + rows.get(j);
+ } else {
+ dp[i][j] = Math.min(dp[i - 1][j], dp[i - 1][j - 1]) + rows.get(j);
+ }
+ }
+ }
+
+ int res = Integer.MAX_VALUE;
+ // dp最后一行记录了最小路径
+ for (int i = 0; i < column; i++) {
+ res = Math.min(res, dp[row - 1][i]);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[][] arrays = new int[][]{
+ {2},
+ {3, 4},
+ {6, 5, 7},
+ {4, 1, 8, 3}
+ };
+ //int[][] arrays = new int[][]{{-10}};
+ List> triangle = createList(arrays);
+ System.err.println(new Solution1().minimumTotal(triangle));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..3a96c641
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,69 @@
+package cn.lastwhisper.leetcode.dynamic.三角形最小路径和_120_中等;
+
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.array.ArrayUtil.createList;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/triangle/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——基于思路一
+ * 空间优化:
+ * prev暂存dp[i-1][j-1],cur暂存dp[i-1][j]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int minimumTotal(List> triangle) {
+ // 特判
+ if (triangle == null || triangle.size() == 0) {
+ return 0;
+ }
+ // dp最大长度==triangle底边长度
+ // 题意:只使用 O(n) 的额外空间(n 为三角形的总行数)
+ int[] dp = new int[triangle.size()];
+ dp[0] = triangle.get(0).get(0);
+
+ // prev暂存dp[i-1][j-1],cur暂存dp[i-1][j]
+ int prev = 0, cur;
+ for (int i = 1; i < triangle.size(); i++) {
+ //对每一行的元素进行推导
+ List rows = triangle.get(i);
+ for (int j = 0; j <= i; j++) {
+ cur = dp[j];
+ if (j == 0) {
+ // 最左端特殊处理
+ dp[j] = cur + rows.get(j);
+ } else if (j == i) {
+ // 最右端特殊处理
+ dp[j] = prev + rows.get(j);
+ } else {
+ dp[j] = Math.min(cur, prev) + rows.get(j);
+ }
+ prev = cur;
+ }
+ }
+
+ int res = Integer.MAX_VALUE;
+ // dp最后一行记录了最小路径
+ for (int i = 0; i < triangle.size(); i++) {
+ res = Math.min(res, dp[i]);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[][] arrays = new int[][]{
+ {2},
+ {3, 4},
+ {6, 5, 7},
+ {4, 1, 8, 3}
+ };
+ //int[][] arrays = new int[][]{{-10}};
+ List> triangle = createList(arrays);
+ System.err.println(new Solution2().minimumTotal(triangle));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..912548cd
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,61 @@
+package cn.lastwhisper.leetcode.dynamic.三角形最小路径和_120_中等;
+
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.array.ArrayUtil.createList;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/triangle/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——自底向上
+ * triangle={
+ * [2],
+ * [3,4],
+ * [6,5,7],
+ * [4,1,8,3]
+ * }
+ * 1、状态定义:dp[i][j]表示包含第i行第j列元素的最小路径和
+ * 2、状态分析
+ * 初始化:
+ * dp[n]=triangle[n]
+ * 常规:
+ * triangle[i][j]一定会到达triangle[i+1][j]或者triangle[i+1][j+1]
+ * 所以状态dp[i][j]一定等于dp[i+1][j]或者dp[i+1][j+1]的最小值+triangle[i][j]
+ * 3、转换方程:dp[i][j]=min(dp[i+1][j],dp[i+1][j+1])+triangle[i][j]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public int minimumTotal(List> triangle) {
+ // 特判
+ if (triangle == null || triangle.size() == 0) {
+ return 0;
+ }
+ // 加1可以不用初始化最后一行
+ // 根据题意,行列值相同
+ int[][] dp = new int[triangle.size() + 1][triangle.size() + 1];
+
+ for (int i = triangle.size() - 1; i >= 0; i--) {
+ List rows = triangle.get(i);
+ for (int j = 0; j < rows.size(); j++) {
+ dp[i][j] = Math.min(dp[i + 1][j], dp[i + 1][j + 1]) + rows.get(j);
+ }
+ }
+ return dp[0][0];
+ }
+
+ public static void main(String[] args) {
+ int[][] arrays = new int[][]{
+ {2},
+ {3, 4},
+ {6, 5, 7},
+ {4, 1, 8, 3}
+ };
+ //int[][] arrays = new int[][]{{-10}};
+ List> triangle = createList(arrays);
+ System.err.println(new Solution3().minimumTotal(triangle));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution4.java"
new file mode 100644
index 00000000..d71d3786
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\211\350\247\222\345\275\242\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_120_\344\270\255\347\255\211/Solution4.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.dynamic.三角形最小路径和_120_中等;
+
+import java.util.List;
+
+import static cn.lastwhisper.leetcode.common.array.ArrayUtil.createList;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/triangle/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——基于思路三
+ * 空间优化:
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int minimumTotal(List> triangle) {
+ // 特判
+ if (triangle == null || triangle.size() == 0) {
+ return 0;
+ }
+ // dp中记录了求第i行时,第i+1的最小路径和
+ int[] dp = new int[triangle.size() + 1];
+
+ for (int i = triangle.size() - 1; i >= 0; i--) {
+ List rows = triangle.get(i);
+ for (int j = 0; j < rows.size(); j++) {
+ dp[j] = Math.min(dp[j], dp[j + 1]) + rows.get(j);
+ }
+ }
+ return dp[0];
+ }
+
+ public static void main(String[] args) {
+ int[][] arrays = new int[][]{
+ {2},
+ {3, 4},
+ {6, 5, 7},
+ {4, 1, 8, 3}
+ };
+ //int[][] arrays = new int[][]{{-10}};
+ List> triangle = createList(arrays);
+ System.err.println(new Solution4().minimumTotal(triangle));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..6b1d84f6
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.dynamic.不同路径II_63_中等;
+
+class Solution1 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/unique-paths-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private int m, n;
+ private int[][] dir = {{0, 1}, {1, 0}};
+ public int uniquePathsWithObstacles(int[][] obstacleGrid) {
+ if (obstacleGrid[0][0] == 1) {
+ return 0;
+ }
+ m = obstacleGrid.length;
+ n = obstacleGrid[0].length;
+ return findPath(obstacleGrid, 0, 0);
+ }
+
+ private int findPath(int[][] grid, int startX, int startY) {
+ if (m - 1 == startX && n - 1 == startY) {
+ return 1;
+ }
+ int result = 0;
+ for (int i = 0; i < dir.length; i++) {
+ int newX = startX + dir[i][0];
+ int newY = startY + dir[i][1];
+ if (isValid(newX, newY, grid)) {
+ result += findPath(grid, newX, newY);
+ }
+ }
+ return result;
+ }
+
+ private boolean isValid(int x, int y, int[][] grid) {
+ return x < m && y < n && grid[x][y] != 1;
+ }
+
+ public static void main(String[] args) {
+ //int[][] obstacleGrid = {
+ // {0, 0, 0},
+ // {0, 1, 0},
+ // {0, 0, 0}
+ //};
+ int[][] obstacleGrid = {
+ {1},
+ };
+ System.out.println(new Solution1().uniquePathsWithObstacles(obstacleGrid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..3f67aad1
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204II_63_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,46 @@
+package cn.lastwhisper.leetcode.dynamic.不同路径II_63_中等;
+
+class Solution2 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/unique-paths-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int uniquePathsWithObstacles(int[][] obstacleGrid) {
+ if (obstacleGrid[0][0] == 1) {
+ return 0;
+ }
+ int m = obstacleGrid.length, n = obstacleGrid[0].length;
+ int[][] dp = new int[m][n];
+ dp[0][0] = 1;
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ if (obstacleGrid[i][j] == 1)
+ continue;
+ if (i >= 1)
+ dp[i][j] = dp[i][j] + dp[i - 1][j];
+ if (j >= 1)
+ dp[i][j] = dp[i][j] + dp[i][j - 1];
+ }
+ }
+ return dp[m - 1][n - 1];
+ }
+
+ public static void main(String[] args) {
+ int[][] obstacleGrid = {
+ {0, 0, 0},
+ {0, 1, 0},
+ {0, 0, 0}
+ };
+ //int[][] obstacleGrid = {
+ // {1},
+ //};
+ System.out.println(new Solution2().uniquePathsWithObstacles(obstacleGrid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..fd1374c2
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,27 @@
+package cn.lastwhisper.leetcode.dynamic.不同路径_62_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归(自顶向下)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public int uniquePaths(int m, int n) {
+ // m==1||n==1时,只剩下一条路可走,直接返回1
+ if (m == 1 || n == 1) {
+ return 1;
+ }
+ // 向右走+向下走
+ return uniquePaths(m - 1, n) + uniquePaths(m, n - 1);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().uniquePaths(7, 3));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..31e2a3a9
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\270\215\345\220\214\350\267\257\345\276\204_62_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.dynamic.不同路径_62_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 每个位置的路径 = 该位置左边的路径 + 该位置上边的路径
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int uniquePaths(int m, int n) {
+ int[][] dp = new int[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ // 到达[0,1]、[1,0]只有一步
+ if (i == 0 || j == 0) {
+ dp[i][j] = 1;
+ } else {
+ // 每个位置的路径 = 该位置左边的路径 + 该位置上边的路径
+ dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
+ }
+ }
+ }
+ return dp[m - 1][n - 1];
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().uniquePaths(7, 3));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..5e0b6bfa
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.dynamic.买卖股票的最佳时机_121_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int maxProfit(int[] prices) {
+ int max = 0;
+ for (int i = prices.length - 1; i > 0; i--) {
+ for (int j = i - 1; j >= 0; j--) {
+ int profit = prices[i] - prices[j];
+ if (profit > max) {
+ max = profit;
+ }
+ }
+ }
+ return max;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = new int[]{7, 1, 5, 3, 6, 4};
+ int[] nums = new int[]{7, 6, 4, 3, 1};
+ System.out.println(new Solution1().maxProfit(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..3e8bbf5d
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272_121_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,33 @@
+package cn.lastwhisper.leetcode.dynamic.买卖股票的最佳时机_121_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int maxProfit(int[] prices) {
+ if (prices == null || prices.length <= 1) {
+ return 0;
+ }
+ // 前i天的最大收益 = max{前i-1天的最大收益,第i天的价格-前i-1天中的最小价格}
+ // min是前i-1天中的最小价格,前i-1天的最大收益
+ int min = prices[0], max = 0;
+ for (int i = 1; i < prices.length; i++) {
+ max = Math.max(max, prices[i] - min);
+ min = Math.min(min, prices[i]);
+ }
+ return max;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = new int[]{7, 1, 5, 3, 6, 4};
+ //int[] nums = new int[]{7, 6, 4, 3, 1};
+ System.out.println(new Solution2().maxProfit(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/416.md" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/416.md"
new file mode 100644
index 00000000..6661c76c
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/416.md"
@@ -0,0 +1,23 @@
+背包容量sum/2,数组中的值是物品的重量。
+
+状态定义:`dp[i][j]`表示从数组的 `[0, i]` 这个子区间内挑选一些正整数,每个数只能用一次,使得这些数的和**恰好等于** `j`。
+
+1. 不选择 `nums[i]`,如果在`[0, i - 1]` 这个子区间内已经有一部分元素,使得它们的和为 j ,那么 `dp[i][j] = true`;
+
+2. 选择 `nums[i]`,如果在 `[0, i - 1]` 这个子区间内就得找到一部分元素,使得它们的和为 `j - nums[i]`。
+
+状态转移方程是:
+
+```
+dp[i][j]=dp[i-1][j] or dp[i][j-num[i]]
+```
+
+
+
+| | (i,j) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
+| ---- | ------ | ----- | ----- | ---- | ---- | ---- | ----- | ----- | ---- | ---- | ---- | ----- | ----- |
+| 1 | num[0] | **T** | **T** | F | F | F | F | F | F | F | F | F | F |
+| 5 | num[1] | **T** | **T** | F | F | F | **T** | **T** | F | F | F | F | F |
+| 11 | num[2] | **T** | **T** | F | F | F | **T** | **T** | F | F | F | F | **T** |
+| 5 | num[3] | **T** | **T** | F | F | F | **T** | **T** | F | F | F | **T** | **T** |
+
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..14a445b7
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.dynamic.分割等和子集_416_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-equal-subset-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 背包问题,在n个物品中选出一定物品,填满sum/2的背包
+ * 1、状态定义;
+ * 2、状态转移方程;
+ * 3、初始化;
+ * 4、输出;
+ * 5、思考状态压缩
+ * F(n,c)考虑将n个物品填满容量为c的背包
+ * F(i,c) = F(i-1,c)||F(i-1,c-w(i))
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*sum/2)
+ * 空间复杂度:O(n*sum/2)
+ */
+ public boolean canPartition(int[] nums) {
+ int sum = 0;
+ for (int num : nums) {
+ sum += num;
+ }
+ if (sum % 2 != 0) {
+ return false;
+ }
+
+ return tryPartition(nums, nums.length - 1, sum / 2);
+ }
+
+ // 使用nums[0,index],是否可以完全填充一个容量为sum的背包
+ private boolean tryPartition(int[] nums, int index, int sum) {
+ if (sum == 0) {
+ return true;
+ }
+ if (index < 0 || sum < 0) {
+ return false;
+ }
+
+ return tryPartition(nums, index - 1, sum) || tryPartition(nums, index - 1, sum - nums[index]);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().canPartition(new int[]{1, 5, 11, 5}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..1c7cb54b
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,59 @@
+package cn.lastwhisper.leetcode.dynamic.分割等和子集_416_中等;
+
+import java.util.Arrays;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-equal-subset-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 背包问题,在n个物品中选出一定物品,填满sum/2的背包
+ * 1、状态定义;
+ * 2、状态转移方程;
+ * 3、初始化;
+ * 4、输出;
+ * 5、思考状态压缩
+ * F(n,c)考虑将n个物品填满容量为c的背包
+ * F(i,c) = F(i-1,c)||F(i-1,c-w(i))
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*sum/2)
+ * 空间复杂度:
+ */
+ public boolean canPartition(int[] nums) {
+ int sum = 0;
+ for (int num : nums) {
+ sum += num;
+ }
+ if (sum % 2 != 0) {
+ return false;
+ }
+ // -1未存储;0 false;1 true
+ int[][] memo = new int[nums.length][sum / 2 + 1];
+ for (int[] ints : memo) {
+ Arrays.fill(ints, -1);
+ }
+ return tryPartition(nums, nums.length - 1, sum / 2, memo);
+ }
+
+ // 使用nums[0,index],是否可以完全填充一个容量为sum的背包
+ private boolean tryPartition(int[] nums, int index, int sum, int[][] memo) {
+ if (sum == 0) {
+ return true;
+ }
+ if (index < 0 || sum < 0) {
+ return false;
+ }
+ if (memo[index][sum] != -1) {
+ return memo[index][sum] == 1;
+ }
+ memo[index][sum] = (tryPartition(nums, index - 1, sum, memo) ||
+ tryPartition(nums, index - 1, sum - nums[index], memo)) ? 1 : 0;
+ return memo[index][sum] == 1;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().canPartition(new int[]{1, 5, 11, 5}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..3e7c3b95
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,62 @@
+package cn.lastwhisper.leetcode.dynamic.分割等和子集_416_中等;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-equal-subset-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 背包问题,在n个物品中选出一定物品,填满sum/2的背包
+ * dp[i][j]考虑将i个物品填满容量为j的背包
+ * dp[i][j]=dp[i-1][j] or dp[i][j-num[i]]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(NC):这里 N 是数组元素的个数,C 是数组元素的和的一半。
+ * 空间复杂度:O(NC)
+ */
+ public boolean canPartition(int[] nums) {
+ int len = nums.length;
+ if (len == 0) {
+ return false;
+ }
+
+ int sum = 0;
+ for (int num : nums) {
+ sum += num;
+ }
+ // 特判:如果是奇数,就不符合要求
+ if (sum % 2 != 0) {
+ return false;
+ }
+ int target = sum / 2;
+
+ // 创建二维状态数组,行:物品索引,列:容量(包括 0)
+ boolean[][] dp = new boolean[len][target + 1];
+
+ // 先填表格第 0 行,第 1 个数只能让容积为它自己的背包恰好装满
+ if (nums[0] <= target) {
+ dp[0][nums[0]] = true;
+ }
+
+ // 外循环是物品
+ for (int i = 1; i < len; i++) {
+ // 内循环是容量
+ for (int j = 0; j <= target; j++) {
+ // 第i个物品重量num[i]刚好够,背包容量j
+ if (nums[i] == j) {
+ dp[i][j] = true;
+ } else if (nums[i] < j) {
+ dp[i][j] = dp[i - 1][j] || dp[i - 1][j - nums[i]];
+ } else {
+ dp[i][j] = dp[i - 1][j];
+ }
+ }
+ }
+ return dp[len - 1][target];
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().canPartition(new int[]{1, 2, 5}));
+ //System.out.println(new Solution3().canPartition(new int[]{1, 5, 11, 5}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution4.java"
new file mode 100644
index 00000000..38c83b99
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206_416_\344\270\255\347\255\211/Solution4.java"
@@ -0,0 +1,60 @@
+package cn.lastwhisper.leetcode.dynamic.分割等和子集_416_中等;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/partition-equal-subset-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 动态规划:
+ * 背包问题,在n个物品中选出一定物品,填满sum/2的背包
+ * dp[i][j]考虑将i个物品填满容量为j的背包
+ * dp[i][j]=dp[i-1][j] or dp[i][j-num[i]]
+ * 时间优化:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(NC):这里 N 是数组元素的个数,C 是数组元素的和的一半。
+ * 空间复杂度:O(C)
+ */
+ public boolean canPartition(int[] nums) {
+ int len = nums.length;
+ if (len == 0) {
+ return false;
+ }
+
+ int sum = 0;
+ for (int num : nums) {
+ sum += num;
+ }
+ // 特判:如果是奇数,就不符合要求
+ if (sum % 2 != 0) {
+ return false;
+ }
+ int target = sum / 2;
+
+ // 创建二维状态数组,行:物品索引,列:容量(包括 0)
+ boolean[] dp = new boolean[target + 1];
+
+ // 先填表格第 0 行,第 1 个数只能让容积为它自己的背包恰好装满
+ if (nums[0] <= target) {
+ dp[nums[0]] = true;
+ }
+
+ // 外循环是物品
+ for (int i = 1; i < len; i++) {
+ // 内循环是容量
+ for (int j = target; j >= nums[i]; j--) {
+ if (dp[target]) {
+ return true;
+ }
+ dp[j] = dp[j] || dp[j - nums[i]];
+ }
+ }
+ return dp[target];
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution4().canPartition(new int[]{1, 2, 5}));
+ //System.out.println(new Solution3().canPartition(new int[]{1, 5, 11, 5}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..4fb45d2c
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,53 @@
+package cn.lastwhisper.leetcode.dynamic.完全平方数_279_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/perfect-squares/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 四平方定理:每个正整数均可表为四个整数的平方和(其中有些整数可以为零),满足n=(4^a)*(8b+7)
+ * 1、任何正整数都可以拆分成不超过4个数的平方和 ---> 答案只可能是1,2,3,4
+ * 2、如果一个数正好可以拆成4个数的平方和,则这个数还满足 n = (4^a)*(8b+7) --->
+ * 因此可以先看这个数是否满足上述公式,如果不满足,答案就是1,2,3了
+ * 3、如果这个数本来就是某个数的平方,那么答案就是1,否则答案就只剩2,3了
+ * 4、如果答案是2,即n=a^2+b^2,那么我们可以枚举a,来验证,如果验证通过则答案是2
+ * 5、只能是3
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int numSquares(int n) {
+ // 1、如果n可以拆成四个数的平方,n=(4^a)*(8b+7)
+ while (n % 4 == 0) {
+ n /= 4;
+ }
+ if (n % 8 == 7) {
+ return 4;
+ }
+ /*
+ * 2、如果n本来就是某个数的平方,那么答案就是1
+ * 3、如果答案是2,即n=a^2+b^2,那么我们可以枚举a,来验证,如果验证通过则答案是2
+ */
+ int a = 0,b;
+ while ((a * a) < n) {
+ b = (int) Math.sqrt(n - (a * a));
+ if ((a * a) + (b * b) == n) {
+ if (a != 0 && b != 0) {
+ return 2;
+ } else {
+ return 1;
+ }
+ }
+ a++;
+ }
+ // 4、否则为3
+ return 3;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().numSquares(12));
+ System.out.println(new Solution1().numSquares(13));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..171df1c6
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.dynamic.完全平方数_279_中等;
+
+import javafx.util.Pair;
+
+import java.util.LinkedList;
+
+/**
+ * 题目地址:https://leetcode-cn.com/problems/perfect-squares/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * 图,使用visited数组,记录每一个入队元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+public class Solution2 {
+
+ public int numSquares(int n) {
+
+ LinkedList> queue = new LinkedList>();
+ queue.addLast(new Pair(n, 0));
+
+ boolean[] visited = new boolean[n + 1];
+ visited[n] = true;
+
+ while (!queue.isEmpty()) {
+ Pair front = queue.removeFirst();
+ int num = front.getKey();
+ int step = front.getValue();
+
+ if (num == 0)
+ return step;
+
+ for (int i = 1; num - i * i >= 0; i++)
+ if (!visited[num - i * i]) {
+ queue.addLast(new Pair<>(num - i * i, step + 1));
+ visited[num - i * i] = true;
+ }
+ }
+
+ throw new IllegalStateException("No Solution.");
+ }
+
+ public static void main(String[] args) {
+
+ System.out.println((new Solution2()).numSquares(12));
+ System.out.println((new Solution2()).numSquares(13));
+ }
+}
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..7b63b225
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260_279_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,23 @@
+package cn.lastwhisper.leetcode.dynamic.完全平方数_279_中等;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/perfect-squares/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:01背包
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int numSquares(int n) {
+
+ return 3;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().numSquares(12));
+ System.out.println(new Solution3().numSquares(13));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\210\263\346\260\224\347\220\203_312_\345\233\260\351\232\276/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\210\263\346\260\224\347\220\203_312_\345\233\260\351\232\276/Solution1.java"
new file mode 100644
index 00000000..3b134cab
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\210\263\346\260\224\347\220\203_312_\345\233\260\351\232\276/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.dynamic.戳气球_312_困难;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+class Solution1 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/burst-balloons/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归回溯
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n!)
+ * 空间复杂度:O(n!)
+ */
+ public int maxCoins(int[] nums) {
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ List arrayList = Arrays.stream(nums)
+ .boxed()
+ .collect(Collectors.toList());
+ return helper(arrayList, 0);
+ }
+
+ private int helper(List nums, int coins) {
+ if (nums.size() == 0) {
+ return coins;
+ }
+ int res = 0;
+ for (int i = 0; i < nums.size(); i++) {
+ int tmp = nums.get(i);
+ int delta = nums.get(i)
+ * (i - 1 < 0 ? 1 : nums.get(i - 1))
+ * (i + 1 > nums.size() - 1 ? 1 : nums.get(i + 1));
+ nums.remove(i);
+ res = Math.max(res, helper(nums, coins + delta));
+ nums.add(i, tmp);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(167, new Solution1().maxCoins(new int[]{3, 1, 5, 8}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..2debb5d8
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,50 @@
+package cn.lastwhisper.leetcode.dynamic.打家劫舍_198_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/house-robber/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 1、状态定义:dp[i]表示偷到至第i个房子,所获取最大的利益
+ * 2、状态分析
+ * 初始:
+ * dp[0] = nums[0];
+ * dp[1] = Math.max(nums[0], nums[1])
+ * 方程:
+ * dp[i]=max(dp[i-2]+num[i],dp[i-1])
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int rob(int[] nums) {
+ // 特判
+ if (nums == null || nums.length == 0) {
+ return 0;
+ }
+ if (nums.length == 1) {
+ return nums[0];
+ }
+ if (nums.length == 2) {
+ return Math.max(nums[0], nums[1]);
+ }
+
+ int[] dp = new int[nums.length];
+ dp[0] = nums[0];
+ dp[1] = Math.max(nums[0], nums[1]);
+
+ for (int i = 2; i < nums.length; i++) {
+ dp[i] = Math.max(dp[i - 2] + nums[i], dp[i - 1]);
+ }
+
+ return dp[nums.length - 1];
+ }
+
+ public static void main(String[] args) {
+ int[] array = new int[]{2, 1, 1, 2};
+ //int[] array = new int[]{2, 7, 9, 3, 1};
+ //int[] array = new int[]{1, 2, 3, 1};
+ System.out.println(new Solution1().rob(array));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..0992ccf8
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.dynamic.打家劫舍_198_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/house-robber/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int rob(int[] nums) {
+ int n = nums.length;
+ if (n == 0) {
+ return 0;
+ }
+ // memo[i] 表示考虑抢劫 nums[i...n-1] 所能获得最大收益(不是说一定从 i 开始抢劫)
+ int[] memo = new int[n];
+ // 先考虑最简单的情况
+ memo[n - 1] = nums[n - 1];
+ for (int i = n - 2; i >= 0; i--) {
+ // memo[i] 的取值在考虑抢劫 i 号房子和不考虑抢劫之间取最大值
+ for (int j = i; j < n; j++) {
+ memo[i] = Math.max(memo[i], nums[j] + (j + 2 < n ? memo[j + 2] : 0));
+ }
+ }
+
+ return memo[0];
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().rob(new int[]{2, 1, 1, 2}));
+ System.out.println(new Solution2().rob(new int[]{2, 7, 9, 3, 1}));
+ System.out.println(new Solution2().rob(new int[]{1, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution1.java"
new file mode 100644
index 00000000..9a0af284
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution1.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.dynamic.打家劫舍_198_简单.recursion;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/house-robber/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:O()
+ * 空间复杂度:O()
+ */
+ public int rob(int[] nums) {
+ return tryRob(0, nums);
+ }
+
+ public int tryRob(int index, int[] nums) {
+ if (index >= nums.length) {
+ return 0;
+ }
+ int max = 0, res;
+ for (int i = index; i < nums.length; i++) {
+ res = nums[i] + tryRob(i + 2, nums);
+ max = Math.max(max, res);
+ System.out.println("max:" + max + " res:" + res);
+ }
+
+ return max;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().rob(new int[]{2, 1, 1, 2}));
+// System.out.println(new Solution1().rob(new int[]{2, 7, 9, 3, 1}));
+ //System.out.println(new Solution1().rob(new int[]{1, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution2.java"
new file mode 100644
index 00000000..30025c16
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\211\223\345\256\266\345\212\253\350\210\215_198_\347\256\200\345\215\225/recursion/Solution2.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.dynamic.打家劫舍_198_简单.recursion;
+
+import java.util.Arrays;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/house-robber/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归+备忘录
+ * 状态:考虑抢劫 nums[index...num.length) 这个范围内的所有房子
+ * 状态转移:tryRob(n) = Max{rob(0) + tryRob(2), rob(1) + tryRob(3)... rob(n-3) + tryRob(n-1), rob(n-2), rob(n-1)}
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int rob(int[] nums) {
+ int[] memo = new int[nums.length];
+ // 必须先初始化为-1,有特殊用例
+ Arrays.fill(memo, -1);
+ return tryRob(0, nums, memo);
+ }
+
+ public int tryRob(int index, int[] nums, int[] memo) {
+ if (index >= nums.length) {
+ return 0;
+ }
+ if (memo[index] != -1) {
+ return memo[index];
+ }
+ int max = 0;
+ for (int i = index; i < nums.length; i++) {
+ max = Math.max(max, nums[i] + tryRob(i + 2, nums, memo));
+ }
+ memo[index] = max;
+ return max;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().rob(new int[]{2, 1, 1, 2}));
+ System.out.println(new Solution1().rob(new int[]{2, 7, 9, 3, 1}));
+ System.out.println(new Solution2().rob(new int[]{1, 2, 3, 1}));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..f8da2c87
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.dynamic.整数拆分_343_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/integer-break/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:树形递归+回溯(28超时)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private int max = 0;
+
+ public int integerBreak(int n) {
+ dfs(n, n, 1);
+ return max;
+ }
+
+ private void dfs(int n, int temp, int result) {
+ if (temp == 0) {
+ max = Math.max(max, result);
+ }
+ // 至少拆分出1,至多拆分出n-1
+ // temp-i >= 0(剪枝)、i < n(剪枝)
+ for (int i = 1; temp - i >= 0 && i < n; i++) {
+ temp = temp - i;
+ result = result * i;
+ dfs(n, temp, result);
+ temp = temp + i;
+ result = result / i;
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().integerBreak(2));//1
+ System.out.println(new Solution1().integerBreak(3));//2
+ //System.out.println(new Solution1().integerBreak(10));//36
+ //System.out.println(new Solution1().integerBreak(27));//19683
+ //System.out.println(new Solution1().integerBreak(28));//26244
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..2258f9c5
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.dynamic.整数拆分_343_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/integer-break/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:树形递归
+ * n拆分最大乘积 f(n)=max(1*(n-1),2*(n-2),...(n-1)*1)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^n)
+ * 空间复杂度:O(n)
+ */
+ public int integerBreak(int n) {
+ return dfs(n);
+ }
+
+ private int dfs(int n) {
+ if (n == 1) {
+ return 1;
+ }
+ int result = -1;
+ for (int i = 1; i < n; i++) {
+ result = Math.max(result, Math.max(i * (n - i), i * dfs(n - i)));
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().integerBreak(2));//1
+ System.out.println(new Solution2().integerBreak(3));//2
+ System.out.println(new Solution2().integerBreak(10));//36
+ System.out.println(new Solution2().integerBreak(27));//19683
+ System.out.println(new Solution2().integerBreak(28));//26244
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..e75e52ac
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.dynamic.整数拆分_343_中等;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/integer-break/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:树形递归——记忆化搜索
+ * n拆分最大乘积 f(n)=max(1*(n-1),2*(n-2),...(n-1)*1)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int integerBreak(int n) {
+ int[] memo = new int[n + 1];
+ return dfs(n, memo);
+ }
+
+ private int dfs(int n, int[] memo) {
+ if (n == 1) {
+ return 1;
+ }
+ if (memo[n] != 0) {
+ return memo[n];
+ }
+ int result = -1;
+ for (int i = 1; i < n; i++) {
+ // 分解成i、n-i;
+ result = Math.max(result, Math.max(i * (n - i), i * dfs(n - i, memo)));
+ }
+ memo[n] = result;
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().integerBreak(2));//1
+ System.out.println(new Solution3().integerBreak(3));//2
+ System.out.println(new Solution3().integerBreak(10));//36
+ System.out.println(new Solution3().integerBreak(27));//19683
+ System.out.println(new Solution3().integerBreak(28));//26244
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution4.java"
new file mode 100644
index 00000000..516a254c
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\225\264\346\225\260\346\213\206\345\210\206_343_\344\270\255\347\255\211/Solution4.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.dynamic.整数拆分_343_中等;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/integer-break/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int integerBreak(int n) {
+ int[] memo = new int[n + 1];
+ memo[1] = 1;
+ for (int i = 2; i <= n; i++) {
+ for (int j = 1; j < i; j++) {
+ memo[i] = Math.max(memo[i], Math.max(j * (i - j), j * memo[i - j]));
+ }
+ }
+ return memo[n];
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution4().integerBreak(2));//1
+ System.out.println(new Solution4().integerBreak(3));//2
+ System.out.println(new Solution4().integerBreak(10));//36
+ System.out.println(new Solution4().integerBreak(27));//19683
+ System.out.println(new Solution4().integerBreak(28));//26244
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..6099ecaf
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,28 @@
+package cn.lastwhisper.leetcode.dynamic.斐波那契数_509_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归(自顶向下)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int fib(int N) {
+ if (N == 0) {
+ return 0;
+ }
+ if (N == 1) {
+ return 1;
+ }
+
+ return fib(N - 1) + fib(N - 2);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().fib(3));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..f3f1d81a
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,38 @@
+package cn.lastwhisper.leetcode.dynamic.斐波那契数_509_简单;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归+记忆化搜索(自顶向下)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private Map map = new HashMap<>();
+
+ public int fib(int N) {
+ if (N == 0) {
+ return 0;
+ }
+ if (N == 1) {
+ return 1;
+ }
+
+ Integer result = map.getOrDefault(N, -1);
+ if (result == -1) {
+ result = fib(N - 1) + fib(N - 2);
+ map.put(N, result);
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().fib(10));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..da2b0339
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.dynamic.斐波那契数_509_简单;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划(自底向上)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int fib(int N) {
+ if (N < 2) {
+ return N;
+ }
+ int[] arr = new int[N + 1];
+ arr[0] = 0;
+ arr[1] = 1;
+
+ for (int i = 2; i <= N; i++) {
+ arr[i] = arr[i - 1] + arr[i - 2];
+ }
+ return arr[N];
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().fib(2));//1
+ System.out.println(new Solution3().fib(10));//55
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..ab5d3653
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,31 @@
+package cn.lastwhisper.leetcode.dynamic.斐波那契数_509_简单;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划(自底向上)的另一种写法
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int fib(int N) {
+ if (N < 2) return N;
+ int item1 = 0;
+ int item2 = 1;
+ int sum = 0;
+ for (int i = 2; i <= N; i++) {
+ sum = item1 + item2;
+ item1 = item2;
+ item2 = sum;
+ }
+ return sum;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution4().fib(2));
+ System.out.println(new Solution4().fib(10));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution5.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution5.java"
new file mode 100644
index 00000000..a1a6692d
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260_509_\347\256\200\345\215\225/Solution5.java"
@@ -0,0 +1,29 @@
+package cn.lastwhisper.leetcode.dynamic.斐波那契数_509_简单;
+
+class Solution5 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/fibonacci-number/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:尾递归(自底向上)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public int fib(int n) {
+ return fib(n, 0, 1);
+ }
+
+ // 第n个斐波那契,初始两个值0、1
+ private int fib(int n, int rt1, int rt2) {
+ return n == 0 ? rt1 : fib(n - 1, rt2, rt1 + rt2);
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution5().fib(2));
+ System.out.println(new Solution5().fib(10));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/README.md" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/README.md"
new file mode 100644
index 00000000..3ab287da
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/README.md"
@@ -0,0 +1,15 @@
+# 53
+
+**思路:**动态规划
+
+**状态:**dp[i]表示以num[i]为结尾的连续子序列的最大和
+
+**状态转换方程:**dp[i] = Math.max(dp[i - 1] + nums[i], nums[i])
+
+**实例:**
+
+| nums | -2 | 1 | -3 | 4 | -1 | 2 | 1 | -5 | 4 |
+| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
+| dp | -2 | 1 | -2 | 4 | 3 | 5 | `6` | 1 | 5 |
+
+
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..6270648f
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,32 @@
+package cn.lastwhisper.leetcode.dynamic.最大子序和_53_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-subarray/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int maxSubArray(int[] nums) {
+ int res = nums[0];
+ int sum = 0;
+ for (int num : nums) {
+ if (sum > 0) {
+ sum += num;
+ } else {
+ sum = num;
+ }
+ res = Math.max(res, sum);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
+ System.err.println(new Solution1().maxSubArray(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..36c8158e
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,33 @@
+package cn.lastwhisper.leetcode.dynamic.最大子序和_53_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-subarray/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 状态:dp[i]表示以num[i]为结尾的连续子序列的最大和
+ * 状态转换方程:dp[i] = Math.max(dp[i - 1] + nums[i], nums[i])
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public int maxSubArray(int[] nums) {
+ // 初始值
+ int res = nums[0];
+ int[] dp = new int[nums.length];
+ dp[0] = nums[0];
+ for (int i = 1; i < nums.length; i++) {
+ dp[i] = Math.max(dp[i - 1] + nums[i], nums[i]);
+ res = Math.max(res, dp[i]);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
+ System.err.println(new Solution2().maxSubArray(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..e18c979f
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214_53_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,34 @@
+package cn.lastwhisper.leetcode.dynamic.最大子序和_53_简单;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/maximum-subarray/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 状态:dp[i]表示以num[i]为结尾的连续子序列的最大和
+ * 状态转换方程:dp[i] = Math.max(dp[i - 1] + nums[i], nums[i])
+ *
+ * 优化空间:只需要两个变量就可以完成动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int maxSubArray(int[] nums) {
+ // 初始值
+ int res = nums[0];
+ int prev = nums[0], current;
+ for (int i = 1; i < nums.length; i++) {
+ current = Math.max(prev + nums[i], nums[i]);
+ res = Math.max(res, current);
+ prev = current;
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
+ System.err.println(new Solution3().maxSubArray(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..238e1a17
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,66 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——自顶向下
+ * 1、状态定义:dp[i][j]表示包含第i行第j列元素的最小路径和
+ * 2、状态分析
+ * 初始:
+ * dp[0][0]=grid[0][0]
+ * 常规:
+ * grid[i][j]一定会经过grid[i][j-1]或者grid[i-1][j]
+ * 所以状态dp[i][j]一定等于dp[i][j-1]或者dp[i-1][j]的最小值+grid[i][j]
+ * 状态转换方程:
+ * dp[i][j]=min(dp[i][j-1],dp[i-1][j])+grid[i][j]
+ * 特殊:
+ * grid[i][0]没有左边 只能从上边grid[i-1][0]经过
+ * grid[0][j]没有上边 只能从左边grid[0][j-1]经过
+ * 状态转换方程:
+ * dp[i][0]=dp[i-1][0]+grid[i][j]
+ * dp[0][j]=dp[0][j-1]+grid[i][j]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public int minPathSum(int[][] grid) {
+ // 特判
+ if (grid == null || grid.length == 0) {
+ return 0;
+ }
+ int row = grid.length;
+ int column = grid[0].length;
+
+ int[][] dp = new int[row][column];
+ for (int i = 0; i < row; i++) {
+ for (int j = 0; j < column; j++) {
+ if (i == 0 && j == 0) {
+ // 起点
+ dp[0][0] = grid[0][0];
+ } else if (i == 0) {
+ // 从左边来
+ dp[i][j] = dp[i][j - 1] + grid[i][j];
+ } else if (j == 0) {
+ // 从上面来
+ dp[i][j] = dp[i - 1][j] + grid[i][j];
+ } else {
+ dp[i][j] = Math.min(dp[i][j - 1], dp[i - 1][j]) + grid[i][j];
+ }
+ }
+ }
+
+ return dp[row - 1][column - 1];
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution1().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..eb26a680
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,53 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——基于思路二
+ * 空间优化:
+ * 只需要左边和上边的值保存即可,一维数组dp[j]存储上边的值,
+ * dp[j-1]存储左边的值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int minPathSum(int[][] grid) {
+ // 特判
+ if (grid == null || grid.length == 0) {
+ return 0;
+ }
+ int row = grid.length;
+ int column = grid[0].length;
+
+ int[] dp = new int[column];
+ for (int i = 0; i < row; i++) {
+ for (int j = 0; j < column; j++) {
+ if (i == 0 && j == 0) {
+ // 起点
+ dp[0] = grid[0][0];
+ } else if (i == 0) {
+ // 从左边来
+ dp[j] = dp[j - 1] + grid[i][j];
+ } else if (j == 0) {
+ // 从上面来
+ dp[j] = dp[j] + grid[i][j];
+ } else {
+ dp[j] = Math.min(dp[j - 1], dp[j]) + grid[i][j];
+ }
+ }
+ }
+ return dp[column - 1];
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution2().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..fd10d4d6
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,63 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——自底向上
+ * 1、状态定义:dp[i][j]表示包含第i行第j列元素的最小路径和
+ * 2、状态分析
+ * 初始:
+ * dp[m][n]=grid[m][n]
+ * 常规:
+ * grid[i][j]一定会经过grid[i][j+1]或者grid[i+1][j]
+ * 所以状态dp[i][j]一定等于dp[i][j+1]或者dp[i+1][j]的最小值+grid[i][j]
+ * 状态转换方程:
+ * dp[i][j]=min(dp[i][j+1],dp[i+1][j])+grid[i][j]
+ * 特殊:
+ * 矩阵m*n
+ * grid[i][n]没有右边 只能从下边grid[i+1][n]经过
+ * grid[m][j]没有下边 只能从右边grid[m][j+1]经过
+ * 状态转换方程:
+ * dp[i][n]=dp[i+1][n]+grid[i][j]
+ * dp[m][j]=dp[m][j+1]+grid[i][j]
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public int minPathSum(int[][] grid) {
+ // 特判
+ if (grid == null || grid.length == 0) {
+ return 0;
+ }
+ int row = grid.length;
+ int column = grid[0].length;
+
+ int[][] dp = new int[row][column];
+ for (int i = row - 1; i >= 0; i--) {
+ for (int j = column - 1; j >= 0; j--) {
+ if (i == row - 1 && j == column - 1) {
+ dp[i][j] = grid[i][j];
+ } else if (j == column - 1) {
+ dp[i][j] = dp[i + 1][j] + grid[i][j];
+ } else if (i == row - 1) {
+ dp[i][j] = dp[i][j + 1] + grid[i][j];
+ } else {
+ dp[i][j] = Math.min(dp[i + 1][j], dp[i][j + 1]) + grid[i][j];
+ }
+ }
+ }
+ return dp[0][0];
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution3().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution4.java"
new file mode 100644
index 00000000..4f29098e
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/Solution4.java"
@@ -0,0 +1,50 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划——基于思路三
+ * 空间优化:
+ * 只需要左边和上边的值保存即可,一维数组dp[j]存储下边的值,
+ * dp[j+1]存储右边的值
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public int minPathSum(int[][] grid) {
+ // 特判
+ if (grid == null || grid.length == 0) {
+ return 0;
+ }
+ int row = grid.length;
+ int column = grid[0].length;
+
+ int[] dp = new int[column ];
+ for (int i = row - 1; i >= 0; i--) {
+ for (int j = column - 1; j >= 0; j--) {
+ if (i == row - 1 && j == column - 1) {
+ dp[j] = grid[i][j];
+ } else if (j == column - 1) {
+ dp[j] = dp[j] + grid[i][j];
+ } else if (i == row - 1) {
+ dp[j] = dp[j + 1] + grid[i][j];
+ } else {
+ dp[j] = Math.min(dp[j], dp[j + 1]) + grid[i][j];
+ }
+ }
+ }
+ return dp[0];
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution4().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution1.java"
new file mode 100644
index 00000000..5b1fab4e
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution1.java"
@@ -0,0 +1,55 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等.recursion;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private int min=Integer.MAX_VALUE, m, n;
+ private int[][] dir = {{0, 1}, {1, 0}};
+
+ public int minPathSum(int[][] grid) {
+ m = grid.length;
+ n = grid[0].length;
+ findMin(grid, 0, 0, grid[0][0]);
+ return min;
+ }
+
+ /**
+ * 此种递归无法缓存中间值重复使用
+ */
+ private void findMin(int[][] grid, int startX, int startY, int result) {
+ // 终点
+ if (m - 1 == startX && n - 1 == startY) {
+ min = Math.min(min, result);
+ return;
+ }
+ for (int i = 0; i < dir.length; i++) {
+ int newX = startX + dir[i][0];
+ int newY = startY + dir[i][1];
+ // 防止不合法坐标
+ if (isValid(newX, newY)) {
+ findMin(grid, newX, newY, grid[newX][newY] + result);
+ }
+ }
+ }
+
+ private boolean isValid(int x, int y) {
+ return x < m && y < n;
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution1().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution2.java"
new file mode 100644
index 00000000..4650b63c
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution2.java"
@@ -0,0 +1,50 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等.recursion;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private int m, n;
+ private int[][] dir = {{0, 1}, {1, 0}};
+
+ public int minPathSum(int[][] grid) {
+ m = grid.length;
+ n = grid[0].length;
+ return findMin(grid, 0, 0);
+ }
+
+ private int findMin(int[][] grid, int startX, int startY) {
+ if (m - 1 == startX && n - 1 == startY) {
+ return grid[startX][startY];
+ }
+ int result = Integer.MAX_VALUE;
+ for (int i = 0; i < dir.length; i++) {
+ int newX = startX + dir[i][0];
+ int newY = startY + dir[i][1];
+ if (isValid(newX, newY)) {
+ result = Math.min(result, grid[startX][startY] + findMin(grid, newX, newY));
+ }
+ }
+ return result;
+ }
+
+ private boolean isValid(int x, int y) {
+ return x < m && y < n;
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution2().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution3.java"
new file mode 100644
index 00000000..859df4d4
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution3.java"
@@ -0,0 +1,16 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等.recursion;
+
+public class Solution3 {
+ public int calculate(int[][] grid, int i, int j) {
+ // 不合法坐标
+ if (i == grid.length || j == grid[0].length) return Integer.MAX_VALUE;
+ // 终点
+ if (i == grid.length - 1 && j == grid[0].length - 1) return grid[i][j];
+ return grid[i][j] + Math.min(calculate(grid, i + 1, j), calculate(grid, i, j + 1));
+ }
+
+ public int minPathSum(int[][] grid) {
+ return calculate(grid, 0, 0);
+ }
+
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution4.java"
new file mode 100644
index 00000000..42cd5d42
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\345\260\217\350\267\257\345\276\204\345\222\214_64_\344\270\255\347\255\211/recursion/Solution4.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.dynamic.最小路径和_64_中等.recursion;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/minimum-path-sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归+记忆化搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(2^(m+n))。每次移动最多可以有两种选择。
+ * 空间复杂度:O(m+n)。递归的深度是 m+n。
+ */
+ private int m, n;
+ private int[][] dir = {{0, 1}, {1, 0}};
+
+ public int minPathSum(int[][] grid) {
+ m = grid.length;
+ n = grid[0].length;
+ int[][] memo = new int[m][n];
+ return findMin(grid, 0, 0, memo);
+ }
+
+ private int findMin(int[][] grid, int startX, int startY, int[][] memo) {
+ // 终点
+ if (m - 1 == startX && n - 1 == startY) {
+ return grid[startX][startY];
+ }
+ if (memo[startX][startY] != 0) {
+ return memo[startX][startY];
+ }
+ int result = Integer.MAX_VALUE;
+ for (int i = 0; i < dir.length; i++) {
+ int newX = startX + dir[i][0];
+ int newY = startY + dir[i][1];
+ if (isValid(newX, newY)) {
+ result = Math.min(result, grid[startX][startY] + findMin(grid, newX, newY, memo));
+ }
+ }
+ memo[startX][startY] = result;
+ return result;
+ }
+
+ private boolean isValid(int x, int y) {
+ return x < m && y < n;
+ }
+
+ public static void main(String[] args) {
+ int[][] grid = {
+ {1, 3, 1},
+ {1, 5, 1},
+ {4, 2, 1}
+ };
+ System.out.println(new Solution4().minPathSum(grid));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227_300_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227_300_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..58130d3c
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227_300_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.dynamic.最长上升子序列_300_中等;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-increasing-subsequence/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * 状态定义:dp[i]表示以num[i]为结尾的上升子序列
+ * 转换方程:
+ * j∈[0,i]
+ * dp[i]=max(dp[j]+1,dp[i])
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int lengthOfLIS(int[] nums) {
+ if (nums.length == 0) {
+ return 0;
+ }
+ int res = 1;
+ int[] dp = new int[nums.length];
+ Arrays.fill(dp, 1);
+ // j∈[0,i)
+ for (int i = 1; i < nums.length; i++) {
+ // num[i]是否能做num[0,i)中某个数的结尾
+ for (int j = 0; j < i; j++) {
+ if (nums[i] > nums[j]) {
+ // num[i]能以num[j]为结尾,更新dp[i]
+ // 为什么要Math.max(dp[j] + 1, dp[i]),而不是直接dp[j] + 1?
+ // {1, 3, 6, 7, 9, 4, 10, 5, 6},i=6时,最长子序列是1,3,6,7,9,10,而不是1,3,4,10
+ dp[i] = Math.max(dp[j] + 1, dp[i]);
+ }
+ }
+ // 记录最大系列长度
+ res = Math.max(res, dp[i]);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = {-2, -1};
+ int[] nums = {10, 9, 2, 5, 3, 7, 101, 18};
+ System.err.println(new Solution1().lengthOfLIS(nums));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..57e78b76
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.dynamic.最长公共子序列_1143_中等;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-common-subsequence/
+ * 题号:1143/最长公共子序列(LCS)
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int longestCommonSubsequence(String text1, String text2) {
+ return dfs(text1, text2, text1.length() - 1, text2.length() - 1);
+ }
+
+ public int dfs(String text1, String text2, int i, int j) {
+ if (i == -1 || j == -1) {
+ return 0;
+ }
+ if (text1.charAt(i) == text2.charAt(j)) {
+ // 这边找到一个 lcs 的元素,继续往前找
+ return dfs(text1, text2, i - 1, j - 1) + 1;
+ } else {
+ // 谁能让 lcs 最长,就听谁的
+ return Math.max(dfs(text1, text2, i - 1, j), dfs(text1, text2, i, j - 1));
+ }
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(3, new Solution1().longestCommonSubsequence("abcde", "ace"));
+ Assert.assertEquals(3, new Solution1().longestCommonSubsequence("abc", "abc"));
+ Assert.assertEquals(0, new Solution1().longestCommonSubsequence("abc", "def"));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..2467ad54
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227_1143_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.dynamic.最长公共子序列_1143_中等;
+
+import org.junit.Assert;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-common-subsequence/
+ * 题号:1143/最长公共子序列(LCS)
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划(自顶向下)
+ * 一、状态定义:dp[i][j]表示,对于 s1[1..i] 和 s2[1..j],它们的 LCS 长度是 dp[i][j]。
+ * 二、初始状态:
+ * 三、转换方程:
+ *
+ *
+ * https://leetcode-cn.com/problems/longest-common-subsequence/solution/dong-tai-gui-hua-zhi-zui-chang-gong-gong-zi-xu-lie/
+ * https://www.jianshu.com/p/6451410be00a
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int longestCommonSubsequence(String text1, String text2) {
+ int m = text1.length() + 1, n = text2.length() + 1;
+ int[][] dp = new int[m][n];
+
+ for (int i = 1; i < m; i++) {
+ for (int j = 1; j < n; j++) {
+ if (text1.charAt(i - 1) == text2.charAt(j - 1)) {
+ // 这边找到一个 lcs 的元素,继续往前找
+ dp[i][j] = dp[i - 1][j - 1] + 1;
+ } else {
+ // 谁能让 lcs 最长,就听谁的
+ dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
+ }
+ }
+ }
+
+ return dp[m - 1][n - 1];
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(4, new Solution1().longestCommonSubsequence("google", "elgoog"));
+ //Assert.assertEquals(3, new Solution3().longestCommonSubsequence("abcde", "ace"));
+ //Assert.assertEquals(3, new Solution3().longestCommonSubsequence("abc", "abc"));
+ //Assert.assertEquals(0, new Solution3().longestCommonSubsequence("abc", "def"));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..999e9afe
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,26 @@
+package cn.lastwhisper.leetcode.dynamic.爬楼梯_70_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/climbing-stairs/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归(自顶向下)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int climbStairs(int n) {
+ if (n == 0 || n == 1) {
+ return 1;
+ }
+ return climbStairs(n - 1) + climbStairs(n - 2);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().climbStairs(2));
+ System.out.println(new Solution1().climbStairs(3));
+ System.out.println(new Solution1().climbStairs(4));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..04ffc448
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.dynamic.爬楼梯_70_简单;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/climbing-stairs/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归(自顶向下)+记忆化搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ private Map map = new HashMap<>();
+
+ public int climbStairs(int n) {
+ if (n == 0 || n == 1) {
+ return 1;
+ }
+
+ Integer result = map.getOrDefault(n, -1);
+ if (result == -1) {
+ result = climbStairs(n - 1) + climbStairs(n - 2);
+ map.put(n, result);
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution2().climbStairs(2));//2
+ System.out.println(new Solution2().climbStairs(3));//3
+ System.out.println(new Solution2().climbStairs(4));//5
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..74359179
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,28 @@
+package cn.lastwhisper.leetcode.dynamic.爬楼梯_70_简单;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/climbing-stairs/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:尾递归(自底向上)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public int climbStairs(int n) {
+ return climbStairs(n,0,1);
+ }
+
+ private int climbStairs(int n, int rt1, int rt2) {
+ return n == 0 ? rt2 : climbStairs(n - 1, rt2, rt1 + rt2);
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution3().climbStairs(2));//2
+ System.out.println(new Solution3().climbStairs(3));//3
+ System.out.println(new Solution3().climbStairs(4));//5
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..894e4e07
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,35 @@
+package cn.lastwhisper.leetcode.dynamic.爬楼梯_70_简单;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/climbing-stairs/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划(自底向上)
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+
+ public int climbStairs(int n) {
+ if (n < 2) {
+ return n;
+ }
+ int[] arr = new int[n + 1];
+ arr[0] = 1;
+ arr[1] = 1;
+
+ for (int i = 2; i <= n; i++) {
+ arr[i] = arr[i - 1] + arr[i - 2];
+ }
+ return arr[n];
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution4().climbStairs(2));//2
+ System.out.println(new Solution4().climbStairs(3));//3
+ System.out.println(new Solution4().climbStairs(4));//5
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution5.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution5.java"
new file mode 100644
index 00000000..432d9bf2
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\347\210\254\346\245\274\346\242\257_70_\347\256\200\345\215\225/Solution5.java"
@@ -0,0 +1,33 @@
+package cn.lastwhisper.leetcode.dynamic.爬楼梯_70_简单;
+
+class Solution5 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/climbing-stairs/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划(自底向上)的另一种写法
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int climbStairs(int n) {
+ if (n < 2) return n;
+ int item1 = 1;
+ int item2 = 1;
+ int sum = 0;
+ for (int i = 2; i <= n; i++) {
+ sum = item1 + item2;
+ item1 = item2;
+ item2 = sum;
+ }
+ return sum;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(new Solution5().climbStairs(2));//2
+ System.out.println(new Solution5().climbStairs(3));//3
+ System.out.println(new Solution5().climbStairs(4));//5
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\350\247\243\347\240\201\346\226\271\346\263\225_91_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\350\247\243\347\240\201\346\226\271\346\263\225_91_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..13b0fad0
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\350\247\243\347\240\201\346\226\271\346\263\225_91_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,33 @@
+package cn.lastwhisper.leetcode.dynamic.解码方法_91_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/decode-ways/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int numDecodings(String s) {
+ if (s.charAt(0) == '0') return 0;
+ int pre = 1, curr = 1;//dp[-1]= dp[0]= 1
+ for (int i = 1; i < s.length(); i++) {
+ int tmp = curr;
+ if (s.charAt(i) == '0')
+ if (s.charAt(i - 1) == '1' || s.charAt(i - 1) == '2') curr = pre;
+ else return 0;
+ else if (s.charAt(i - 1) == '1' || (s.charAt(i - 1) == '2' && s.charAt(i) >= '1' && s.charAt(i) <= '6'))
+ curr = curr + pre;
+ pre = tmp;
+ }
+ return curr;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Solution1().numDecodings("12"));//"AB"(1 2)或者 "L"(12)
+ System.out.println(new Solution1().numDecodings("226"));// "BZ" (2 26), "VF" (22 6), 或者 "BBF" (2 2 6)
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..e2508b5e
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,45 @@
+package cn.lastwhisper.leetcode.dynamic.零钱兑换_322_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/coin-change/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归dfs-暴力搜索
+ * 先找到子问题
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^k*k),n^k个结点
+ * 空间复杂度:O(n^k)
+ */
+ public int coinChange(int[] coins, int amount) {
+ return tryCoinChange(coins, amount);
+ }
+
+ public int tryCoinChange(int[] coins, int amount) {
+ if (amount == 0) {
+ return 0;
+ }
+ if (amount < 0) {
+ return -1;
+ }
+ int freq = Integer.MAX_VALUE;
+ for (int coin : coins) {
+ int subFreq = tryCoinChange(coins, amount - coin);
+ if (subFreq == -1) {
+ continue;
+ }
+ freq = Math.min(freq, 1 + subFreq);
+ }
+
+ return freq == Integer.MAX_VALUE ? -1 : freq;
+ }
+
+ public static void main(String[] args) {
+ //int[] coins = {1, 2, 5};
+ //int amount = 11;
+ int[] coins = {2};
+ int amount = 3;
+ System.err.println(new Solution1().coinChange(coins, amount));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..71b89a41
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.dynamic.零钱兑换_322_中等;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/coin-change/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:递归dfs-暴力搜索-备忘录
+ * 先找到子问题
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^k*k),n^k个结点
+ * 空间复杂度:O()
+ */
+ public int coinChange(int[] coins, int amount) {
+ int[] memo = new int[amount + 1];
+ return tryCoinChange(coins, amount, memo);
+ }
+
+ public int tryCoinChange(int[] coins, int amount, int[] memo) {
+ if (amount == 0) {
+ return 0;
+ }
+ if (amount < 0) {
+ return -1;
+ }
+ if (memo[amount] != 0) {
+ return memo[amount];
+ }
+ int freq = Integer.MAX_VALUE;
+ for (int coin : coins) {
+ int subFreq = tryCoinChange(coins, amount - coin, memo);
+ // 子问题无解,不更新freq
+ if (subFreq == -1) {
+ continue;
+ }
+ freq = Math.min(freq, 1 + subFreq);
+ }
+ // 所有子问题都无解,返回-1
+ memo[amount] = freq == Integer.MAX_VALUE ? -1 : freq;
+ return memo[amount];
+ }
+
+ public static void main(String[] args) {
+ //int[] coins = {1, 2, 5};
+ //int amount = 11;
+ int[] coins = {2};
+ int amount = 3;
+ System.err.println(new Solution2().coinChange(coins, amount));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..7c669b3f
--- /dev/null
+++ "b/algorithms/leetcode/dynamic/src/main/java/cn/lastwhisper/leetcode/dynamic/\351\233\266\351\222\261\345\205\221\346\215\242_322_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.dynamic.零钱兑换_322_中等;
+
+import java.util.Arrays;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/coin-change/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int coinChange(int[] coins, int amount) {
+ int max = amount + 1;
+ // 确定状态
+ int[] dp = new int[amount + 1];
+ Arrays.fill(dp, max);
+ dp[0] = 0;
+ for (int i = 1; i <= amount; i++) {
+ for (int coin : coins) {
+ if (i >= coin) {
+ dp[i] = Math.min(dp[i], dp[i - coin] + 1);
+ }
+ }
+ }
+ return dp[amount] > amount ? -1 : dp[amount];
+ }
+
+ public static void main(String[] args) {
+ int[] coins = {1, 2, 5};
+ int amount = 11;
+ //int[] coins = {2};
+ //int amount = 3;
+ System.err.println(new Solution3().coinChange(coins, amount));
+ }
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/greedy/README.md b/algorithms/leetcode/greedy/README.md
new file mode 100644
index 00000000..e69de29b
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..b20adb00
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,59 @@
+package cn.lastwhisper.leetcode.greedy.买卖股票的最佳时机II_122_简单;
+
+class Solution1 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力搜索
+ * 1、买入之后:1.不操作 2.卖出
+ * 2、不操作之后:1.不操作 2.买入
+ * 3、卖出之后:1.不操作 2.买入
+ * 4、初始:1.不操作 2.买入
+ *
+ * 共有两种状态:
+ * 1 持股
+ * 2、3、4 未持股
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(2^n)
+ * 空间复杂度:O(1)
+ */
+ public int maxProfit(int[] prices) {
+ tryProfit(prices, 0, false, 0);
+ return profit;
+ }
+
+ int profit = 0;
+
+ /**
+ * @param prices 股价数组
+ * @param index 第几天
+ * @param status true持股,false不持股
+ * @param profit 当前收益
+ */
+ private void tryProfit(int[] prices, int index, boolean status, int profit) {
+ if (index == prices.length ) {
+ this.profit = Math.max(this.profit, profit);
+ return;
+ }
+ // 不卖也不买
+ tryProfit(prices, index + 1, status, profit);
+ if (status) {
+ // 尝试卖出
+ tryProfit(prices, index + 1, false, profit + prices[index]);
+ } else {
+ // 尝试买入
+ tryProfit(prices, index + 1, true, profit - prices[index]);
+ }
+ }
+
+
+ public static void main(String[] args) {
+ //int[] prices = {7, 1, 5, 3, 6, 4};
+ int[] prices = {1, 2, 3, 4, 5};
+ System.err.println(new Solution1().maxProfit(prices));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..c5097fde
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,56 @@
+package cn.lastwhisper.leetcode.greedy.买卖股票的最佳时机II_122_简单;
+
+class Solution2 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:暴力搜索
+ * 1、买入之后:1.不操作 2.卖出
+ * 2、不操作之后:1.不操作 2.买入
+ * 3、卖出之后:1.不操作 2.买入
+ * 4、初始:1.不操作 2.买入
+ *
+ * 共有两种状态:
+ * 1 持股
+ * 2、3、4 未持股
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(2^n)
+ * 空间复杂度:O(1)
+ */
+ public int maxProfit(int[] prices) {
+ return tryProfit(prices, 0, false, 0);
+ }
+
+ /**
+ * @param prices 股价数组
+ * @param index 第几天
+ * @param status true持股,false不持股
+ * @param profit 当前收益
+ */
+ private int tryProfit(int[] prices, int index, boolean status, int profit) {
+ if (index == prices.length) {
+ return profit;
+ }
+ // 不操作
+ int currentMax = tryProfit(prices, index + 1, status, profit);
+ if (status) {
+ // 尝试卖出
+ currentMax = Math.max(currentMax, tryProfit(prices, index + 1, false, profit + prices[index]));
+ } else {
+ // 尝试买入
+ currentMax = Math.max(currentMax, tryProfit(prices, index + 1, true, profit - prices[index]));
+ }
+ return currentMax;
+ }
+
+
+ public static void main(String[] args) {
+ //int[] prices = {7, 1, 5, 3, 6, 4};
+ int[] prices = {1, 2, 3, 4, 5};
+ System.err.println(new Solution2().maxProfit(prices));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..3d42e75f
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,25 @@
+package cn.lastwhisper.leetcode.greedy.买卖股票的最佳时机II_122_简单;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:动态规划
+ *
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int maxProfit(int[] prices) {
+
+ return 0;
+ }
+
+ public static void main(String[] args) {
+ //int[] prices = {7, 1, 5, 3, 6, 4};
+ int[] prices = {1, 2, 3, 4, 5};
+ System.err.println(new Solution3().maxProfit(prices));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution4.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution4.java"
new file mode 100644
index 00000000..cf2187c5
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II_122_\347\256\200\345\215\225/Solution4.java"
@@ -0,0 +1,30 @@
+package cn.lastwhisper.leetcode.greedy.买卖股票的最佳时机II_122_简单;
+
+class Solution4 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:贪心算法
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public int maxProfit(int[] prices) {
+ int profit = 0, temp;
+ for (int i = prices.length - 1; i > 0; i--) {
+ temp = prices[i] - prices[i - 1];
+ if (temp > 0) {
+ profit += temp;
+ }
+ }
+ return profit;
+ }
+
+ public static void main(String[] args) {
+ //int[] prices = {7, 1, 5, 3, 6, 4};
+ int[] prices = {1, 2, 3, 4, 5};
+ System.err.println(new Solution4().maxProfit(prices));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\206\345\217\221\351\245\274\345\271\262_455_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\206\345\217\221\351\245\274\345\271\262_455_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..ea182c46
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\206\345\217\221\351\245\274\345\271\262_455_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,36 @@
+package cn.lastwhisper.leetcode.greedy.分发饼干_455_简单;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/assign-cookies/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:贪心算法
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ */
+ public int findContentChildren(int[] g, int[] s) {
+ int count = 0;
+ // 排序,从小到大
+ Arrays.sort(g);
+ Arrays.sort(s);
+ for (int i = g.length - 1, j = s.length - 1; i >= 0 && j >= 0; i--) {
+ // 最大的饼干,满足最贪心的孩子
+ if (s[j] >= g[i]) {
+ count++;
+ j--;
+ }
+ }
+ return count;
+ }
+
+ public static void main(String[] args) {
+ //int[] g = {1,2},s={1,2,3};
+ int[] g = {10, 9, 8, 7}, s = {5, 6, 7, 8};
+ System.out.println(new Solution1().findContentChildren(g, s));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..c7b20b07
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,37 @@
+package cn.lastwhisper.leetcode.greedy.判断子序列_392_简单;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/is-subsequence/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:贪心算法
+ * 将s依次放入t搜索
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public boolean isSubsequence(String s, String t) {
+ // 记录上一个字符在t中的位置
+ int prev = 0;
+ for (int i = 0; i < s.length(); i++) {
+ // 从上一个字符的位置之后进行搜索
+ int index = t.indexOf(s.charAt(i), prev);
+ if (index == -1) {
+ return false;
+ }
+ prev = index + 1;
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ //String s = "abc", t = "ahbgdc";//true
+ //String s = "axc", t = "ahbgdc";//false
+ String s = "acb", t = "ahbgdc";//false
+ //String s = "leetcode", t = "ylyeyeyeytycyoydye";//true
+ //String s = "leeeeetcode", t = "yyyyylyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyytyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyycyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyoyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyydyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
+ System.err.println(new Solution1().isSubsequence(s, t));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..f6800edb
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227_392_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,35 @@
+package cn.lastwhisper.leetcode.greedy.判断子序列_392_简单;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/is-subsequence/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:贪心算法
+ * 如果s是t的子序列,也就是说s中的所有字符都会按照顺序出现在t中
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(1)
+ */
+ public boolean isSubsequence(String s, String t) {
+ int sIndex = 0, tIndex = 0;
+ // 如果s是t的子序列,也就是说s中的所有字符都会按照顺序出现在t中
+ while (sIndex < s.length() && tIndex < t.length()) {
+ if (s.charAt(sIndex) == t.charAt(tIndex)) {
+ sIndex++;
+ }
+ tIndex++;
+ }
+ return sIndex == s.length();
+ }
+
+ public static void main(String[] args) {
+ //String s = "abc", t = "ahbgdc";//true
+ //String s = "axc", t = "ahbgdc";//false
+ //String s = "acb", t = "ahbgdc";//false
+ String s = "leetcode", t = "ylyeyeyeytycyoydye";//true
+ //String s = "leeeeetcode", t = "yyyyylyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyytyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyycyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyoyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyydyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
+ System.err.println(new Solution2().isSubsequence(s, t));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264_435_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264_435_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..49a435ae
--- /dev/null
+++ "b/algorithms/leetcode/greedy/src/main/java/cn/lastwhisper/leetcode/greedy/\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264_435_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,22 @@
+package cn.lastwhisper.leetcode.greedy.无重叠区间_435_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/non-overlapping-intervals/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int eraseOverlapIntervals(int[][] intervals) {
+
+ return 0;
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_Middle/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_Middle/Solution1.java"
deleted file mode 100644
index 4b2e6e4d..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_Middle/Solution1.java"
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.三数之和_15_Middle;
-
-import java.util.*;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/3sum/
- * 核心思想:排序+双索引+hash表
- * 时间复杂度:
- */
- public List> threeSum(int[] nums) {
- if (nums == null) throw new IllegalArgumentException("非法参数");
- // 数组排序
- Arrays.sort(nums);
- // hash表
- Map map = new HashMap<>();
- // 结果
- List> list = new ArrayList<>();
- // [l,r]
- int l = 0, r = nums.length-1;
- int k = nums[l];
- while (l {
- System.out.println();
- list.forEach(System.out::print);
- });
-
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..6d490bfd
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,62 @@
+package cn.lastwhisper.leetcode.hashtable.三数之和_15_中等;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/3sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:如何将数组中的任意三个数,进行组合?
+ * A:三层循环,第一层i~n-2,第二层i+1~n-1,第一层i+2~n
+ * Q:如何保证无重复组合?
+ * A:先对数组排序。每一层循环时,和数组前一个数进行对比是否相等,相等说明重复了,直接跳过
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(n^2)
+ */
+ public List> threeSum(int[] nums) {
+ if (nums == null) throw new IllegalArgumentException("非法参数");
+ Arrays.sort(nums);
+ // 结果
+ List> resultList = new ArrayList<>();
+ for (int i = 0; i < nums.length - 2; i++) {
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+ for (int j = i + 1; j < nums.length - 1; j++) {
+ if (j > i + 1 && nums[j] == nums[j - 1]) {
+ continue; // 对j去重
+ }
+ for (int k = j + 1; k < nums.length; k++) {
+ if (k > j + 1 && nums[k] == nums[k - 1]) {
+ continue; // 对k去重
+ }
+ if (nums[i] + nums[j] + nums[k] == 0) {
+ resultList.add(Arrays.asList(nums[i], nums[j], nums[k]));
+ }
+ }
+ }
+ }
+
+ return resultList;
+ }
+
+ public static void main(String[] args) {
+ //new Solution1().threeSum(new int[]{-1, 0, 1, 2, -1, -4}).forEach((list) -> {
+ // System.out.println();
+ // list.forEach(System.out::print);
+ //});
+
+ // error example
+ new Solution1().threeSum(new int[]{0, 0, 0, 0}).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..25f77fb3
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,64 @@
+package cn.lastwhisper.leetcode.hashtable.三数之和_15_中等;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/3sum/
+ * -------------------------------------------------------------------
+ *
+ * -------------------------------------------------------------------
+ * 优化思路:三三组合改进,排序+双索引,并对特殊情况进行剔除
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ */
+ public List> threeSum(int[] nums) {
+ // 存储结果
+ List> resultList = new ArrayList<>();
+ if (nums == null || nums.length < 3) return resultList;
+ // 数组排序
+ Arrays.sort(nums);
+ for (int i = 0; i < nums.length; i++) {
+ if (nums[i] > 0) {
+ break; //此时说明数组后面都是正值,三个数相加不可能为0
+ }
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+
+ int l = i + 1, r = nums.length - 1;
+ while (l < r) {
+
+ int sum = nums[i] + nums[l] + nums[r];
+ if (sum == 0) {
+ resultList.add(Arrays.asList(nums[i], nums[l], nums[r]));
+ while (l < r && nums[l] == nums[l + 1]) l++; // 对l去重
+ while (l < r && nums[r] == nums[r - 1]) r--; // 对r去重
+ l++;
+ r--;
+ } else if (sum < 0) {
+ l++;
+ } else {
+ r--;
+ }
+
+ }
+ }
+ return resultList;
+ }
+
+ public static void main(String[] args) {
+ //new Solution2().threeSum(new int[]{-1, 0, 1, 2, -1, -4}).forEach((list) -> {
+ // System.out.println();
+ // list.forEach(System.out::print);
+ //});
+
+ new Solution2().threeSum(new int[]{0,0,0,0}).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..c3ca0a1d
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\211\346\225\260\344\271\213\345\222\214_15_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,77 @@
+package cn.lastwhisper.leetcode.hashtable.三数之和_15_中等;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/3sum/
+ * -------------------------------------------------------------------
+ *
+ * -------------------------------------------------------------------
+ * 优化思路:根据排序后的数据规律,剔除掉不必要的循环
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ * -------------------------------------------------------------------
+ * 执行用时 :33 ms, 在所有 java 提交中击败了92.67%的用户
+ * 内存消耗 :48.1 MB, 在所有 java 提交中击败了92.84%的用户
+ */
+ public List> threeSum(int[] nums) {
+ // 存储结果
+ List> resultList = new ArrayList<>();
+ if (nums == null || nums.length < 3) return resultList;
+ // 数组排序
+ Arrays.sort(nums);
+ for (int i = 0; i < nums.length - 2; i++) { // i < nums.length - 2
+
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+
+ // 最小值比0大,不管nums[i]再怎么递增都没戏
+ int min1 = nums[i] + nums[i + 1] + nums[i + 2];
+ if (min1 > 0) {
+ break;
+ }
+
+ // 最大值比0小,当前nums[i]肯定没戏了,找下一个nums[i]试试
+ int max1 = nums[i] + nums[nums.length - 2] + nums[nums.length - 1];
+ if (max1 < 0) {
+ continue;
+ }
+
+ int l = i + 1, r = nums.length - 1;
+ while (l < r) {
+
+ int sum = nums[i] + nums[l] + nums[r];
+ if (sum == 0) {
+ resultList.add(Arrays.asList(nums[i], nums[l], nums[r]));
+ while (l < r && nums[l] == nums[l + 1]) l++; // 对l去重
+ while (l < r && nums[r] == nums[r - 1]) r--; // 对r去重
+ l++;
+ r--;
+ } else if (sum < 0) {
+ l++;
+ } else {
+ r--;
+ }
+
+ }
+ }
+ return resultList;
+ }
+
+ public static void main(String[] args) {
+ //new Solution2().threeSum(new int[]{-1, 0, 1, 2, -1, -4}).forEach((list) -> {
+ // System.out.println();
+ // list.forEach(System.out::print);
+ //});
+
+ new Solution3().threeSum(new int[]{0, 0, 0, 0}).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_Esay/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_Esay/Solution1.java"
new file mode 100644
index 00000000..8954b872
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_Esay/Solution1.java"
@@ -0,0 +1,38 @@
+package cn.lastwhisper.leetcode.hashtable.两个数组的交集_349_Esay;
+
+import java.util.HashSet;
+import java.util.Set;
+
+class Solution1 {
+ /**
+ *
+ */
+ public int[] intersection(int[] nums1, int[] nums2) {
+ Set recorde = new HashSet();
+ for (int num : nums1) {
+ recorde.add(num);
+ }
+ Set resSet = new HashSet();
+ for (int num : nums2) {
+ if (recorde.contains(num)) {
+ resSet.add(num);
+ }
+ }
+ int[] res = new int[resSet.size()];
+
+ int index = 0;
+ for (Integer num : resSet)
+ res[index++] = num;
+ return res;
+ }
+
+ public static void main(String[] args) {
+ int[] nums1 = {1, 2, 2, 1};
+ int[] nums2 = {2, 2};
+ int[] res = (new Solution1()).intersection(nums1, nums2);
+
+ for (int re : res) {
+ System.out.println(re);
+ }
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_esay/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_esay/Solution1.java"
deleted file mode 100644
index 99aa87b9..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_349_esay/Solution1.java"
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.两个数组的交集_349_esay;
-
-import java.util.HashSet;
-import java.util.Set;
-
-class Solution1 {
- /**
- *
- */
- public int[] intersection(int[] nums1, int[] nums2) {
- Set recorde = new HashSet();
- for (int i = 0; i < nums1.length; i++) {
- recorde.add(nums1[i]);
- }
- Set resSet = new HashSet();
- for (int i = 0; i < nums2.length; i++) {
- if(recorde.contains(nums2[i])){
- resSet.add(nums2[i]);
- }
- }
- int[] res = new int[resSet.size()];
-
- int index = 0;
- for(Integer num: resSet)
- res[index++] = num;
- return res;
- }
-
- public static void main(String[] args){
- int[] nums1 = {1, 2, 2, 1};
- int[] nums2 = {2, 2};
- int[] res = (new Solution1()).intersection(nums1, nums2);
-
- for (int i = 0; i < res.length; i++) {
- int re = res[i];
- System.out.println(re);
- }
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_Esay/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_Esay/Solution1.java"
new file mode 100644
index 00000000..028560f8
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_Esay/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.hashtable.两个数组的交集_II_350_Esay;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+class Solution1 {
+ public int[] intersect(int[] nums1, int[] nums2) {
+ Map record = new HashMap<>();
+ for (int i = 0; i < nums1.length; i++) {
+ int num = nums1[i];
+ if(!record.containsKey(num)){
+ record.put(num,1);
+ }else {
+ record.put(num, record.get(num) + 1);
+ }
+
+ }
+
+ List result = new ArrayList<>();
+ for (int i = 0; i < nums2.length; i++) {
+ int num = nums2[i];
+ if(record.containsKey(num) && record.get(num)>0){
+ result.add(num);
+ record.put(num, record.get(num) - 1);
+ }
+
+ }
+
+ int[] res = new int[result.size()];
+ int index=0;
+ for (Integer integer : result) {
+ res[index] = integer;
+ index++;
+ }
+
+ return res;
+ }
+
+ public static void main(String[] args){
+ int[] nums1 = {1, 2, 2, 1};
+ int[] nums2 = {2, 2};
+ int[] res = (new Solution1()).intersect(nums1, nums2);
+
+ for (int i = 0; i < res.length; i++) {
+ int re = res[i];
+ System.out.println(re);
+ }
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_esay/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_esay/Solution1.java"
deleted file mode 100644
index 0db910bc..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206_II_350_esay/Solution1.java"
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.两个数组的交集_II_350_esay;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-class Solution1 {
- public int[] intersect(int[] nums1, int[] nums2) {
- Map record = new HashMap<>();
- for (int i = 0; i < nums1.length; i++) {
- int num = nums1[i];
- if(!record.containsKey(num)){
- record.put(num,1);
- }else {
- record.put(num, record.get(num) + 1);
- }
-
- }
-
- List result = new ArrayList<>();
- for (int i = 0; i < nums2.length; i++) {
- int num = nums2[i];
- if(record.containsKey(num) && record.get(num)>0){
- result.add(num);
- record.put(num, record.get(num) - 1);
- }
-
- }
-
- int[] res = new int[result.size()];
- int index=0;
- for (Integer integer : result) {
- res[index] = integer;
- index++;
- }
-
- return res;
- }
-
- public static void main(String[] args){
- int[] nums1 = {1, 2, 2, 1};
- int[] nums2 = {2, 2};
- int[] res = (new Solution1()).intersect(nums1, nums2);
-
- for (int i = 0; i < res.length; i++) {
- int re = res[i];
- System.out.println(re);
- }
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution1.java"
deleted file mode 100644
index f4a26279..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution1.java"
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.两数之和_1_Easy;
-
-import java.util.Arrays;
-
-class Solution1 {
- /**
- * https://leetcode-cn.com/problems/two-sum/
- * 核心思想:找出所有组合进行对比
- * 时间复杂度:O(n^2)
- * 空间复杂度:O(1)
- */
- public int[] twoSum(int[] nums, int target) {
- if (nums == null) throw new IllegalArgumentException("非法参数");
- for (int i = 0; i < nums.length; i++) {
- for (int j = i+1; j < nums.length; j++) {
- if(nums[i]+nums[j]==target){
- return new int[]{i,j};
- }
- }
- }
- return null;
- }
-
- public static void main(String[] args) {
- System.out.println(Arrays.toString(new Solution1().twoSum(new int[]{2, 7, 11, 15}, 9)));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution2.java"
deleted file mode 100644
index 339977c9..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution2.java"
+++ /dev/null
@@ -1,25 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.两数之和_1_Easy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.stream.Collectors;
-
-class Solution2 {
- /**
- * https://leetcode-cn.com/problems/two-sum/
- * 核心思想:先排序O(nlogn),在双索引O(n)
- * 时间复杂度:O(nlogn)
- * 空间复杂度:O(1)
- */
- public int[] twoSum(int[] nums, int target) {
- if (nums == null) throw new IllegalArgumentException("非法参数");
-
-
- return null;
- }
-
- public static void main(String[] args) {
- System.out.println(Arrays.toString(new Solution2().twoSum(new int[]{2, 7, 11, 15}, 9)));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution3.java"
deleted file mode 100644
index ca9137f8..00000000
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_Easy/Solution3.java"
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.lastwhisper.leetcode.hashtable.两数之和_1_Easy;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-class Solution3 {
- /**
- * https://leetcode-cn.com/problems/two-sum/
- * 核心思想:
- * 时间复杂度:O(n)
- * 空间复杂度:O(n)
- * 执行用时 : 3 ms , 在所有 Java 提交中击败了 99.01% 的用户
- * 内存消耗 : 37.9 MB , 在所有 Java 提交中击败了 79.09% 的用户
- */
- public int[] twoSum(int[] nums, int target) {
- if (nums == null) throw new IllegalArgumentException("非法参数");
- // map存储数字与对应下标
- Map map = new HashMap<>();
- // 边记录边找
- for (int i = 0; i < nums.length; i++) {
- int key = target-nums[i];
- if(map.containsKey(key)){
- return new int[]{i,map.get(key)};
- }
- map.put(nums[i],i);
- }
- throw new IllegalArgumentException("No two sum solution");
- }
-
- public static void main(String[] args) {
- System.out.println(Arrays.toString(new Solution3().twoSum(new int[]{2, 7, 11, 15}, 9)));
- }
-}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..9be5d0c5
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,29 @@
+package cn.lastwhisper.leetcode.hashtable.两数之和_1_简单;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * https://leetcode-cn.com/problems/two-sum/
+ * 核心思想:找出所有组合进行对比,取其中一个即可
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ *
+ *
+ */
+ public int[] twoSum(int[] nums, int target) {
+ if (nums == null) throw new IllegalArgumentException("非法参数");
+ for (int i = 0; i < nums.length - 1; i++) {
+ for (int j = i + 1; j < nums.length; j++) {
+ if (nums[i] + nums[j] == target) {
+ return new int[]{i, j};
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Arrays.toString(new Solution1().twoSum(new int[]{2, 7, 11, 15}, 9)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..4b3aa980
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,48 @@
+package cn.lastwhisper.leetcode.hashtable.两数之和_1_简单;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution2 {
+ /**
+ * https://leetcode-cn.com/problems/two-sum/
+ * 核心思想:先排序O(nlogn),在对撞指针O(n)
+ * 时间复杂度:O(nlogn)
+ * 空间复杂度:O(1)
+ * 相关题型:两数之和_II_输入有序数组_167
+ */
+ public int[] twoSum(int[] nums, int target) {
+ if (nums == null) throw new IllegalArgumentException("非法参数");
+ // 存储原数组,下标和值映射关系(map中重复的数据会覆盖数组值与下标的对应关系)
+ Map map = new HashMap<>();
+ for (int i = 0; i < nums.length; i++) {
+ map.put(nums[i], i);
+ }
+ Arrays.sort(nums);
+ // 对撞指针
+ int l = 0, r = nums.length - 1;
+ while (l < r) {
+ int left = nums[l];
+ int right = nums[r];
+ if ((left + right) == target) {
+ return new int[]{map.get(left), map.get(right)};
+ } else if ((left + right) > target) {
+ r--;
+ } else {
+ l++;
+ }
+ }
+ return null;
+ }
+
+ // 没做出来,暂时保留
+ public static void main(String[] args) {
+ //int[] arr = new int[]{3, 2, 4};
+ //int target = 6;
+
+ int[] arr = new int[]{3, 3};//此时发生错误
+ int target = 6;
+ System.out.println(Arrays.toString(new Solution2().twoSum(arr, target)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..a52e83d2
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\344\270\244\346\225\260\344\271\213\345\222\214_1_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.hashtable.两数之和_1_简单;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution3 {
+ /**
+ * https://leetcode-cn.com/problems/two-sum/
+ * 核心思想:将所有元素放入查找表,之后对于每一个元素a,查找 target - a 是否存在
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ * 执行用时 : 3 ms , 在所有 Java 提交中击败了 99.01% 的用户
+ * 内存消耗 : 37.9 MB , 在所有 Java 提交中击败了 79.09% 的用户
+ */
+ public int[] twoSum(int[] nums, int target) {
+ if (nums == null) throw new IllegalArgumentException("非法参数");
+ // map存储数字与对应下标
+ Map map = new HashMap<>();
+ // 边记录边找
+ for (int i = 0; i < nums.length; i++) {
+ int key = target-nums[i];
+ if(map.containsKey(key)){
+ return new int[]{i,map.get(key)};
+ }
+ map.put(nums[i],i);
+ }
+ throw new IllegalArgumentException("No two sum solution");
+ }
+
+ public static void main(String[] args) {
+ //int[] arr = new int[]{3, 2, 4};
+ //int target = 6;
+
+ int[] arr = new int[]{3,3};//此时发生错误
+ int target = 6;
+
+ //int[] arr = new int[]{2, 7, 11, 15};
+ //int target = 9;
+
+ System.out.println(Arrays.toString(new Solution2().twoSum(arr, target)));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Example.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Example.java"
new file mode 100644
index 00000000..e48cd6c0
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Example.java"
@@ -0,0 +1,109 @@
+package cn.lastwhisper.leetcode.hashtable.四数之和_18_Middle;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Example {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/4sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:数组、无序、所有整数
+ * 输出:二维数组
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public List> fourSum(int[] nums, int target) {
+ /*定义一个返回值*/
+ List> result = new ArrayList<>();
+ /*当数组为null或元素小于4个时,直接返回*/
+ if (nums == null || nums.length < 4) {
+ return result;
+ }
+ /*对数组进行从小到大排序*/
+ Arrays.sort(nums);
+ /*数组长度*/
+ int length = nums.length;
+ /*定义4个指针k,i,j,h k从0开始遍历,i从k+1开始遍历,留下j和h,j指向i+1,h指向数组最大值*/
+ for (int k = 0; k < length - 3; k++) {
+ /*当k的值与前面的值相等时忽略*/
+ if (k > 0 && nums[k] == nums[k - 1]) {
+ continue;
+ }
+ /*获取当前最小值,如果最小值比目标值大,说明后面越来越大的值根本没戏*/
+ int min1 = nums[k] + nums[k + 1] + nums[k + 2] + nums[k + 3];
+ if (min1 > target) {
+ break;
+ }
+ /*获取当前最大值,如果最大值比目标值小,说明后面越来越小的值根本没戏,忽略*/
+ int max1 = nums[k] + nums[length - 1] + nums[length - 2] + nums[length - 3];
+ if (max1 < target) {
+ continue;
+ }
+ /*第二层循环i,初始值指向k+1*/
+ for (int i = k + 1; i < length - 2; i++) {
+ /*当i的值与前面的值相等时忽略*/
+ if (i > k + 1 && nums[i] == nums[i - 1]) {
+ continue;
+ }
+ /*定义指针j指向i+1*/
+ int j = i + 1;
+ /*定义指针h指向数组末尾*/
+ int h = length - 1;
+ /*获取当前最小值,如果最小值比目标值大,说明后面越来越大的值根本没戏,忽略*/
+ int min = nums[k] + nums[i] + nums[j] + nums[j + 1];
+ if (min > target) {
+ continue;
+ }
+ /*获取当前最大值,如果最大值比目标值小,说明后面越来越小的值根本没戏,忽略*/
+ int max = nums[k] + nums[i] + nums[h] + nums[h - 1];
+ if (max < target) {
+ continue;
+ }
+ /*开始j指针和h指针的表演,计算当前和,如果等于目标值,j++并去重,h--并去重,当当前和大于目标值时h--,当当前和小于目标值时j++*/
+ while (j < h) {
+ int curr = nums[k] + nums[i] + nums[j] + nums[h];
+ if (curr == target) {
+ result.add(Arrays.asList(nums[k], nums[i], nums[j], nums[h]));
+ j++;
+ while (j < h && nums[j] == nums[j - 1]) {
+ j++;
+ }
+ h--;
+ while (j < h && i < h && nums[h] == nums[h + 1]) {
+ h--;
+ }
+ } else if (curr > target) {
+ h--;
+ } else {
+ j++;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+
+ public static void main(String[] args) {
+ //int[] nums = {1, 0, -1, 0, -2, 2};
+ //int target = 0;
+
+ // error example
+ //int[] nums = {-3, -1, 0, 2, 4, 5};
+ //int target = 2;
+
+ int[] nums = {-3, -2, -1, 0, 0, 1, 2, 3};
+ int target = 0;
+
+ new Example().fourSum(nums, target).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution1.java"
new file mode 100644
index 00000000..f65d1da1
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution1.java"
@@ -0,0 +1,72 @@
+package cn.lastwhisper.leetcode.hashtable.四数之和_18_Middle;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/4sum/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:在数组中任意取四个数(参考三数之和)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(n^2)
+ */
+ public List> fourSum(int[] nums, int target) {
+ // 存储结果
+ List> resultList = new ArrayList<>();
+ if (nums == null || nums.length < 4) return resultList;
+ // 数组排序
+ Arrays.sort(nums);
+ for (int i = 0; i < nums.length - 3; i++) {
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+ for (int j = i + 1; j < nums.length - 2; j++) {
+ if (j > i + 1 && nums[j] == nums[j - 1]) {
+ continue; // 对j去重
+ }
+ int l = j + 1, r = nums.length - 1;
+ while (l < r) {
+
+ int sum = nums[i] + nums[j] + nums[l] + nums[r];
+ if (sum == target) {
+ resultList.add(Arrays.asList(nums[i], nums[j], nums[l], nums[r]));
+ while (l < r && nums[l] == nums[l + 1]) l++; // 对l去重
+ while (l < r && nums[r] == nums[r - 1]) r--; // 对r去重
+ l++;
+ r--;
+ } else if (sum < target) {
+ l++;
+ } else {
+ r--;
+ }
+
+ }
+
+ }
+ }
+
+ return resultList;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = {1, 0, -1, 0, -2, 2};
+ //int target = 0;
+
+ // error example
+ //int[] nums = {-3, -1, 0, 2, 4, 5};
+ //int target = 2;
+
+ int[] nums = {-3, -2, -1, 0, 0, 1, 2, 3};
+ int target = 0;
+
+ new Solution1().fourSum(nums, target).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution2.java"
new file mode 100644
index 00000000..9a0c41c0
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\344\271\213\345\222\214_18_Middle/Solution2.java"
@@ -0,0 +1,99 @@
+package cn.lastwhisper.leetcode.hashtable.四数之和_18_Middle;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/4sum/
+ * -------------------------------------------------------------------
+ *
+ * -------------------------------------------------------------------
+ * 优化思路:根据排序后的数据特征,在循环时可以进行跳过不必要的循环
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(n^2)
+ * -------------------------------------------------------------------
+ * 执行用时 : 4 ms, 在所有 java 提交中击败了99.54%的用户
+ * 内存消耗 : 36.5 MB, 在所有 java 提交中击败了99.09%的用户
+ */
+ public List> fourSum(int[] nums, int target) {
+ // 存储结果
+ List> resultList = new ArrayList<>();
+ if (nums == null || nums.length < 4) return resultList;
+ // 数组排序
+ Arrays.sort(nums);
+ for (int i = 0; i < nums.length - 3; i++) {
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+ // 最小值比target大,不管nums[i]再怎么递增都没戏
+ int min1 = nums[i] + nums[i + 1] + nums[i + 2] + nums[i + 3];
+ if (min1 > target) {
+ break;
+ }
+
+ // 最大值比target小,当前nums[i]肯定没戏了,找下一个nums[i]试试
+ int max1 = nums[i] + nums[nums.length - 3] + nums[nums.length - 2] + nums[nums.length - 1];
+ if (max1 < target) {
+ continue;
+ }
+
+ for (int j = i + 1; j < nums.length - 2; j++) {
+ if (j > i + 1 && nums[j] == nums[j - 1]) {
+ continue; // 对j去重
+ }
+
+ // 最小值比target大,不管nums[j]再怎么递增都没戏
+ int min2 = nums[i] + nums[j] + nums[j + 1] + nums[j + 2];
+ if (min2 > target) {
+ break;
+ }
+
+ // 最大值比target小,当前nums[j]肯定没戏了,找下一个nums[j]试试
+ int max2 = nums[i] + nums[j] + nums[nums.length - 2] + nums[nums.length - 1];
+ if (max2 < target) {
+ continue;
+ }
+ int l = j + 1, r = nums.length - 1;
+ while (l < r) {
+
+ int sum = nums[i] + nums[j] + nums[l] + nums[r];
+ if (sum == target) {
+ resultList.add(Arrays.asList(nums[i], nums[j], nums[l], nums[r]));
+ while (l < r && nums[l] == nums[l + 1]) l++; // 对l去重
+ while (l < r && nums[r] == nums[r - 1]) r--; // 对r去重
+ l++;
+ r--;
+ } else if (sum < target) {
+ l++;
+ } else {
+ r--;
+ }
+
+ }
+
+ }
+ }
+
+ return resultList;
+ }
+
+ public static void main(String[] args) {
+ //int[] nums = {1, 0, -1, 0, -2, 2};
+ //int target = 0;
+
+ // error example
+ //int[] nums = {-3, -1, 0, 2, 4, 5};
+ //int target = 2;
+
+ int[] nums = {-3, -2, -1, 0, 0, 1, 2, 3};
+ int target = 0;
+
+ new Solution2().fourSum(nums, target).forEach((list) -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..5f44c6a7
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.hashtable.四数相加_II_454_中等;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/4sum-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:数组、无序、所有整数
+ * 输出:二维数组
+ * -------------------------------------------------------------------
+ * 优化思路:
+ * (1)四层循环,时间复杂度O(n^4)——超时
+ * (2)使用hash存储D的所有情况,时间复杂度O(n^3)——超时
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int fourSumCount(int[] A, int[] B, int[] C, int[] D) {
+ // key:数组中某个数、value:该数出现的频率
+ Map dMap = new HashMap<>();
+ for (int dKey : D) {
+ if (dMap.containsKey(dKey)) {
+ dMap.put(dKey, dMap.get(dKey) + 1);
+ } else {
+ dMap.put(dKey, 1);
+ }
+ }
+ int count = 0;
+ for (int a : A) {
+ for (int b : B) {
+ for (int c : C) {
+ int dKey = 0 - a - b - c;
+ Integer dCount = dMap.get(dKey);
+ if (dCount != null) {
+ count += dCount;
+ }
+ }
+ }
+ }
+ return count;
+ }
+
+ public static void main(String[] args) {
+ int[] A = {1, 2};
+ int[] B = {-2, -1};
+ int[] C = {-1, 2};
+ int[] D = {0, 2};
+ System.out.println(new Solution1().fourSumCount(A, B, C, D));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..6b487488
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\233\346\225\260\347\233\270\345\212\240_II_454_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,53 @@
+package cn.lastwhisper.leetcode.hashtable.四数相加_II_454_中等;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/4sum-ii/
+ * -------------------------------------------------------------------
+ * 优化思路:
+ * (3)使用hash存储CD的所有情况,时间复杂度O(n^2)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n^2)
+ * -------------------------------------------------------------------
+ * 执行用时 :142 ms, 在所有 java 提交中击败了27.37%的用户
+ * 内存消耗 :59 MB, 在所有 java 提交中击败了90.62%的用户
+ */
+ public int fourSumCount(int[] A, int[] B, int[] C, int[] D) {
+ // key:数组中某个数、value:该数出现的频率
+ Map cdMap = new HashMap<>();
+ for (int c : C) {
+ for (int d : D) {
+ int cd = c + d;
+ if (cdMap.containsKey(cd)) {
+ cdMap.put(cd, cdMap.get(cd) + 1);
+ } else {
+ cdMap.put(cd, 1);
+ }
+ }
+ }
+
+ int count = 0;
+ for (int a : A) {
+ for (int b : B) {
+ int cd = 0 - a - b;
+ Integer cdCount = cdMap.get(cd);
+ if (cdCount != null) {
+ count += cdCount;
+ }
+ }
+ }
+ return count;
+ }
+
+ public static void main(String[] args) {
+ int[] A = {1, 2};
+ int[] B = {-2, -1};
+ int[] C = {-1, 2};
+ int[] D = {0, 2};
+ System.out.println(new Solution2().fourSumCount(A, B, C, D));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\236\346\227\213\351\225\226\347\232\204\346\225\260\351\207\217_447_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\236\346\227\213\351\225\226\347\232\204\346\225\260\351\207\217_447_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..124817c3
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\233\236\346\227\213\351\225\226\347\232\204\346\225\260\351\207\217_447_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.hashtable.回旋镖的数量_447_简单;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/number-of-boomerangs/
+ * -------------------------------------------------------------------
+ * 思考:计算两点问题开根号时会有精度问题
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度: O(n^2)
+ * 空间复杂度: O(n)
+ */
+ public int numberOfBoomerangs(int[][] points) {
+ int res = 0;
+
+ // record中存储 点i 到所有其他点的距离出现的频次
+ Map record = new HashMap<>();
+ for (int i = 0; i < points.length; i++) {
+
+ for (int j = 0; j < points.length; j++) {
+ if (i != j) {
+ // 计算距离时不进行开根运算, 以保证精度
+ int dis = dis(points[i], points[j]);
+ if (record.containsKey(dis)) {
+ record.put(dis, record.get(dis) + 1);
+ } else {
+ record.put(dis, 1);
+ }
+ }
+ }
+ for (Integer dis : record.keySet()) {
+ res += record.get(dis) * (record.get(dis) - 1);
+ }
+
+ // 复用map
+ record.clear();
+ }
+ return res;
+ }
+
+ private int dis(int[] pa, int[] pb) {
+ return (pa[0] - pb[0]) * (pa[0] - pb[0]) +
+ (pa[1] - pb[1]) * (pa[1] - pb[1]);
+ }
+
+ public static void main(String[] args) {
+ int[][] points = {{0, 0}, {1, 0}, {2, 0}};
+ System.out.println(new Solution1().numberOfBoomerangs(points));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215\345\210\206\347\273\204_49_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215\345\210\206\347\273\204_49_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..e88ccb72
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215\345\210\206\347\273\204_49_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,49 @@
+package cn.lastwhisper.leetcode.hashtable.字母异位词分组_49_中等;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/group-anagrams/
+ * -------------------------------------------------------------------
+ * 思路:排序字符串相等时,两个字符串是字母异位词
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(N*K*logK) 其中 N 是 strs 的长度,而 K 是 strs 中字符串的最大长度
+ * 空间复杂度:O(N*K)
+ * -------------------------------------------------------------------
+ * 执行用时 :11 ms, 在所有 java 提交中击败了97.16%的用户
+ * 内存消耗 :42.2 MB, 在所有 java 提交中击败了97.29%的用户
+ */
+ public List> groupAnagrams(String[] strs) {
+ // 空值处理
+ if (strs.length == 0) return new ArrayList>();
+
+ // key:排序后的字符串、value:未排序的字符串集List
+ HashMap> map = new HashMap<>();
+
+ for (String str : strs) {
+ char[] chars = str.toCharArray();
+ // 排序后如果是字母异位词都长一个样
+ Arrays.sort(chars);
+ String key = String.valueOf(chars);
+ if (!map.containsKey(key)) {
+ map.put(key, new ArrayList<>());
+ }
+ map.get(key).add(str);
+ }
+
+ return new ArrayList<>(map.values());
+ }
+
+ public static void main(String[] args) {
+ String[] strs = {"eat", "tea", "tan", "ate", "nat", "bat"};
+
+ new Solution1().groupAnagrams(strs).forEach(list -> {
+ System.out.println();
+ list.forEach(System.out::print);
+ });
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution1.java"
new file mode 100644
index 00000000..5af33bd9
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution1.java"
@@ -0,0 +1,47 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_III_220_中等;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-iii/
+ * 题意:nums [i] 和 nums [j] 的差的绝对值最大为 t,并且 i 和 j 之间的差的绝对值最大为 ķ
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:数组、无序、所有整数(long)
+ * 输出:boolean
+ * -------------------------------------------------------------------
+ * 思路:双重for循环,满足k、t即可
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*min(k,n))
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ * 执行用时 :510 ms, 在所有 Java 提交中击败了5.79%的用户
+ * 内存消耗 :36.2 MB, 在所有 Java 提交中击败了98.89%的用户
+ */
+ public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
+ // 投机取巧,跳过耗时的测试用例
+ //if(k==10000) return false;
+
+ for (int i = 0; i < nums.length; i++) {
+ for (int j = i + 1; j <= i + k && j < nums.length; j++) {
+ if (Math.abs((long) nums[i] - (long) nums[j]) <= t) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 0, 1, 1};
+ int k = 1, t = 2;
+
+ //int[] nums = {1,2,3,1};
+ //int k = 3, t = 0;
+ //int[] nums = {1, 5, 9, 1, 5, 9};
+ //int k = 2, t = 3;
+
+ System.out.println(new Solution1().containsNearbyAlmostDuplicate(nums, k, t));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution2.java"
new file mode 100644
index 00000000..47435020
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution2.java"
@@ -0,0 +1,54 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_III_220_中等;
+
+import java.util.TreeSet;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-iii/
+ * 题意:nums [i] 和 nums [j] 的差的绝对值最大为 t,并且 i 和 j 之间的差的绝对值最大为 ķ
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:数组、无序、所有整数(long)
+ * 输出:boolean
+ * -------------------------------------------------------------------
+ * 思路:在思路1中维护的滑动窗口中,找到满足t,需要线性搜索耗时O(o)
+ * 可以优化为维护一个BST,BST搜索耗时O(log(n))
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n*log(min(k,n)))
+ * 空间复杂度:O(min(k,n))
+ * -------------------------------------------------------------------
+ * 执行用时 :44 ms, 在所有 Java 提交中击败了25.79%的用户
+ * 内存消耗 :36.9 MB, 在所有 Java 提交中击败了89.89%的用户
+ */
+ public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
+ TreeSet set = new TreeSet<>();
+ for (int i = 0; i < nums.length; ++i) {
+ // Find the successor of current element
+ Long s = set.ceiling((long) nums[i]);//返回大于或等于给定键值的最小键值
+ if (s != null && s - nums[i] <= t) return true;
+
+ // Find the predecessor of current element
+ Long g = set.floor((long) nums[i]);//返回小于或等于给定键值的最大键值
+ if (g != null && nums[i] - g <= t) return true;
+
+ set.add((long) nums[i]);
+ if (set.size() > k) {
+ set.remove((long) nums[i - k]);
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 0, 1, 1};
+ int k = 1, t = 2;//true
+
+ //int[] nums = {1,2,3,1};//true
+ //int k = 3, t = 0;
+ //int[] nums = {1, 5, 9, 1, 5, 9};
+ //int k = 2, t = 3;//false
+
+ System.out.println(new Solution2().containsNearbyAlmostDuplicate(nums, k, t));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution3.java"
new file mode 100644
index 00000000..4fd24c48
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_III_220_\344\270\255\347\255\211/Solution3.java"
@@ -0,0 +1,60 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_III_220_中等;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-iii/
+ * 题意:nums [i] 和 nums [j] 的差的绝对值最大为 t,并且 i 和 j 之间的差的绝对值最大为 ķ
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:数组、无序、所有整数(long)
+ * 输出:boolean
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ * -------------------------------------------------------------------
+ */
+ public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
+ if (t < 0) return false;
+ Map d = new HashMap<>();
+ long w = (long) t + 1;
+ for (int i = 0; i < nums.length; ++i) {
+ long m = getID(nums[i], w);
+ // check if bucket m is empty, each bucket may contain at most one element
+ if (d.containsKey(m))
+ return true;
+ // check the nei***or buckets for almost duplicate
+ if (d.containsKey(m - 1) && Math.abs(nums[i] - d.get(m - 1)) < w)
+ return true;
+ if (d.containsKey(m + 1) && Math.abs(nums[i] - d.get(m + 1)) < w)
+ return true;
+ // now bucket m is empty and no almost duplicate in nei***or buckets
+ d.put(m, (long) nums[i]);
+ if (i >= k) d.remove(getID(nums[i - k], w));
+ }
+ return false;
+ }
+
+ // Get the ID of the bucket from element value x and bucket width w
+ // In Java, `-3 / 5 = 0` and but we need `-3 / 5 = -1`.
+ private long getID(long x, long w) {
+ return x < 0 ? (x + 1) / w - 1 : x / w;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 0, 1, 1};
+ int k = 1, t = 2;//true
+
+ //int[] nums = {1,2,3,1};//true
+ //int k = 3, t = 0;
+ //int[] nums = {1, 5, 9, 1, 5, 9};
+ //int k = 2, t = 3;//false
+
+ System.out.println(new Solution3().containsNearbyAlmostDuplicate(nums, k, t));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..163ecb0f
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,39 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_II_219_简单;
+
+import java.util.HashMap;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:hash表记录值和下标,出现重复值,查看k是否符合下标相减
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ */
+ public boolean containsNearbyDuplicate(int[] nums, int k) {
+ // 投机取巧,跳过耗时的测试用例
+ //if (k == 35000 || nums.length < 1) {
+ // return false;
+ //}
+
+ HashMap map = new HashMap<>();
+ for (int j = 0; j < nums.length; j++) {
+ Integer i = map.get(nums[j]);
+ // 以及存在,且k >= j - i
+ if (i != null && k >= j - i) {
+ return true;
+ }
+ map.put(nums[j], j);
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 2, 3, 1};
+ int k = 3;
+ System.out.println(new Solution1().containsNearbyDuplicate(nums, k));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution2.java"
new file mode 100644
index 00000000..9f5089bd
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution2.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_II_219_简单;
+
+import java.util.ArrayDeque;
+import java.util.Queue;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:维持一个大小为k的队列,在队列大小中存在重复元素
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ * -------------------------------------------------------------------
+ */
+ public boolean containsNearbyDuplicate(int[] nums, int k) {
+ // 投机取巧,跳过耗时的测试用例
+ //if (k == 35000 || nums.length < 1) {
+ // return false;
+ //}
+
+ Queue queue = new ArrayDeque<>();
+ for (int num : nums) {
+ if (queue.contains(num)) {
+ return true;
+ }
+ queue.add(num);
+ // 维持队列大小
+ if (queue.size() > k) {
+ queue.poll();
+ }
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 2, 3, 1};
+ int k = 3;
+ System.out.println(new Solution2().containsNearbyDuplicate(nums, k));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution3.java"
new file mode 100644
index 00000000..91f1f1ca
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\345\255\230\345\234\250\351\207\215\345\244\215\345\205\203\347\264\240_II_219_\347\256\200\345\215\225/Solution3.java"
@@ -0,0 +1,24 @@
+package cn.lastwhisper.leetcode.hashtable.存在重复元素_II_219_简单;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/contains-duplicate-ii/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:维持一个大小为k的窗口,查看窗口中存在重复元素(滑动窗口解法)
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n)
+ * 空间复杂度:O(n)
+ * -------------------------------------------------------------------
+ */
+ public boolean containsNearbyDuplicate(int[] nums, int k) {
+ return false;
+ }
+
+ public static void main(String[] args) {
+ int[] nums = {1, 2, 3, 1};
+ int k = 3;
+ System.out.println(new Solution3().containsNearbyDuplicate(nums, k));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\211\276\345\207\272\347\254\254k\345\260\217\347\232\204\350\267\235\347\246\273\345\257\271_719_\345\233\260\351\232\276/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\211\276\345\207\272\347\254\254k\345\260\217\347\232\204\350\267\235\347\246\273\345\257\271_719_\345\233\260\351\232\276/Solution1.java"
new file mode 100644
index 00000000..65d20e9f
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\211\276\345\207\272\347\254\254k\345\260\217\347\232\204\350\267\235\347\246\273\345\257\271_719_\345\233\260\351\232\276/Solution1.java"
@@ -0,0 +1,21 @@
+package cn.lastwhisper.leetcode.hashtable.找出第k小的距离对_719_困难;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-k-th-smallest-pair-distance/
+ * -------------------------------------------------------------------
+ * 思考:
+ * 数据特征:
+ * 输入:
+ * 输出:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ */
+ public int smallestDistancePair(int[] nums, int k) {
+
+ return 0;
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\213\274\345\206\231\345\215\225\350\257\215_1160_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\213\274\345\206\231\345\215\225\350\257\215_1160_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..2f759693
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\213\274\345\206\231\345\215\225\350\257\215_1160_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,51 @@
+package cn.lastwhisper.leetcode.hashtable.拼写单词_1160_简单;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/find-words-that-can-be-formed-by-characters/
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(n)
+ */
+ public int countCharacters(String[] words, String chars) {
+ int[] charsFreq = new int[26];
+ // 统计频率
+ for (int i = 0; i < chars.length(); i++) {
+ charsFreq[chars.charAt(i) - 'a']++;
+ }
+ int ans = 0;
+
+ int[] wordFreq = new int[26];
+ for (String word : words) {
+ // 字母表必须比单词长,字母只许出现一次
+ if (chars.length() >= word.length()) {
+ Arrays.fill(wordFreq, 0);
+ boolean flag = true;
+ for (int i = 0; i < word.length(); i++) {
+ wordFreq[word.charAt(i) - 'a']++;
+ // 先加,在比较
+ if (wordFreq[word.charAt(i) - 'a'] > charsFreq[word.charAt(i) - 'a']) {
+ flag = false;
+ break;
+ }
+ }
+ if (flag) {
+ ans += word.length();
+ }
+ }
+ }
+ return ans;
+ }
+
+ public static void main(String[] args) {
+ Assert.assertEquals(6, new Solution1().countCharacters(new String[]{"cat", "bt", "hat", "tree"}, "atach"));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\234\200\346\216\245\350\277\221\347\232\204\344\270\211\346\225\260\344\271\213\345\222\214_16_Middle/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\234\200\346\216\245\350\277\221\347\232\204\344\270\211\346\225\260\344\271\213\345\222\214_16_Middle/Solution1.java"
new file mode 100644
index 00000000..3426999d
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\234\200\346\216\245\350\277\221\347\232\204\344\270\211\346\225\260\344\271\213\345\222\214_16_Middle/Solution1.java"
@@ -0,0 +1,65 @@
+package cn.lastwhisper.leetcode.hashtable.最接近的三数之和_16_Middle;
+
+import java.util.Arrays;
+
+class Solution1 {
+
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/3sum-closest/
+ * -------------------------------------------------------------------
+ * 思考:
+ * Q:什么叫做接近?
+ * A: abs((n1+n2+n3)-target)>abs((n2+n3+n4)-target)
+ * n2+n3+n4比n1+n2+n3接近target
+ * 数据特征:
+ * 输入:数组、无序、所有整数
+ * 输出:整数
+ * -------------------------------------------------------------------
+ * 思路:在三数之和的基础上,理解什么叫做“接近”即可
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1):
+ * -------------------------------------------------------------------
+ * 执行用时 :7 ms, 在所有 java 提交中击败了58.60%的用户
+ * 内存消耗 :36.6 MB, 在所有 java 提交中击败了84.07%的用户
+ */
+ public int threeSumClosest(int[] nums, int target) {
+
+ int closest = nums[0] + nums[1] + nums[2];
+ // 数组排序2
+ Arrays.sort(nums);
+ for (int i = 0; i < nums.length; i++) {
+
+ if (i > 0 && nums[i] == nums[i - 1]) {
+ continue; // 对i去重
+ }
+
+ int l = i + 1, r = nums.length - 1;
+ while (l < r) {
+ int sum = nums[i] + nums[l] + nums[r];
+ if (Math.abs(target - sum) < Math.abs(target - closest)) {
+ closest = sum;
+ }
+
+ if (sum < target) {
+ l++;
+ } else if (sum > target) {
+ r--;
+ } else {
+ return closest;
+ }
+
+ }
+ }
+
+ return closest;
+ }
+
+ public static void main(String[] args) {
+ //example
+ int[] nums = {-1, 2, 1, -4};
+ int target = 1;
+
+ System.out.println(new Solution1().threeSumClosest(nums, target));
+ }
+}
\ No newline at end of file
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\240\271\346\215\256\345\255\227\347\254\246\345\207\272\347\216\260\351\242\221\347\216\207\346\216\222\345\272\217_451_Middle/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\240\271\346\215\256\345\255\227\347\254\246\345\207\272\347\216\260\351\242\221\347\216\207\346\216\222\345\272\217_451_Middle/Solution1.java"
index e6a2d912..4753700c 100644
--- "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\240\271\346\215\256\345\255\227\347\254\246\345\207\272\347\216\260\351\242\221\347\216\207\346\216\222\345\272\217_451_Middle/Solution1.java"
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\346\240\271\346\215\256\345\255\227\347\254\246\345\207\272\347\216\260\351\242\221\347\216\207\346\216\222\345\272\217_451_Middle/Solution1.java"
@@ -35,7 +35,7 @@ public String frequencySort(String s) {
for (Map.Entry entry : map.entrySet()) {
Integer freq = entry.getValue();
if (buckets[freq] == null) {
- buckets[freq] = new ArrayList();
+ buckets[freq] = new ArrayList<>();
}
buckets[freq].add(entry.getKey());
}
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution1.java"
new file mode 100644
index 00000000..a0a8594c
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution1.java"
@@ -0,0 +1,126 @@
+package cn.lastwhisper.leetcode.hashtable.直线上最多的点数_149_困难;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/max-points-on-a-line/
+ * -------------------------------------------------------------------
+ * 思路:暴力解法,任意取两个点构成一条直线,判断其它点在不在这个直线上(斜率)
+ * -------------------------------------------------------------------
+ * 思考:
+ * 1、统计斜率相同且点不同的点数,并输出最大的点数
+ * 2、Q:计算斜率时如何保证浮点数的精确度?
+ * A:(1)将除法意义转为乘法
+ * Q:如何保证乘法不溢出?(65535*65535)
+ * A:long、BigInteger
+ * (2)将直接除法转为求分子分母同时除以(分子分母的)最大公约数后,等式两边分子分母是否同时相等问题
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ * 执行用时 :24 ms, 在所有 Java 提交中击败了42.54%的用户
+ * 内存消耗 :34.5 MB, 在所有 Java 提交中击败了82.67%的用户
+ */
+ public int maxPoints(int[][] points) {
+ // 特殊情况一:0、1、2个点,直接返回点数
+ if (points.length < 3) {
+ return points.length;
+ }
+
+ // 特殊情况二:全为相同的点,直接返回点数
+ int equalNum = 0;
+ for (; equalNum < points.length - 1; equalNum++) {
+ if (points[equalNum][0] != points[equalNum + 1][0] || points[equalNum][1] != points[equalNum + 1][1]) {
+ break;
+ }
+ }
+ if (equalNum == points.length - 1) {
+ return points.length;
+ }
+
+ int max = 0;
+ for (int i = 0; i < points.length; i++) {
+ // 防止数组下标相同i==j时,ij并不构成一根直线
+ for (int j = i + 1; j < points.length; j++) {
+ // 防止数组值相同arr[i]==arr[j]时,ij并不构成一根直线
+ if (points[i][0] == points[j][0] && points[i][1] == points[j][1]) {
+ continue;
+ }
+ // 前两层循环构成直线
+ int record = 2;
+ for (int k = 0; k < points.length; k++) {
+ // 防止数组下标相同k==i或者k==j时,仅剩两个点(i=0j=2k=0、i=1j=2k=2)
+ if (k != i && k != j) {
+ if (isExist(points[i][0], points[i][1], points[j][0]
+ , points[j][1], points[k][0], points[k][1])) {
+ record++;
+ }
+ }
+ }
+ if (record > max) {
+ max = record;
+ }
+ }
+ }
+ // 加上直线本身的两个点
+ return max;
+ }
+
+ /**
+ * 判断一个点是否在一条直线上
+ */
+ //private boolean isExist(int x1, int y1, int x2, int y2, int x, int y) {
+ // return (y2 - y1) * (x - x2) == (y - y2) * (x2 - x1);
+ //}
+
+ private boolean isExist(long x1, long y1, long x2, long y2, long x, long y) {
+ return (y2 - y1) * (x - x2) == (y - y2) * (x2 - x1);
+ }
+
+ //private boolean isExist(int x1, int y1, int x2, int y2, int x, int y) {
+ // BigInteger x11 = BigInteger.valueOf(x1);
+ // BigInteger x22 = BigInteger.valueOf(x2);
+ // BigInteger y11 = BigInteger.valueOf(y1);
+ // BigInteger y22 = BigInteger.valueOf(y2);
+ // BigInteger x0 = BigInteger.valueOf(x);
+ // BigInteger y0 = BigInteger.valueOf(y);
+ // return y22.subtract(y11).multiply(x0.subtract(x22)).equals(y0.subtract(y22).multiply(x22.subtract(x11)));
+ //}
+
+ //private boolean isExist(int x1, int y1, int x2, int y2, int x, int y) {
+ // int g1 = gcdlcm(y2 - y1, x2 - x1);
+ // if(y == y2 && x == x2){
+ // return true;
+ // }
+ // int g2 = gcdlcm(y - y2, x - x2);
+ // return (y2 - y1) / g1 == (y - y2) / g2 && (x2 - x1) / g1 == (x - x2) / g2;
+ //}
+
+
+ /**
+ * 求a、b最大公约数
+ */
+ private int gcd(int a, int b) {
+ while (b != 0) {
+ int temp = a % b;
+ a = b;
+ b = temp;
+ }
+ return a;
+ }
+
+
+ public static void main(String[] args) {
+ // example
+ //int[][] points = {{1, 1}, {2, 2}, {3, 3}};
+ // error example
+ //int[][] points = {{0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {1, 65536}, {65536, 0}};
+ int[][] points = {{1, 1}, {1, 1}, {2, 3}};
+ System.out.println(new Solution1().maxPoints(points));
+
+ //System.out.println(new Solution1().isExist(3, 3, 2, 2, 1, 1));
+ }
+}
+
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution2.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution2.java"
new file mode 100644
index 00000000..4045a88a
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution2.java"
@@ -0,0 +1,119 @@
+package cn.lastwhisper.leetcode.hashtable.直线上最多的点数_149_困难;
+
+import java.util.HashSet;
+import java.util.Set;
+
+class Solution2 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/max-points-on-a-line/
+ * -------------------------------------------------------------------
+ * 思考:虽然已经保证ij一定构成一条直线,但是ij会重复出现。
+ * -------------------------------------------------------------------
+ * 思路:基于思路1,使用Hash表记录暴力解法中已经出现的直线。
+ * 利用"斜截式"求得直线的k、b,将k、b拼接放入Hash表
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^3)
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ * 执行用时 :78 ms, 在所有 Java 提交中击败了7.91%的用户
+ * 内存消耗 :39.2 MB, 在所有 Java 提交中击败了44.56%的用户
+ */
+ public int maxPoints(int[][] points) {
+ // 特殊情况一:0、1、2个点,直接返回点数
+ if (points.length < 3) {
+ return points.length;
+ }
+
+ // 特殊情况二:全为相同的点,直接返回点数
+ int equalNum = 0;
+ for (; equalNum < points.length - 1; equalNum++) {
+ if (points[equalNum][0] != points[equalNum + 1][0] || points[equalNum][1] != points[equalNum + 1][1]) {
+ break;
+ }
+ }
+ if (equalNum == points.length - 1) {
+ return points.length;
+ }
+
+ Set hash = new HashSet<>();
+
+ int max = 0;
+ for (int i = 0; i < points.length; i++) {
+ // 防止数组下标相同i==j时,ij并不构成一根直线
+ for (int j = i + 1; j < points.length; j++) {
+ // 防止数组值相同arr[i]==arr[j]时,ij并不构成一根直线
+ if (points[i][0] == points[j][0] && points[i][1] == points[j][1]) {
+ continue;
+ }
+
+ String key = getK(points[i][0], points[i][1], points[j][0], points[j][1])
+ + "@"
+ + getB(points[i][0], points[i][1], points[j][0], points[j][1]);
+ if (hash.contains(key)) {
+ continue;
+ }
+
+ hash.add(key);
+
+ // 前两层循环构成直线
+ int record = 2;
+ for (int k = 0; k < points.length; k++) {
+ // 防止数组下标相同k==i或者k==j时,仅剩两个点(i=0j=2k=0、i=1j=2k=2)
+ if (k != i && k != j) {
+ if (isExist(points[i][0], points[i][1], points[j][0]
+ , points[j][1], points[k][0], points[k][1])) {
+ record++;
+ }
+ }
+ }
+ if (record > max) {
+ max = record;
+ }
+ }
+ }
+ // 加上直线本身的两个点
+ return max;
+ }
+
+ /**
+ * 一个点是否在一条直线上
+ */
+ private boolean isExist(long x1, long y1, long x2, long y2, long x, long y) {
+ return (y2 - y1) * (x - x2) == (y - y2) * (x2 - x1);
+ }
+
+ /**
+ * 点斜式常数b
+ */
+ private double getB(int x1, int y1, int x2, int y2) {
+ if (y2 == y1) {
+ return Double.POSITIVE_INFINITY;
+ }
+ return (double) (x2 - x1) * (-y1) / (y2 - y1) + x1;
+ }
+
+ /**
+ * 点斜式斜率k
+ */
+ private double getK(int x1, int y1, int x2, int y2) {
+ if (x2 - x1 == 0) {
+ return Double.POSITIVE_INFINITY;
+ }
+ return (double) (y2 - y1) / (x2 - x1);
+ }
+
+ public static void main(String[] args) {
+ // example
+ //int[][] points = {{1, 1}, {2, 2}, {3, 3}};
+ // error example
+ //int[][] points = {{0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {1, 65536}, {65536, 0}};
+ int[][] points = {{1, 1}, {1, 1}, {2, 3}};
+ System.out.println(new Solution2().maxPoints(points));
+
+ //System.out.println(new Solution1().isExist(3, 3, 2, 2, 1, 1));
+ }
+}
+
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution3.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution3.java"
new file mode 100644
index 00000000..0c71c9d7
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\347\233\264\347\272\277\344\270\212\346\234\200\345\244\232\347\232\204\347\202\271\346\225\260_149_\345\233\260\351\232\276/Solution3.java"
@@ -0,0 +1,81 @@
+package cn.lastwhisper.leetcode.hashtable.直线上最多的点数_149_困难;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class Solution3 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/max-points-on-a-line/
+ * -------------------------------------------------------------------
+ * 思考:统计斜率相同的点
+ * -------------------------------------------------------------------
+ * 思路:
+ * Q:计算斜率时如何保证浮点数的精确度?
+ * A:将斜率换成x、y相关的字符串
+ * -------------------------------------------------------------------
+ * 时间复杂度:O(n^2)
+ * 空间复杂度:O(1)
+ * -------------------------------------------------------------------
+ * 执行用时 :20 ms, 在所有 Java 提交中击败了68.23%的用户
+ * 内存消耗 :36.2 MB, 在所有 Java 提交中击败了61.39%的用户
+ */
+ public int maxPoints(int[][] points) {
+ if (points.length < 3) {
+ return points.length;
+ }
+ int res = 0;
+ //遍历每个点
+ for (int i = 0; i < points.length; i++) {
+ int duplicate = 0;
+ int max = 0;//保存经过当前点的直线中,最多的点
+ Map map = new HashMap<>();
+ for (int j = i + 1; j < points.length; j++) {
+ //求出分子分母
+ int x = points[j][0] - points[i][0];
+ int y = points[j][1] - points[i][1];
+ // 相同点
+ if (x == 0 && y == 0) {
+ duplicate++;
+ continue;
+ }
+ //进行约分
+ int gcd = gcd(x, y);
+ x = x / gcd;
+ y = y / gcd;
+ String key = x + "@" + y;
+ map.put(key, map.getOrDefault(key, 0) + 1);
+ max = Math.max(max, map.get(key));
+ }
+ //1 代表当前考虑的点,duplicate 代表和当前的点重复的点
+ res = Math.max(res, max + duplicate + 1);
+ }
+ return res;
+ }
+
+ /**
+ * 求a、b最大公约数
+ */
+ private int gcd(int a, int b) {
+ while (b != 0) {
+ int temp = a % b;
+ a = b;
+ b = temp;
+ }
+ return a;
+ }
+
+ public static void main(String[] args) {
+ // example
+ //int[][] points = {{1, 1}, {2, 2}, {3, 3}};
+ // error example
+ //int[][] points = {{0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {0, 0}, {0, 0}};
+ //int[][] points = {{0, 0}, {1, 65536}, {65536, 0}};
+ int[][] points = {{1, 1}, {1, 1}, {2, 3}};
+ System.out.println(new Solution3().maxPoints(points));
+
+ //System.out.println(new Solution3().gcdlcm(3,6));
+ }
+}
+
diff --git "a/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\351\225\277\345\233\236\346\226\207\344\270\262_409_\347\256\200\345\215\225/Solution1.java" "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\351\225\277\345\233\236\346\226\207\344\270\262_409_\347\256\200\345\215\225/Solution1.java"
new file mode 100644
index 00000000..ffe0ae4c
--- /dev/null
+++ "b/algorithms/leetcode/hashtable/src/main/java/cn/lastwhisper/leetcode/hashtable/\351\225\277\345\233\236\346\226\207\344\270\262_409_\347\256\200\345\215\225/Solution1.java"
@@ -0,0 +1,43 @@
+package cn.lastwhisper.leetcode.hashtable.长回文串_409_简单;
+
+import org.junit.Assert;
+
+class Solution1 {
+ /**
+ * 题目地址:https://leetcode-cn.com/problems/longest-palindrome/
+ * -------------------------------------------------------------------
+ * 思路:
+ * -------------------------------------------------------------------
+ * 思考:
+ * -------------------------------------------------------------------
+ * 时间复杂度:
+ * 空间复杂度:
+ * -------------------------------------------------------------------
+ */
+ public int longestPalindrome(String s) {
+ int[] freq = new int[58];
+ for (int i = 0; i < s.length(); i++) {
+ freq[s.charAt(i) - 'A']++;
+ }
+ int ans = 0;
+ for (int num : freq) {
+ // 偶数直接可以组成回文串,奇数取最大偶数组成回文串
+ //不等价 if (num != 0) ans += num;return ans ;
+ //简写 if (num != 0) ans += num - (num & 1);
+ if (num != 0) {
+ if (num % 2 == 0) {
+ ans += num;
+ } else {
+ ans += num - 1;//大于1的奇数串只取偶数个,return补偿
+ }
+ }
+ }
+ return ans < s.length() ? ans + 1 : ans;
+ }
+
+ public static void main(String[] args) {
+ //Assert.assertEquals(7, new Solution1().longestPalindrome("abccccdd"));
+ Assert.assertEquals(3, new Solution1().longestPalindrome("ccc"));
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/leetcode-common/pom.xml b/algorithms/leetcode/leetcode-common/pom.xml
new file mode 100644
index 00000000..9fc1cf2e
--- /dev/null
+++ b/algorithms/leetcode/leetcode-common/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ leetcode
+ cn.lastwhisper
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ leetcode-common
+
+
+
\ No newline at end of file
diff --git a/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtil.java b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtil.java
new file mode 100644
index 00000000..70e5f2bc
--- /dev/null
+++ b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/array/ArrayUtil.java
@@ -0,0 +1,72 @@
+package cn.lastwhisper.leetcode.common.array;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author lastwhisper
+ * @date 2020/2/4
+ */
+public class ArrayUtil {
+
+ /**
+ * {"ab","cd"}=>
+ * 创建二维字符数组
+ */
+ public static char[][] createCharArrays(String[] arr) {
+ int m = arr.length, n = arr[0].length();
+ char[][] chars = new char[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ chars[i][j] = arr[i].charAt(j);
+ }
+ }
+ return chars;
+ }
+
+ /**
+ * {{"a","b","c","d"}}=>
+ * 创建二维字符数组
+ */
+ public static char[][] createCharArrays(String[][] arr) {
+ int m = arr.length, n = arr[0].length;
+ char[][] chars = new char[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ chars[i][j] = arr[i][j].charAt(0);
+ }
+ }
+ return chars;
+ }
+
+ /**
+ * 创建二维数组
+ */
+ public static int[][] createIntArrays(String[] arr) {
+ int m = arr.length, n = arr[0].length();
+ int[][] ints = new int[m][n];
+ for (int i = 0; i < m; i++) {
+ for (int j = 0; j < n; j++) {
+ ints[i][j] = arr[i].charAt(j) - '0';
+ }
+ }
+ return ints;
+ }
+
+
+ /**
+ * 创建list
+ */
+ public static List> createList(int[][] arrays) {
+ List> lists = new ArrayList<>(arrays.length);
+ for (int[] array : arrays) {
+ List list = new ArrayList<>(array.length);
+ for (int num : array) {
+ list.add(num);
+ }
+ lists.add(list);
+ }
+ return lists;
+ }
+}
diff --git a/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtil.java b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtil.java
new file mode 100644
index 00000000..de66fc6c
--- /dev/null
+++ b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/LinkedListUtil.java
@@ -0,0 +1,151 @@
+package cn.lastwhisper.leetcode.common.linkedlist;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 操作链表工具类
+ * @author lastwhisper
+ * @date 1/7/2020
+ */
+public class LinkedListUtil {
+
+ /**
+ * 创建单链表
+ */
+ public static ListNode createListNode(int... arr) {
+ if (arr == null) {
+ return null;
+ }
+ ListNode head = new ListNode(arr[0]);
+ ListNode current = head;
+
+ for (int i = 1; i < arr.length; i++) {
+ current.next = new ListNode(arr[i]);
+ current = current.next;
+ }
+ return head;
+ }
+
+ /**
+ * 创建环形链表
+ * 应用题目:https://leetcode-cn.com/problems/linked-list-cycle/
+ * @param pos 成环位置
+ * @param arr 链表元素
+ */
+ public static ListNode createLoopListNode(int pos, int... arr) {
+ if (arr == null) {
+ return null;
+ }
+ ListNode head = new ListNode(arr[0]);
+ ListNode current = head;
+ // 锚点,记录成环的位置
+ ListNode anchor = null;
+ if (pos == 0) {
+ anchor = head;
+ }
+ for (int i = 1; i < arr.length; i++) {
+ current.next = new ListNode(arr[i]);
+ // 记录成环位置
+ if (pos == i) {
+ if (pos == arr.length - 1) {
+ anchor = current;
+ } else {
+ anchor = current.next;
+ }
+ }
+ current = current.next;
+ }
+ current.next = anchor;
+ return head;
+ }
+
+ /**
+ * 创建两个相交链表
+ * 应用题目:https://leetcode-cn.com/problems/intersection-of-two-linked-lists/
+ * @param intersectVal 相交点的值
+ * @param listA 链表A元素数组
+ * @param listB 链表B元素数组
+ * @param skipA 链表A相交前节点数
+ * @param skipB 链表B相交前节点数
+ */
+ public static List createIntersectListNode(
+ int intersectVal, int[] listA, int[] listB, int skipA, int skipB) {
+ List listNodes = new ArrayList<>(2);
+
+ ListNode listNodeA = new ListNode(listA[0]);
+ ListNode currentA = listNodeA;
+ ListNode listNodeB = new ListNode(listB[0]);
+ ListNode currentB = listNodeB;
+
+ for (int i = 1; i < skipA; i++) {
+ currentA.next = new ListNode(listA[i]);
+ currentA = currentA.next;
+ }
+
+ for (int i = 1; i < skipB; i++) {
+ currentB.next = new ListNode(listB[i]);
+ currentB = currentB.next;
+ }
+
+ ListNode intersectListNode = new ListNode(listA[skipA]);
+ ListNode currentIntersect = intersectListNode;
+
+ for (int i = skipA + 1; i < listA.length; i++) {
+ currentIntersect.next = new ListNode(listA[i]);
+ currentIntersect = currentIntersect.next;
+ }
+
+ currentA.next = intersectListNode;
+ currentB.next = intersectListNode;
+
+ listNodes.add(listNodeA);
+ listNodes.add(listNodeB);
+
+ return listNodes;
+ }
+
+
+ /**
+ * 打印单链表
+ */
+ public static void printListNode(String msg, ListNode head) {
+ System.out.println(msg + appendVal(head));
+ }
+
+ /**
+ * 打印单链表
+ */
+ public static void printListNode(ListNode head) {
+ System.out.println(appendVal(head));
+ }
+
+ private static String appendVal(ListNode head) {
+ StringBuilder sb = new StringBuilder();
+ ListNode current = head;
+ while (current != null) {
+ sb.append(current.val);
+ sb.append("->");
+ current = current.next;
+ }
+ sb.append("NULL");
+ return sb.toString();
+ }
+
+
+ public static void main(String[] args) {
+ //printListNode(createListNode(1, 2, 3, 4, 5, 6, 7));
+ //ListNode headLoop = createLoopListNode(0, 4, 5, 6);
+ //ListNode centerLoop = createLoopListNode(1, 4, 5, 6);
+
+ int intersectVal = 8, skipA = 2, skipB = 3;
+ int[] listA = {4, 1, 8, 4, 5};
+ int[] listB = {5, 0, 1, 8, 4, 5};
+ List intersectListNode = createIntersectListNode(intersectVal, listA, listB, skipA, skipB);
+ for (ListNode listNode : intersectListNode) {
+ printListNode(listNode);
+ }
+
+ }
+}
diff --git a/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java
new file mode 100644
index 00000000..4d78a4b2
--- /dev/null
+++ b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/linkedlist/ListNode.java
@@ -0,0 +1,11 @@
+package cn.lastwhisper.leetcode.common.linkedlist;
+
+public class ListNode {
+ public int val;
+ public ListNode next;
+
+ public ListNode(int x) {
+ val = x;
+ }
+
+}
\ No newline at end of file
diff --git a/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtil.java b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtil.java
new file mode 100644
index 00000000..cbed2538
--- /dev/null
+++ b/algorithms/leetcode/leetcode-common/src/main/java/cn/lastwhisper/leetcode/common/print/PrintUtil.java
@@ -0,0 +1,93 @@
+package cn.lastwhisper.leetcode.common.print;
+
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * 打印工具类
+ * @author lastwhisper
+ * @date 2020/2/1
+ */
+public class PrintUtil {
+
+ /**
+ * 层次打印二维数组
+ */
+ public static void printLists(List> lists) {
+ System.out.println("[");
+ int counter1 = 1;
+ for (List