From 0829e6fd79c8d932f541c0e9ead03f796a18d7fa Mon Sep 17 00:00:00 2001 From: zoudikai Date: Mon, 11 Feb 2019 23:21:47 +0800 Subject: [PATCH 1/7] =?UTF-8?q?[fix]=20=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84graphql=E7=9A=84api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- README.md | 409 +++++++++++----- README.tpl | 24 + lib/runtimeConf.js | 2 +- lib/spider.js | 166 +++++-- package-lock.json | 1139 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 7 files changed, 1591 insertions(+), 156 deletions(-) create mode 100644 README.tpl create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index 639fd3e..0d4d497 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ private.* log/* .DS_Store result.json -npm-debug.log \ No newline at end of file +npm-debug.log +solutions +.vscode +config.json \ No newline at end of file diff --git a/README.md b/README.md index 1d51768..dbb66ea 100644 --- a/README.md +++ b/README.md @@ -1,115 +1,296 @@ -# 此项目已不再维护,有需要者,欢迎 fork -苦于工作繁忙,我已经不刷题很久了,没有使用需求就难以保持爬虫逻辑紧跟 leetcode 官网更新。欢迎 fork,解决需求。 - -# leetcode-spider [![npm package](https://img.shields.io/npm/v/leetcode-spider.svg)](https://www.npmjs.com/package/leetcode-spider) - -使用 JS 编写的 leetcode 解题源码爬虫.爬取你自己的 leetcode 解题源码. - -如果你也想把你在 [leetcode](https://leetcode.com/) 上提交且 accepted 的解题代码爬下来,那么本工具就是为此需求而生!爬下来的代码可以放在 github 上管理和开源出来,可以作为个人展示,更可以借助 [leetcode-viewer](https://github.com/Ma63d/leetcode-viewer) 将代码通过一个单页应用完美展现,几条命令就可以呈现一个 leetcode 源码博客,交流和展示搞起来! - -## 新版本来了 - -- 支持使用模板语法来配置你自己的 README.md 模板了! -- 新增部分配置项 -- 优化 README.md 输出: - ![](img/example.png) -- 优化网络错误处理机制 - - -**需要 Node 4.0 及以上版本!** - -## 安装 Installation - -``` -npm i leetcode-spider -g -``` - - -## 使用 Usage - -请事先建立好如下 json 文件(以命名为 config.json 为例): - - -``` -{ - "username" : "hello@gmail.com", - "password" : "xxxxxxxxx", - "language": ["java","c++","c"], - "outputDir": "./solutions", (可选字段) - "template": "./README.tpl" (可选字段) -} -``` - -- `username` 和 `password` 对应你的的 leetcode 账户. - - -- `language` 对应于你用来解 leetcode 的编程语言,该项为一个数组,即使只有一种语言. -目前 `language` 字段支持填写所有 leetcode 的编程语言: - - `c++`(别填`cpp`) - - `c` - - `java` - - `javascript` (别填`js`) - - `python` - - `c#` (别填`csharp`) - - `ruby` - - `swift` - - `go` - -- `outputDir` **选填**,表示你希望存放源码文件的目录,默认`"./solutions"` -- `template` **选填**,表示你自己定义的 README.tpl 路径,默认 "./README.tpl" - - -## 运行 Execution - -``` -lc-spider // 默认使用config.json为配置文件运行爬虫 -``` -**程序会记录上一次爬取了哪些题目,之前爬取过的题目再次运行的时候不会爬取,除非你通过-n选项手动指定.** - -**这也意味着,当你在进行增量爬取时,根本不需要去指定要爬哪些题目, leetcode-spider 会自动知道哪些题目需要爬.** - -举个例子,按照我们的日常使用: - -* 当你昨天 A 了5道题,你用爬虫爬了下来 -* 然后今天你 A 了6道题,你今天再次运行程序 - -程序此时会自动检查你跟上一次爬取结果相比多写了哪些题,然后把这些新增的代码爬取下来,不会重复的去爬取,你也不用手工指定你今天 AC 了哪些题. - -永远只用一行命令: `lc-spider`.(除非你想要再去爬以前爬过的题,比如你改进了修改了原先AC的代码,想把新代码爬下来,或者你新增了另一种语言的解法, 那么这种时候可以用-n选项指定具体要爬取的题目,请参考[选项](https://github.com/Ma63d/leetcode-spider#选项)章节的具体内容.) - -此外源码对应的 leetcode 的题目,也会爬取下来,放在代码目录, markdown 格式. - -爬取完成后会自动生成 README.md 文件,当你把爬下来的代码放在 github 上时,README.md 起一个介绍和导航的作用.另外,有的同学的 config.json 文件是直接放在当前的代码存放目录的,那你在把这个目录上传到 github 上之前,请记得写 `.gitignore` 文件,在里面忽略掉你的 config.json 文件!不然你的用户名和密码也传到 github 上公开给大家了(虽然 leetcode 账户屁用没有)。 - -如果你运行 lc-spider 却显示无法找到命令,首先请确认一下你在 npm 安装 lc-spider 的时候是否是全局安装(也就是有没有那个`-g`),如果你是全局安装的,那就是你的 npm 的环境变量配置得不对了,请参考百度的 fis 团队写的 [这篇文章](https://github.com/fex-team/fis/issues/565),方便不熟悉 npm 的同学解决自己遇到的问题. - -## 模板功能 - -嫌默认生成自带的 README.md 不好看?嫌我写的文案不够好? -没关系,现在你可以自定义你的 README.md 模板,使用 [mustache](https://github.com/janl/mustache.js) 语法(就是 vue 用的那一套),自己书写你的 README.md 模板: - -leetcode-spider 第一次运行之后会在你运行命令的目录下生成 [README.tpl](https://github.com/Ma63d/leetcode-spider/blob/master/lib/README.tpl) 文件,如果你对默认生成的 README.md 文件不满意,那你自行修改这个 README.tpl 模板文件即可。程序会在下次运行时使用这个模板文件来生成 README.md . - - - -## 帮助 Help -``` -lc-spider -h -``` - -## 选项 - -### -config or -c -``` -lc-spider -c xxx.json -``` - -使用指定的配置文件运行 lc-spider. 默认使用的是 config.json. - -### -number or -n -``` -lc-spider -n 2-15 3 78-101 -``` - -只爬取你指定的题目,可以使用连字符(如15-100),此处指定的是需要爬取的题号.程序会检查哪些题目你 AC 了,因此你可以放心的填写.比如你a了200-300之间的某几道题,但是不想一个个的指定出来,那你就大胆的写上200-300,程序会查找200-300范围内你 AC 的源码,并爬取下来. +

+

+ + + + +

+

My leetcode solutions

+ +

+ Language: java +
+ Last updated: 2019-02-11 +

+

+ +

The source code is fetched using the tool leetcode-spider.

+ +| # | Problems | Solutions | Difficulty | Acceptance | Paid-Only +|:--:|:-----:|:---------:|:----:|:----:|:----:| +|001|[two-sum](https://leetcode.com/problems/two-sum/)| [java](./solutions/001.two-sum/two-sum.java)|Easy|40.20%|| +|002|[add-two-numbers](https://leetcode.com/problems/add-two-numbers/)| [java](./solutions/002.add-two-numbers/add-two-numbers.java)|Medium|30.41%|| +|003|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [java](./solutions/003.longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.java)|Medium|26.08%|| +|005|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring/)| [java](./solutions/005.longest-palindromic-substring/longest-palindromic-substring.java)|Medium|26.32%|| +|007|[reverse-integer](https://leetcode.com/problems/reverse-integer/)| [java](./solutions/007.reverse-integer/reverse-integer.java)|Easy|25.07%|| +|008|[string-to-integer-atoi](https://leetcode.com/problems/string-to-integer-atoi/)| [java](./solutions/008.string-to-integer-atoi/string-to-integer-atoi.java)|Medium|14.44%|| +|009|[palindrome-number](https://leetcode.com/problems/palindrome-number/)| [java](./solutions/009.palindrome-number/palindrome-number.java)|Easy|41.56%|| +|011|[container-with-most-water](https://leetcode.com/problems/container-with-most-water/)| [java](./solutions/011.container-with-most-water/container-with-most-water.java)|Medium|42.08%|| +|014|[longest-common-prefix](https://leetcode.com/problems/longest-common-prefix/)| [java](./solutions/014.longest-common-prefix/longest-common-prefix.java)|Easy|32.89%|| +|015|[3sum](https://leetcode.com/problems/3sum/)| [java](./solutions/015.3sum/3sum.java)|Medium|23.14%|| +|016|[3sum-closest](https://leetcode.com/problems/3sum-closest/)| [java](./solutions/016.3sum-closest/3sum-closest.java)|Medium|33.87%|| +|018|[4sum](https://leetcode.com/problems/4sum/)| [java](./solutions/018.4sum/4sum.java)|Medium|29.46%|| +|019|[remove-nth-node-from-end-of-list](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)| [java](./solutions/019.remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.java)|Medium|33.92%|| +|020|[valid-parentheses](https://leetcode.com/problems/valid-parentheses/)| [java](./solutions/020.valid-parentheses/valid-parentheses.java)|Easy|35.72%|| +|021|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists/)| [java](./solutions/021.merge-two-sorted-lists/merge-two-sorted-lists.java)|Easy|45.44%|| +|024|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)| [java](./solutions/024.swap-nodes-in-pairs/swap-nodes-in-pairs.java)|Medium|42.76%|| +|026|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| [java](./solutions/026.remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.java)|Easy|39.35%|| +|027|[remove-element](https://leetcode.com/problems/remove-element/)| [java](./solutions/027.remove-element/remove-element.java)|Easy|43.32%|| +|028|[implement-strstr](https://leetcode.com/problems/implement-strstr/)| [java](./solutions/028.implement-strstr/implement-strstr.java)|Easy|31.06%|| +|031|[next-permutation](https://leetcode.com/problems/next-permutation/)| [java](./solutions/031.next-permutation/next-permutation.java)|Medium|29.95%|| +|033|[search-in-rotated-sorted-array](https://leetcode.com/problems/search-in-rotated-sorted-array/)| [java](./solutions/033.search-in-rotated-sorted-array/search-in-rotated-sorted-array.java)|Medium|32.57%|| +|034|[find-first-and-last-position-of-element-in-sorted-array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| [java](./solutions/034.find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.java)|Medium|32.84%|| +|035|[search-insert-position](https://leetcode.com/problems/search-insert-position/)| [java](./solutions/035.search-insert-position/search-insert-position.java)|Easy|40.37%|| +|036|[valid-sudoku](https://leetcode.com/problems/valid-sudoku/)| [java](./solutions/036.valid-sudoku/valid-sudoku.java)|Medium|41.53%|| +|038|[count-and-say](https://leetcode.com/problems/count-and-say/)| [java](./solutions/038.count-and-say/count-and-say.java)|Easy|39.27%|| +|039|[combination-sum](https://leetcode.com/problems/combination-sum/)| [java](./solutions/039.combination-sum/combination-sum.java)|Medium|46.23%|| +|040|[combination-sum-ii](https://leetcode.com/problems/combination-sum-ii/)| [java](./solutions/040.combination-sum-ii/combination-sum-ii.java)|Medium|39.77%|| +|045|[jump-game-ii](https://leetcode.com/problems/jump-game-ii/)| [java](./solutions/045.jump-game-ii/jump-game-ii.java)|Hard|27.21%|| +|048|[rotate-image](https://leetcode.com/problems/rotate-image/)| [java](./solutions/048.rotate-image/rotate-image.java)|Medium|46.40%|| +|053|[maximum-subarray](https://leetcode.com/problems/maximum-subarray/)| [java](./solutions/053.maximum-subarray/maximum-subarray.java)|Easy|42.56%|| +|054|[spiral-matrix](https://leetcode.com/problems/spiral-matrix/)| [java](./solutions/054.spiral-matrix/spiral-matrix.java)|Medium|29.41%|| +|055|[jump-game](https://leetcode.com/problems/jump-game/)| [java](./solutions/055.jump-game/jump-game.java)|Medium|31.12%|| +|056|[merge-intervals](https://leetcode.com/problems/merge-intervals/)| [java](./solutions/056.merge-intervals/merge-intervals.java)|Medium|34.58%|| +|058|[length-of-last-word](https://leetcode.com/problems/length-of-last-word/)| [java](./solutions/058.length-of-last-word/length-of-last-word.java)|Easy|32.13%|| +|061|[rotate-list](https://leetcode.com/problems/rotate-list/)| [java](./solutions/061.rotate-list/rotate-list.java)|Medium|26.33%|| +|062|[unique-paths](https://leetcode.com/problems/unique-paths/)| [java](./solutions/062.unique-paths/unique-paths.java)|Medium|46.05%|| +|063|[unique-paths-ii](https://leetcode.com/problems/unique-paths-ii/)| [java](./solutions/063.unique-paths-ii/unique-paths-ii.java)|Medium|33.22%|| +|064|[minimum-path-sum](https://leetcode.com/problems/minimum-path-sum/)| [java](./solutions/064.minimum-path-sum/minimum-path-sum.java)|Medium|45.20%|| +|066|[plus-one](https://leetcode.com/problems/plus-one/)| [java](./solutions/066.plus-one/plus-one.java)|Easy|40.56%|| +|067|[add-binary](https://leetcode.com/problems/add-binary/)| [java](./solutions/067.add-binary/add-binary.java)|Easy|37.64%|| +|069|[sqrtx](https://leetcode.com/problems/sqrtx/)| [java](./solutions/069.sqrtx/sqrtx.java)|Easy|30.47%|| +|070|[climbing-stairs](https://leetcode.com/problems/climbing-stairs/)| [java](./solutions/070.climbing-stairs/climbing-stairs.java)|Easy|43.15%|| +|082|[remove-duplicates-from-sorted-list-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/)| [java](./solutions/082.remove-duplicates-from-sorted-list-ii/remove-duplicates-from-sorted-list-ii.java)|Medium|32.01%|| +|083|[remove-duplicates-from-sorted-list](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)| [java](./solutions/083.remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.java)|Easy|41.76%|| +|086|[partition-list](https://leetcode.com/problems/partition-list/)| [java](./solutions/086.partition-list/partition-list.java)|Medium|36.06%|| +|088|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array/)| [java](./solutions/088.merge-sorted-array/merge-sorted-array.java)|Easy|34.62%|| +|091|[decode-ways](https://leetcode.com/problems/decode-ways/)| [java](./solutions/091.decode-ways/decode-ways.java)|Medium|21.74%|| +|092|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii/)| [java](./solutions/092.reverse-linked-list-ii/reverse-linked-list-ii.java)|Medium|33.82%|| +|093|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses/)| [java](./solutions/093.restore-ip-addresses/restore-ip-addresses.java)|Medium|30.52%|| +|094|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)| [java](./solutions/094.binary-tree-inorder-traversal/binary-tree-inorder-traversal.java)|Medium|54.61%|| +|095|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii/)| [java](./solutions/095.unique-binary-search-trees-ii/unique-binary-search-trees-ii.java)|Medium|34.56%|| +|096|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees/)| [java](./solutions/096.unique-binary-search-trees/unique-binary-search-trees.java)|Medium|44.79%|| +|098|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree/)| [java](./solutions/098.validate-binary-search-tree/validate-binary-search-tree.java)|Medium|25.13%|| +|100|[same-tree](https://leetcode.com/problems/same-tree/)| [java](./solutions/100.same-tree/same-tree.java)|Easy|49.26%|| +|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree/)| [java](./solutions/101.symmetric-tree/symmetric-tree.java)|Easy|42.49%|| +|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [java](./solutions/102.binary-tree-level-order-traversal/binary-tree-level-order-traversal.java)|Medium|46.65%|| +|103|[binary-tree-zigzag-level-order-traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)| [java](./solutions/103.binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.java)|Medium|40.14%|| +|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)| [java](./solutions/104.maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.java)|Easy|58.83%|| +|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)| [java](./solutions/105.construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.java)|Medium|39.05%|| +|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)| [java](./solutions/106.construct-binary-tree-from-inorder-and-postorder-traversal/construct-binary-tree-from-inorder-and-postorder-traversal.java)|Medium|37.61%|| +|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)| [java](./solutions/107.binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.java)|Easy|45.36%|| +|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/)| [java](./solutions/108.convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.java)|Easy|48.88%|| +|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| [java](./solutions/109.convert-sorted-list-to-binary-search-tree/convert-sorted-list-to-binary-search-tree.java)|Medium|39.25%|| +|110|[balanced-binary-tree](https://leetcode.com/problems/balanced-binary-tree/)| [java](./solutions/110.balanced-binary-tree/balanced-binary-tree.java)|Easy|40.22%|| +|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)| [java](./solutions/111.minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.java)|Easy|34.74%|| +|112|[path-sum](https://leetcode.com/problems/path-sum/)||Easy|36.84%|| +|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii/)| [java](./solutions/113.path-sum-ii/path-sum-ii.java)|Medium|39.15%|| +|114|[flatten-binary-tree-to-linked-list](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)||Medium|40.77%|| +|116|[populating-next-right-pointers-in-each-node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)||Medium|36.51%|| +|117|[populating-next-right-pointers-in-each-node-ii](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/)| [java](./solutions/117.populating-next-right-pointers-in-each-node-ii/populating-next-right-pointers-in-each-node-ii.java)|Medium|33.32%|| +|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle/)||Easy|44.15%|| +|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii/)||Easy|41.66%|| +|120|[triangle](https://leetcode.com/problems/triangle/)||Medium|38.09%|| +|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)||Easy|45.94%|| +|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)||Easy|50.66%|| +|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome/)||Easy|29.96%|| +|127|[word-ladder](https://leetcode.com/problems/word-ladder/)||Medium|22.62%|| +|129|[sum-root-to-leaf-numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers/)||Medium|41.10%|| +|130|[surrounded-regions](https://leetcode.com/problems/surrounded-regions/)||Medium|21.94%|| +|133|[clone-graph](https://leetcode.com/problems/clone-graph/)||Medium|25.13%|| +|136|[single-number](https://leetcode.com/problems/single-number/)||Easy|58.68%|| +|139|[word-break](https://leetcode.com/problems/word-break/)||Medium|34.06%|| +|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle/)||Easy|35.45%|| +|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/)||Medium|49.98%|| +|152|[maximum-product-subarray](https://leetcode.com/problems/maximum-product-subarray/)||Medium|28.40%|| +|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists/)||Easy|31.89%|| +|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)||Easy|48.98%|| +|168|[excel-sheet-column-title](https://leetcode.com/problems/excel-sheet-column-title/)||Easy|28.42%|| +|169|[majority-element](https://leetcode.com/problems/majority-element/)||Easy|51.22%|| +|171|[excel-sheet-column-number](https://leetcode.com/problems/excel-sheet-column-number/)||Easy|50.71%|| +|172|[factorial-trailing-zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/)||Easy|37.20%|| +|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator/)||Medium|46.68%|| +|189|[rotate-array](https://leetcode.com/problems/rotate-array/)||Easy|28.63%|| +|190|[reverse-bits](https://leetcode.com/problems/reverse-bits/)||Easy|29.94%|| +|191|[number-of-1-bits](https://leetcode.com/problems/number-of-1-bits/)||Easy|41.70%|| +|198|[house-robber](https://leetcode.com/problems/house-robber/)||Easy|40.73%|| +|199|[binary-tree-right-side-view](https://leetcode.com/problems/binary-tree-right-side-view/)||Medium|46.28%|| +|202|[happy-number](https://leetcode.com/problems/happy-number/)||Easy|44.09%|| +|203|[remove-linked-list-elements](https://leetcode.com/problems/remove-linked-list-elements/)||Easy|35.11%|| +|204|[count-primes](https://leetcode.com/problems/count-primes/)||Easy|28.04%|| +|205|[isomorphic-strings](https://leetcode.com/problems/isomorphic-strings/)||Easy|36.54%|| +|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list/)||Easy|52.22%|| +|213|[house-robber-ii](https://leetcode.com/problems/house-robber-ii/)||Medium|35.02%|| +|217|[contains-duplicate](https://leetcode.com/problems/contains-duplicate/)||Easy|50.51%|| +|219|[contains-duplicate-ii](https://leetcode.com/problems/contains-duplicate-ii/)||Easy|34.54%|| +|221|[maximal-square](https://leetcode.com/problems/maximal-square/)||Medium|32.08%|| +|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes/)||Medium|30.92%|| +|226|[invert-binary-tree](https://leetcode.com/problems/invert-binary-tree/)||Easy|56.73%|| +|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst/)||Medium|49.55%|| +|231|[power-of-two](https://leetcode.com/problems/power-of-two/)||Easy|41.55%|| +|234|[palindrome-linked-list](https://leetcode.com/problems/palindrome-linked-list/)||Easy|35.15%|| +|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)||Easy|43.13%|| +|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)||Medium|34.95%|| +|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list/)||Easy|51.61%|| +|242|[valid-anagram](https://leetcode.com/problems/valid-anagram/)||Easy|50.61%|| +|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths/)| [java](./solutions/257.binary-tree-paths/binary-tree-paths.java)|Easy|44.76%|| +|258|[add-digits](https://leetcode.com/problems/add-digits/)| [java](./solutions/258.add-digits/add-digits.java)|Easy|53.37%|| +|263|[ugly-number](https://leetcode.com/problems/ugly-number/)| [java](./solutions/263.ugly-number/ugly-number.java)|Easy|40.32%|| +|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii/)| [java](./solutions/264.ugly-number-ii/ugly-number-ii.java)|Medium|35.37%|| +|268|[missing-number](https://leetcode.com/problems/missing-number/)| [java](./solutions/268.missing-number/missing-number.java)|Easy|47.33%|| +|278|[first-bad-version](https://leetcode.com/problems/first-bad-version/)| [java](./solutions/278.first-bad-version/first-bad-version.java)|Easy|28.66%|| +|279|[perfect-squares](https://leetcode.com/problems/perfect-squares/)| [java](./solutions/279.perfect-squares/perfect-squares.java)|Medium|40.38%|| +|283|[move-zeroes](https://leetcode.com/problems/move-zeroes/)| [java](./solutions/283.move-zeroes/move-zeroes.java)|Easy|53.42%|| +|290|[word-pattern](https://leetcode.com/problems/word-pattern/)| [java](./solutions/290.word-pattern/word-pattern.java)|Easy|34.43%|| +|300|[longest-increasing-subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|40.08%|| +|303|[range-sum-query-immutable](https://leetcode.com/problems/range-sum-query-immutable/)| [java](./solutions/303.range-sum-query-immutable/range-sum-query-immutable.java)|Easy|36.29%|| +|304|[range-sum-query-2d-immutable](https://leetcode.com/problems/range-sum-query-2d-immutable/)| [java](./solutions/304.range-sum-query-2d-immutable/range-sum-query-2d-immutable.java)|Medium|30.89%|| +|309|[best-time-to-buy-and-sell-stock-with-cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/)| [java](./solutions/309.best-time-to-buy-and-sell-stock-with-cooldown/best-time-to-buy-and-sell-stock-with-cooldown.java)|Medium|43.36%|| +|322|[coin-change](https://leetcode.com/problems/coin-change/)| [java](./solutions/322.coin-change/coin-change.java)|Medium|28.75%|| +|326|[power-of-three](https://leetcode.com/problems/power-of-three/)| [java](./solutions/326.power-of-three/power-of-three.java)|Easy|41.33%|| +|338|[counting-bits](https://leetcode.com/problems/counting-bits/)| [java](./solutions/338.counting-bits/counting-bits.java)|Medium|63.80%|| +|342|[power-of-four](https://leetcode.com/problems/power-of-four/)| [java](./solutions/342.power-of-four/power-of-four.java)|Easy|39.92%|| +|343|[integer-break](https://leetcode.com/problems/integer-break/)| [java](./solutions/343.integer-break/integer-break.java)|Medium|47.22%|| +|344|[reverse-string](https://leetcode.com/problems/reverse-string/)| [java](./solutions/344.reverse-string/reverse-string.java)|Easy|62.64%|| +|345|[reverse-vowels-of-a-string](https://leetcode.com/problems/reverse-vowels-of-a-string/)| [java](./solutions/345.reverse-vowels-of-a-string/reverse-vowels-of-a-string.java)|Easy|40.70%|| +|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [java](./solutions/349.intersection-of-two-arrays/intersection-of-two-arrays.java)|Easy|52.46%|| +|350|[intersection-of-two-arrays-ii](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [java](./solutions/350.intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.java)|Easy|46.50%|| +|357|[count-numbers-with-unique-digits](https://leetcode.com/problems/count-numbers-with-unique-digits/)| [java](./solutions/357.count-numbers-with-unique-digits/count-numbers-with-unique-digits.java)|Medium|46.54%|| +|367|[valid-perfect-square](https://leetcode.com/problems/valid-perfect-square/)| [java](./solutions/367.valid-perfect-square/valid-perfect-square.java)|Easy|39.29%|| +|368|[largest-divisible-subset](https://leetcode.com/problems/largest-divisible-subset/)| [java](./solutions/368.largest-divisible-subset/largest-divisible-subset.java)|Medium|34.42%|| +|371|[sum-of-two-integers](https://leetcode.com/problems/sum-of-two-integers/)| [java](./solutions/371.sum-of-two-integers/sum-of-two-integers.java)|Easy|51.36%|| +|374|[guess-number-higher-or-lower](https://leetcode.com/problems/guess-number-higher-or-lower/)| [java](./solutions/374.guess-number-higher-or-lower/guess-number-higher-or-lower.java)|Easy|38.54%|| +|375|[guess-number-higher-or-lower-ii](https://leetcode.com/problems/guess-number-higher-or-lower-ii/)| [java](./solutions/375.guess-number-higher-or-lower-ii/guess-number-higher-or-lower-ii.java)|Medium|37.13%|| +|376|[wiggle-subsequence](https://leetcode.com/problems/wiggle-subsequence/)| [java](./solutions/376.wiggle-subsequence/wiggle-subsequence.java)|Medium|36.81%|| +|377|[combination-sum-iv](https://leetcode.com/problems/combination-sum-iv/)| [java](./solutions/377.combination-sum-iv/combination-sum-iv.java)|Medium|43.80%|| +|383|[ransom-note](https://leetcode.com/problems/ransom-note/)| [java](./solutions/383.ransom-note/ransom-note.java)|Easy|49.13%|| +|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string/)| [java](./solutions/387.first-unique-character-in-a-string/first-unique-character-in-a-string.java)|Easy|48.84%|| +|389|[find-the-difference](https://leetcode.com/problems/find-the-difference/)| [java](./solutions/389.find-the-difference/find-the-difference.java)|Easy|52.60%|| +|392|[is-subsequence](https://leetcode.com/problems/is-subsequence/)| [java](./solutions/392.is-subsequence/is-subsequence.java)|Medium|46.05%|| +|400|[nth-digit](https://leetcode.com/problems/nth-digit/)| [java](./solutions/400.nth-digit/nth-digit.java)|Easy|30.04%|| +|401|[binary-watch](https://leetcode.com/problems/binary-watch/)| [java](./solutions/401.binary-watch/binary-watch.java)|Easy|45.00%|| +|404|[sum-of-left-leaves](https://leetcode.com/problems/sum-of-left-leaves/)| [java](./solutions/404.sum-of-left-leaves/sum-of-left-leaves.java)|Easy|48.62%|| +|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal/)| [java](./solutions/405.convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.java)|Easy|41.63%|| +|409|[longest-palindrome](https://leetcode.com/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|47.27%|| +|413|[arithmetic-slices](https://leetcode.com/problems/arithmetic-slices/)| [java](./solutions/413.arithmetic-slices/arithmetic-slices.java)|Medium|55.15%|| +|414|[third-maximum-number](https://leetcode.com/problems/third-maximum-number/)| [java](./solutions/414.third-maximum-number/third-maximum-number.java)|Easy|28.58%|| +|415|[add-strings](https://leetcode.com/problems/add-strings/)| [java](./solutions/415.add-strings/add-strings.java)|Easy|42.91%|| +|416|[partition-equal-subset-sum](https://leetcode.com/problems/partition-equal-subset-sum/)| [java](./solutions/416.partition-equal-subset-sum/partition-equal-subset-sum.java)|Medium|39.65%|| +|434|[number-of-segments-in-a-string](https://leetcode.com/problems/number-of-segments-in-a-string/)| [java](./solutions/434.number-of-segments-in-a-string/number-of-segments-in-a-string.java)|Easy|36.60%|| +|437|[path-sum-iii](https://leetcode.com/problems/path-sum-iii/)| [java](./solutions/437.path-sum-iii/path-sum-iii.java)|Easy|41.72%|| +|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string/)| [java](./solutions/438.find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.java)|Easy|36.02%|| +|441|[arranging-coins](https://leetcode.com/problems/arranging-coins/)| [java](./solutions/441.arranging-coins/arranging-coins.java)|Easy|37.33%|| +|443|[string-compression](https://leetcode.com/problems/string-compression/)| [java](./solutions/443.string-compression/string-compression.java)|Easy|36.64%|| +|447|[number-of-boomerangs](https://leetcode.com/problems/number-of-boomerangs/)| [java](./solutions/447.number-of-boomerangs/number-of-boomerangs.java)|Easy|48.89%|| +|448|[find-all-numbers-disappeared-in-an-array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/)| [java](./solutions/448.find-all-numbers-disappeared-in-an-array/find-all-numbers-disappeared-in-an-array.java)|Easy|52.54%|| +|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst/)| [java](./solutions/450.delete-node-in-a-bst/delete-node-in-a-bst.java)|Medium|39.06%|| +|453|[minimum-moves-to-equal-array-elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements/)| [java](./solutions/453.minimum-moves-to-equal-array-elements/minimum-moves-to-equal-array-elements.java)|Easy|48.96%|| +|454|[4sum-ii](https://leetcode.com/problems/4sum-ii/)| [java](./solutions/454.4sum-ii/4sum-ii.java)|Medium|49.63%|| +|459|[repeated-substring-pattern](https://leetcode.com/problems/repeated-substring-pattern/)| [java](./solutions/459.repeated-substring-pattern/repeated-substring-pattern.java)|Easy|39.26%|| +|461|[hamming-distance](https://leetcode.com/problems/hamming-distance/)| [java](./solutions/461.hamming-distance/hamming-distance.java)|Easy|69.94%|| +|463|[island-perimeter](https://leetcode.com/problems/island-perimeter/)| [java](./solutions/463.island-perimeter/island-perimeter.java)|Easy|60.07%|| +|464|[can-i-win](https://leetcode.com/problems/can-i-win/)| [java](./solutions/464.can-i-win/can-i-win.java)|Medium|26.70%|| +|467|[unique-substrings-in-wraparound-string](https://leetcode.com/problems/unique-substrings-in-wraparound-string/)| [java](./solutions/467.unique-substrings-in-wraparound-string/unique-substrings-in-wraparound-string.java)|Medium|33.41%|| +|474|[ones-and-zeroes](https://leetcode.com/problems/ones-and-zeroes/)| [java](./solutions/474.ones-and-zeroes/ones-and-zeroes.java)|Medium|39.11%|| +|475|[heaters](https://leetcode.com/problems/heaters/)| [java](./solutions/475.heaters/heaters.java)|Easy|30.91%|| +|476|[number-complement](https://leetcode.com/problems/number-complement/)||Easy|61.98%|| +|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones/)||Easy|54.38%|| +|486|[predict-the-winner](https://leetcode.com/problems/predict-the-winner/)||Medium|46.56%|| +|494|[target-sum](https://leetcode.com/problems/target-sum/)||Medium|44.77%|| +|500|[keyboard-row](https://leetcode.com/problems/keyboard-row/)||Easy|61.51%|| +|501|[find-mode-in-binary-search-tree](https://leetcode.com/problems/find-mode-in-binary-search-tree/)||Easy|38.78%|| +|507|[perfect-number](https://leetcode.com/problems/perfect-number/)||Easy|33.30%|| +|508|[most-frequent-subtree-sum](https://leetcode.com/problems/most-frequent-subtree-sum/)||Medium|53.65%|| +|513|[find-bottom-left-tree-value](https://leetcode.com/problems/find-bottom-left-tree-value/)||Medium|57.80%|| +|515|[find-largest-value-in-each-tree-row](https://leetcode.com/problems/find-largest-value-in-each-tree-row/)||Medium|57.10%|| +|516|[longest-palindromic-subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/)||Medium|45.08%|| +|520|[detect-capital](https://leetcode.com/problems/detect-capital/)||Easy|52.18%|| +|521|[longest-uncommon-subsequence-i](https://leetcode.com/problems/longest-uncommon-subsequence-i/)||Easy|56.03%|| +|523|[continuous-subarray-sum](https://leetcode.com/problems/continuous-subarray-sum/)||Medium|24.06%|| +|532|[k-diff-pairs-in-an-array](https://leetcode.com/problems/k-diff-pairs-in-an-array/)||Easy|29.15%|| +|538|[convert-bst-to-greater-tree](https://leetcode.com/problems/convert-bst-to-greater-tree/)||Easy|49.78%|| +|541|[reverse-string-ii](https://leetcode.com/problems/reverse-string-ii/)||Easy|44.94%|| +|543|[diameter-of-binary-tree](https://leetcode.com/problems/diameter-of-binary-tree/)||Easy|46.10%|| +|551|[student-attendance-record-i](https://leetcode.com/problems/student-attendance-record-i/)||Easy|45.15%|| +|557|[reverse-words-in-a-string-iii](https://leetcode.com/problems/reverse-words-in-a-string-iii/)||Easy|62.91%|| +|560|[subarray-sum-equals-k](https://leetcode.com/problems/subarray-sum-equals-k/)||Medium|41.43%|| +|561|[array-partition-i](https://leetcode.com/problems/array-partition-i/)||Easy|68.15%|| +|563|[binary-tree-tilt](https://leetcode.com/problems/binary-tree-tilt/)||Easy|46.83%|| +|565|[array-nesting](https://leetcode.com/problems/array-nesting/)||Medium|51.32%|| +|566|[reshape-the-matrix](https://leetcode.com/problems/reshape-the-matrix/)||Easy|58.35%|| +|572|[subtree-of-another-tree](https://leetcode.com/problems/subtree-of-another-tree/)||Easy|41.13%|| +|575|[distribute-candies](https://leetcode.com/problems/distribute-candies/)||Easy|59.01%|| +|576|[out-of-boundary-paths](https://leetcode.com/problems/out-of-boundary-paths/)||Medium|31.14%|| +|581|[shortest-unsorted-continuous-subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/)||Easy|29.58%|| +|594|[longest-harmonious-subsequence](https://leetcode.com/problems/longest-harmonious-subsequence/)||Easy|42.82%|| +|598|[range-addition-ii](https://leetcode.com/problems/range-addition-ii/)||Easy|48.35%|| +|599|[minimum-index-sum-of-two-lists](https://leetcode.com/problems/minimum-index-sum-of-two-lists/)||Easy|47.05%|| +|605|[can-place-flowers](https://leetcode.com/problems/can-place-flowers/)||Easy|30.62%|| +|606|[construct-string-from-binary-tree](https://leetcode.com/problems/construct-string-from-binary-tree/)||Easy|50.94%|| +|611|[valid-triangle-number](https://leetcode.com/problems/valid-triangle-number/)||Medium|44.00%|| +|617|[merge-two-binary-trees](https://leetcode.com/problems/merge-two-binary-trees/)||Easy|68.93%|| +|621|[task-scheduler](https://leetcode.com/problems/task-scheduler/)||Medium|44.08%|| +|628|[maximum-product-of-three-numbers](https://leetcode.com/problems/maximum-product-of-three-numbers/)||Easy|45.44%|| +|633|[sum-of-square-numbers](https://leetcode.com/problems/sum-of-square-numbers/)||Easy|32.79%|| +|637|[average-of-levels-in-binary-tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/)||Easy|57.76%|| +|638|[shopping-offers](https://leetcode.com/problems/shopping-offers/)||Medium|47.73%|| +|643|[maximum-average-subarray-i](https://leetcode.com/problems/maximum-average-subarray-i/)||Easy|38.82%|| +|645|[set-mismatch](https://leetcode.com/problems/set-mismatch/)||Easy|40.31%|| +|646|[maximum-length-of-pair-chain](https://leetcode.com/problems/maximum-length-of-pair-chain/)||Medium|47.77%|| +|647|[palindromic-substrings](https://leetcode.com/problems/palindromic-substrings/)||Medium|55.49%|| +|650|[2-keys-keyboard](https://leetcode.com/problems/2-keys-keyboard/)||Medium|46.04%|| +|653|[two-sum-iv-input-is-a-bst](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)||Easy|51.60%|| +|657|[robot-return-to-origin](https://leetcode.com/problems/robot-return-to-origin/)| [java](./solutions/657.robot-return-to-origin/robot-return-to-origin.java)|Easy|70.57%|| +|661|[image-smoother](https://leetcode.com/problems/image-smoother/)| [java](./solutions/661.image-smoother/image-smoother.java)|Easy|47.69%|| +|665|[non-decreasing-array](https://leetcode.com/problems/non-decreasing-array/)||Easy|19.58%|| +|669|[trim-a-binary-search-tree](https://leetcode.com/problems/trim-a-binary-search-tree/)||Easy|59.56%|| +|671|[second-minimum-node-in-a-binary-tree](https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/)||Easy|43.23%|| +|673|[number-of-longest-increasing-subsequence](https://leetcode.com/problems/number-of-longest-increasing-subsequence/)||Medium|33.01%|| +|674|[longest-continuous-increasing-subsequence](https://leetcode.com/problems/longest-continuous-increasing-subsequence/)| [java](./solutions/674.longest-continuous-increasing-subsequence/longest-continuous-increasing-subsequence.java)|Easy|43.66%|| +|680|[valid-palindrome-ii](https://leetcode.com/problems/valid-palindrome-ii/)| [java](./solutions/680.valid-palindrome-ii/valid-palindrome-ii.java)|Easy|33.61%|| +|686|[repeated-string-match](https://leetcode.com/problems/repeated-string-match/)| [java](./solutions/686.repeated-string-match/repeated-string-match.java)|Easy|31.30%|| +|687|[longest-univalue-path](https://leetcode.com/problems/longest-univalue-path/)| [java](./solutions/687.longest-univalue-path/longest-univalue-path.java)|Easy|33.21%|| +|690|[employee-importance](https://leetcode.com/problems/employee-importance/)| [java](./solutions/690.employee-importance/employee-importance.java)|Easy|53.00%|| +|693|[binary-number-with-alternating-bits](https://leetcode.com/problems/binary-number-with-alternating-bits/)| [java](./solutions/693.binary-number-with-alternating-bits/binary-number-with-alternating-bits.java)|Easy|57.43%|| +|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|55.57%|| +|696|[count-binary-substrings](https://leetcode.com/problems/count-binary-substrings/)| [java](./solutions/696.count-binary-substrings/count-binary-substrings.java)|Easy|52.24%|| +|697|[degree-of-an-array](https://leetcode.com/problems/degree-of-an-array/)| [java](./solutions/697.degree-of-an-array/degree-of-an-array.java)|Easy|48.86%|| +|698|[partition-to-k-equal-sum-subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets/)| [java](./solutions/698.partition-to-k-equal-sum-subsets/partition-to-k-equal-sum-subsets.java)|Medium|40.77%|| +|712|[minimum-ascii-delete-sum-for-two-strings](https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/)| [java](./solutions/712.minimum-ascii-delete-sum-for-two-strings/minimum-ascii-delete-sum-for-two-strings.java)|Medium|53.23%|| +|714|[best-time-to-buy-and-sell-stock-with-transaction-fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/)| [java](./solutions/714.best-time-to-buy-and-sell-stock-with-transaction-fee/best-time-to-buy-and-sell-stock-with-transaction-fee.java)|Medium|49.31%|| +|717|[1-bit-and-2-bit-characters](https://leetcode.com/problems/1-bit-and-2-bit-characters/)| [java](./solutions/717.1-bit-and-2-bit-characters/1-bit-and-2-bit-characters.java)|Easy|48.81%|| +|718|[maximum-length-of-repeated-subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| [java](./solutions/718.maximum-length-of-repeated-subarray/maximum-length-of-repeated-subarray.java)|Medium|44.51%|| +|720|[longest-word-in-dictionary](https://leetcode.com/problems/longest-word-in-dictionary/)| [java](./solutions/720.longest-word-in-dictionary/longest-word-in-dictionary.java)|Easy|43.58%|| +|724|[find-pivot-index](https://leetcode.com/problems/find-pivot-index/)| [java](./solutions/724.find-pivot-index/find-pivot-index.java)|Easy|40.35%|| +|728|[self-dividing-numbers](https://leetcode.com/problems/self-dividing-numbers/)| [java](./solutions/728.self-dividing-numbers/self-dividing-numbers.java)|Easy|68.74%|| +|740|[delete-and-earn](https://leetcode.com/problems/delete-and-earn/)| [java](./solutions/740.delete-and-earn/delete-and-earn.java)|Medium|44.87%|| +|742|[to-lower-case](https://leetcode.com/problems/to-lower-case/)| [java](./solutions/742.to-lower-case/to-lower-case.java)|Easy|75.94%|| +|745|[find-smallest-letter-greater-than-target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/)| [java](./solutions/745.find-smallest-letter-greater-than-target/find-smallest-letter-greater-than-target.java)|Easy|43.46%|| +|747|[min-cost-climbing-stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [java](./solutions/747.min-cost-climbing-stairs/min-cost-climbing-stairs.java)|Easy|45.67%|| +|748|[largest-number-at-least-twice-of-others](https://leetcode.com/problems/largest-number-at-least-twice-of-others/)| [java](./solutions/748.largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.java)|Easy|40.20%|| +|764|[n-ary-tree-level-order-traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal/)| [java](./solutions/764.n-ary-tree-level-order-traversal/n-ary-tree-level-order-traversal.java)|Easy|58.00%|| +|767|[prime-number-of-set-bits-in-binary-representation](https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/)| [java](./solutions/767.prime-number-of-set-bits-in-binary-representation/prime-number-of-set-bits-in-binary-representation.java)|Easy|57.53%|| +|769|[largest-plus-sign](https://leetcode.com/problems/largest-plus-sign/)| [java](./solutions/769.largest-plus-sign/largest-plus-sign.java)|Medium|42.38%|| +|774|[maximum-depth-of-n-ary-tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree/)| [java](./solutions/774.maximum-depth-of-n-ary-tree/maximum-depth-of-n-ary-tree.java)|Easy|64.09%|| +|775|[n-ary-tree-preorder-traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)| [java](./solutions/775.n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.java)|Easy|65.60%|| +|776|[n-ary-tree-postorder-traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal/)| [java](./solutions/776.n-ary-tree-postorder-traversal/n-ary-tree-postorder-traversal.java)|Easy|65.66%|| +|777|[toeplitz-matrix](https://leetcode.com/problems/toeplitz-matrix/)| [java](./solutions/777.toeplitz-matrix/toeplitz-matrix.java)|Easy|60.96%|| +|782|[jewels-and-stones](https://leetcode.com/problems/jewels-and-stones/)| [java](./solutions/782.jewels-and-stones/jewels-and-stones.java)|Easy|82.60%|| +|783|[search-in-a-binary-search-tree](https://leetcode.com/problems/search-in-a-binary-search-tree/)| [java](./solutions/783.search-in-a-binary-search-tree/search-in-a-binary-search-tree.java)|Easy|66.25%|| +|792|[binary-search](https://leetcode.com/problems/binary-search/)| [java](./solutions/792.binary-search/binary-search.java)|Easy|44.73%|| +|800|[letter-case-permutation](https://leetcode.com/problems/letter-case-permutation/)| [java](./solutions/800.letter-case-permutation/letter-case-permutation.java)|Easy|54.98%|| +|803|[cheapest-flights-within-k-stops](https://leetcode.com/problems/cheapest-flights-within-k-stops/)| [java](./solutions/803.cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.java)|Medium|33.69%|| +|806|[domino-and-tromino-tiling](https://leetcode.com/problems/domino-and-tromino-tiling/)| [java](./solutions/806.domino-and-tromino-tiling/domino-and-tromino-tiling.java)|Medium|34.80%|| +|822|[unique-morse-code-words](https://leetcode.com/problems/unique-morse-code-words/)| [java](./solutions/822.unique-morse-code-words/unique-morse-code-words.java)|Easy|73.66%|| +|829|[subdomain-visit-count](https://leetcode.com/problems/subdomain-visit-count/)| [java](./solutions/829.subdomain-visit-count/subdomain-visit-count.java)|Easy|63.43%|| +|837|[most-common-word](https://leetcode.com/problems/most-common-word/)| [java](./solutions/837.most-common-word/most-common-word.java)|Easy|41.36%|| +|851|[goat-latin](https://leetcode.com/problems/goat-latin/)| [java](./solutions/851.goat-latin/goat-latin.java)|Easy|56.68%|| +|857|[positions-of-large-groups](https://leetcode.com/problems/positions-of-large-groups/)| [java](./solutions/857.positions-of-large-groups/positions-of-large-groups.java)|Easy|47.29%|| +|861|[flipping-an-image](https://leetcode.com/problems/flipping-an-image/)| [java](./solutions/861.flipping-an-image/flipping-an-image.java)|Easy|71.14%|| +|870|[magic-squares-in-grid](https://leetcode.com/problems/magic-squares-in-grid/)| [java](./solutions/870.magic-squares-in-grid/magic-squares-in-grid.java)|Easy|35.14%|| +|879|[maximize-distance-to-closest-person](https://leetcode.com/problems/maximize-distance-to-closest-person/)| [java](./solutions/879.maximize-distance-to-closest-person/maximize-distance-to-closest-person.java)|Easy|40.34%|| +|882|[peak-index-in-a-mountain-array](https://leetcode.com/problems/peak-index-in-a-mountain-array/)| [java](./solutions/882.peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.java)|Easy|68.85%|| +|889|[buddy-strings](https://leetcode.com/problems/buddy-strings/)| [java](./solutions/889.buddy-strings/buddy-strings.java)|Easy|27.40%|| +|898|[transpose-matrix](https://leetcode.com/problems/transpose-matrix/)| [java](./solutions/898.transpose-matrix/transpose-matrix.java)|Easy|63.64%|| +|904|[leaf-similar-trees](https://leetcode.com/problems/leaf-similar-trees/)| [java](./solutions/904.leaf-similar-trees/leaf-similar-trees.java)|Easy|61.97%|| diff --git a/README.tpl b/README.tpl new file mode 100644 index 0000000..fa7970a --- /dev/null +++ b/README.tpl @@ -0,0 +1,24 @@ +

+

+ + + + +

+

My leetcode solutions

+ +

+ Language: {{language}} +
+ Last updated: {{time}} +

+

+ +

The source code is fetched using the tool leetcode-spider.

+ +| # | Problems | Solutions | Difficulty | Acceptance | Paid-Only +|:--:|:-----:|:---------:|:----:|:----:|:----:| +{{#solutions}} +|{{id}}|[{{title}}](https://leetcode.com/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| +{{/solutions}} + diff --git a/lib/runtimeConf.js b/lib/runtimeConf.js index 08085fe..75ce8b7 100644 --- a/lib/runtimeConf.js +++ b/lib/runtimeConf.js @@ -1,4 +1,4 @@ 'use strict' module.exports = { - concurrency: 30 + concurrency: 10 } diff --git a/lib/spider.js b/lib/spider.js index 635f5d0..6b1dfbd 100644 --- a/lib/spider.js +++ b/lib/spider.js @@ -43,7 +43,7 @@ let solutionsDirPath let resultJsonPath let leetcodeNumObj = {} -exports.fetch = co.wrap(function * (conf, numObj) { +exports.fetch = co.wrap(function* (conf, numObj) { config = conf solutionsDirPath = path.resolve(process.cwd(), config.outputDir) resultJsonPath = path.resolve(solutionsDirPath, 'result.json') @@ -93,6 +93,21 @@ exports.fetch = co.wrap(function * (conf, numObj) { yield generateMDUtils.generateMarkdown(resultObj, leetcodeNumObj, config.outputDir, config.template) }) +let graphql = co.wrap(function* (opName, query, variables) { + let obj = { operationName: opName, query: query, variables: variables } + let content = JSON.stringify(obj) + let resp = yield request({ + method: 'POST', + url: '/graphql', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': content.length + }, + body: content + }) + return JSON.parse(resp[1]) +}) + /** * Use the config json file to login * and return a promise. @@ -101,9 +116,9 @@ exports.fetch = co.wrap(function * (conf, numObj) { * @return {Promise} * @api public */ -let login = co.wrap(function * (conf) { +let login = co.wrap(function* (conf) { config = conf - let responseAndBody = yield request.get('/accounts/login/') + let responseAndBody = yield request.get('/') let $ = cheerio.load(responseAndBody[1]) let token = $('input[name=csrfmiddlewaretoken]').val() @@ -114,7 +129,8 @@ let login = co.wrap(function * (conf) { let cookieOfToken = cookie.find(element => element.key === 'csrftoken') assert.notEqual(cookieOfToken, undefined, 'network error: cannot get csrftoken') - yield request({method: 'POST', + yield request({ + method: 'POST', url: '/accounts/login/', form: { 'csrfmiddlewaretoken': token, @@ -134,7 +150,7 @@ let login = co.wrap(function * (conf) { * @return {Array} list of solutions needed to fetch * @api public */ -let fetchACLists = co.wrap(function * () { +let fetchACLists = co.wrap(function* () { debug('fetch the accepted solutions\' list') let [, body] = yield request.get('/api/problems/algorithms/') @@ -150,7 +166,7 @@ let fetchACLists = co.wrap(function * () { return body['stat_status_pairs'] }) -let fetchWithGivenNumber = co.wrap(function * (acLists, numObj) { +let fetchWithGivenNumber = co.wrap(function* (acLists, numObj) { yield resultUtils.getResult() return acLists.filter(element => { if (element['paid_only']) { @@ -162,7 +178,7 @@ let fetchWithGivenNumber = co.wrap(function * (acLists, numObj) { }).reverse() }) -let fetchSolutionsNotEverFetched = co.wrap(function * (acLists) { +let fetchSolutionsNotEverFetched = co.wrap(function* (acLists) { // load the last spider result from result.json // if result.json doesn't exist that means never fetched solutions before let result = yield resultUtils.getResult(resultJsonPath) @@ -184,7 +200,7 @@ let fetchSolutionsNotEverFetched = co.wrap(function * (acLists) { * @return {Promise} * @api public */ -let parallelFetch = co.wrap(function * (acLists) { +let parallelFetch = co.wrap(function* (acLists) { debug('fetch solutions ') if (acLists && acLists.length > 0) { // form the promises array @@ -230,7 +246,7 @@ let parallelFetch = co.wrap(function * (acLists) { * @return {Object} languageCodeMap * @api public */ -let fetchAndWrite = function * (problemInfo, languageToFetch, languageCodeMap) { +let fetchAndWrite = function* (problemInfo, languageToFetch, languageCodeMap) { yield fetchACSolutionOfProblem(problemInfo, languageToFetch, 0, languageCodeMap) yield fetchQuestion(problemInfo, languageCodeMap).catch(err => { throw err }) yield fileUtils.writeToFile(languageCodeMap, solutionsDirPath).catch(err => { throw err }) @@ -249,7 +265,7 @@ let fetchAndWrite = function * (problemInfo, languageToFetch, languageCodeMap) { * @return {Object} languageCodeMap * @api public */ -let fetchACSolutionOfProblem = co.wrap(function * (problemInfo, languageToFetch, page, languageCodeMap) { +let fetchACSolutionOfProblem = co.wrap(function* (problemInfo, languageToFetch, page, languageCodeMap) { debug('fetch ' + problemInfo.stat['question__title_slug']) if (languageToFetch.length < 1) { @@ -258,25 +274,48 @@ let fetchACSolutionOfProblem = co.wrap(function * (problemInfo, languageToFetch, let responseAndBody, submissionsJson try { - responseAndBody = yield request.get({ - url: '/api/submissions/' + problemInfo.stat['question__title_slug'] + '/?offset=' + (page * 50) + '&limit=50', - headers: { - 'Accept': '*/*' - } - }) - submissionsJson = JSON.parse(responseAndBody[1])['submissions_dump'] + responseAndBody = yield graphql( + 'Submissions', + `query Submissions($offset: Int!, $limit: Int!, $lastKey: String, $questionSlug: String!) { + submissionList(offset: $offset, limit: $limit, lastKey: $lastKey, questionSlug: $questionSlug) { + lastKey + hasNext + submissions { + id + statusDisplay + lang + runtime + timestamp + url + isPending + memory + __typename + } + __typename + } + }`, + { offset: 0, limit: 20, lastKey: null, questionSlug: 'search-insert-position' }) + // responseAndBody = yield request.get({ + // url: '/api/submissions/' + problemInfo.stat['question__title_slug'] + '/?offset=' + (page * 50) + '&limit=50' + // }) + // submissionsJson = JSON.parse(responseAndBody[1])['submissions_dump'] + submissionsJson = responseAndBody.data.submissionList.submissions } catch (err) { logger.error('Fetching submissions of ' + problemInfo.stat['question__title_slug'] + ' failed') logger.error(err.stack) return } + if (submissionsJson == undefined) { + return + } + // form the promises array let acSolutionPromise = [] // check the submissions list submissionsJson.forEach(e => { - if (e['status_display'] !== 'Accepted') { + if (e.statusDisplay !== 'Accepted') { return } let language = languageLeetcodeNameMap[e['lang']] @@ -293,23 +332,11 @@ let fetchACSolutionOfProblem = co.wrap(function * (problemInfo, languageToFetch, } }) - // if no solution can be fetched - if (acSolutionPromise.length < 1) { - if (submissionsJson.length === 50 && languageToFetch.length > 0) { - // then fetch the next page of submissions - return yield fetchACSolutionOfProblem(problemInfo, languageToFetch, page + 1, languageCodeMap) - } else { - return languageCodeMap - } - } else { + if(acSolutionPromise.length>0){ yield acSolutionPromise - if (submissionsJson.length === 50 && languageToFetch.length > 0) { - return yield fetchACSolutionOfProblem(problemInfo, languageToFetch, page + 1, languageCodeMap) - } else { - // fetching finished , let's return it - return languageCodeMap - } } + + return languageCodeMap }) /** @@ -321,19 +348,80 @@ let fetchACSolutionOfProblem = co.wrap(function * (problemInfo, languageToFetch, * @return {Promise} * @api public */ -let fetchQuestion = co.wrap(function * (problemInfo, languageCodeMap) { +let fetchQuestion = co.wrap(function* (problemInfo, languageCodeMap) { let responseAndBody try { - responseAndBody = yield request.get('/problems/' + problemInfo.stat['question__title_slug'] + '/') + responseAndBody = yield graphql( + "questionData", + `query questionData($titleSlug: String!) { + question(titleSlug: $titleSlug) { + questionId + questionFrontendId + boundTopicId + title + titleSlug + content + translatedTitle + translatedContent + isPaidOnly + difficulty + likes + dislikes + isLiked + similarQuestions + contributors { + username + profileUrl + avatarUrl + __typename + } + langToValidPlayground + topicTags { + name + slug + translatedName + __typename + } + companyTagStats + codeSnippets { + lang + langSlug + code + __typename + } + stats + hints + solution { + id + canSeeDetail + __typename + } + status + sampleTestCase + metaData + judgerAvailable + judgeType + mysqlSchemas + enableRunCode + enableTestMode + envInfo + __typename + } + } + `, + {titleSlug: "search-insert-position"} + ) + // responseAndBody = yield request.get('/problems/' + problemInfo.stat['question__title_slug'] + '/') } catch (err) { debug('network error:error happened when fetching problem \'' + problemInfo.stat['question__title_slug'] + '\'') throw err }; - let $ = cheerio.load(responseAndBody[1]) + // let $ = cheerio.load(responseAndBody[1]) // debug('problem :'); // debug($('meta[name=description]').attr('content')); - languageCodeMap['_question'] = $('meta[name=description]').attr('content') + // languageCodeMap['_question'] = $('meta[name=description]').attr('content') + languageCodeMap['_question'] = responseAndBody.data.question.content }) /** @@ -345,7 +433,7 @@ let fetchQuestion = co.wrap(function * (problemInfo, languageCodeMap) { * @return {Promise} * @api public */ -let fetchSolutionsOfUrl = co.wrap(function * (url, times) { +let fetchSolutionsOfUrl = co.wrap(function* (url, times) { let responseAndBody try { responseAndBody = yield request.get(url) @@ -376,5 +464,5 @@ let fetchSolutionsOfUrl = co.wrap(function * (url, times) { /* eslint-disable no-eval */ let code = eval("'" + codeInUnicode + "'") debug(url + 'code get!') - return {code} + return { code } }) diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..0ccda47 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1139 @@ +{ + "name": "leetcode-spider", + "version": "1.0.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "any-promise": { + "version": "1.3.0", + "resolved": "http://registry.npm.taobao.org/any-promise/download/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "http://registry.npm.taobao.org/asn1/download/asn1-0.2.4.tgz", + "integrity": "sha1-jSR136tVO7M+d7VOWeiAu4ziMTY=", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "http://registry.npm.taobao.org/assert/download/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "requires": { + "util": "0.10.3" + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "http://registry.npm.taobao.org/aws-sign2/download/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "http://registry.npm.taobao.org/aws4/download/aws4-1.8.0.tgz", + "integrity": "sha1-8OAD2cqef1nHpQiUXXsu+aBKVC8=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/boolbase/download/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "boom": { + "version": "2.10.1", + "resolved": "http://registry.npm.taobao.org/boom/download/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "requires": { + "hoek": "2.x.x" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "http://registry.npm.taobao.org/builtin-modules/download/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" + }, + "camelcase": { + "version": "3.0.0", + "resolved": "http://registry.npm.taobao.org/camelcase/download/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" + }, + "caseless": { + "version": "0.11.0", + "resolved": "http://registry.npm.taobao.org/caseless/download/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npm.taobao.org/chalk/download/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cheerio": { + "version": "0.22.0", + "resolved": "http://registry.npm.taobao.org/cheerio/download/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "http://registry.npm.taobao.org/cliui/download/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/co/download/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "co-parallel": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/co-parallel/download/co-parallel-1.0.0.tgz", + "integrity": "sha1-WFl6BlgAWkK4xqI8yE2ioQ2Ubyo=", + "requires": { + "co-thread": "0.0.1" + } + }, + "co-thread": { + "version": "0.0.1", + "resolved": "http://registry.npm.taobao.org/co-thread/download/co-thread-0.0.1.tgz", + "integrity": "sha1-V3E/DvS4flWV1PI3Ef/ks7beXnQ=" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "http://registry.npm.taobao.org/code-point-at/download/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "http://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.7.tgz", + "integrity": "sha1-LR0kMXr7ir6V1tLAsHtXgTU52Cg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.19.0", + "resolved": "http://registry.npm.taobao.org/commander/download/commander-2.19.0.tgz", + "integrity": "sha1-9hmKqE5bg8RgVLlN3tv+1e6f8So=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "http://registry.npm.taobao.org/cryptiles/download/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.x.x" + } + }, + "css-select": { + "version": "1.2.0", + "resolved": "http://registry.npm.taobao.org/css-select/download/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.2", + "resolved": "http://registry.npm.taobao.org/css-what/download/css-what-2.1.2.tgz", + "integrity": "sha1-wIdtnQSAkn19SSDc1yrzWVZJVU0=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "http://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "date-format": { + "version": "0.0.0", + "resolved": "http://registry.npm.taobao.org/date-format/download/date-format-0.0.0.tgz", + "integrity": "sha1-CSBoY6sHDrRZrOpVQsvYVrEZZrM=" + }, + "debug": { + "version": "2.6.9", + "resolved": "http://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "http://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "http://registry.npm.taobao.org/dom-serializer/download/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "requires": { + "domelementtype": "~1.1.1", + "entities": "~1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "http://registry.npm.taobao.org/domelementtype/download/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" + } + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "http://registry.npm.taobao.org/domelementtype/download/domelementtype-1.3.1.tgz", + "integrity": "sha1-0EjESzew0Qp/Kj1f7j9DM9eQSB8=" + }, + "domhandler": { + "version": "2.4.2", + "resolved": "http://registry.npm.taobao.org/domhandler/download/domhandler-2.4.2.tgz", + "integrity": "sha1-iAUJfpM9ZehVRvcm1g9euItE+AM=", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "http://registry.npm.taobao.org/domutils/download/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "http://registry.npm.taobao.org/ecc-jsbn/download/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "entities": { + "version": "1.1.2", + "resolved": "http://registry.npm.taobao.org/entities/download/entities-1.1.2.tgz", + "integrity": "sha1-vfpzUplmTfr9NFKe1PhSKidf6lY=" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "http://registry.npm.taobao.org/error-ex/download/error-ex-1.3.2.tgz", + "integrity": "sha1-tKxAZIEH/c3PriQvQovqihTU8b8=", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "extend": { + "version": "3.0.2", + "resolved": "http://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz", + "integrity": "sha1-+LETa0Bx+9jrFAr/hYsQGewpFfo=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "find-up": { + "version": "1.1.2", + "resolved": "http://registry.npm.taobao.org/find-up/download/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "http://registry.npm.taobao.org/forever-agent/download/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.1.4", + "resolved": "http://registry.npm.taobao.org/form-data/download/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "generate-function": { + "version": "2.3.1", + "resolved": "http://registry.npm.taobao.org/generate-function/download/generate-function-2.3.1.tgz", + "integrity": "sha1-8GlhdpDBDIaOc7hGV0Z2T5fDR58=", + "requires": { + "is-property": "^1.0.2" + } + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "http://registry.npm.taobao.org/generate-object-property/download/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "requires": { + "is-property": "^1.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "http://registry.npm.taobao.org/get-caller-file/download/get-caller-file-1.0.3.tgz", + "integrity": "sha1-+Xj6TJDR3+f/LWvtoqUV5xO9z0o=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "http://registry.npm.taobao.org/getpass/download/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.15.tgz", + "integrity": "sha1-/7cD4QZuig7qpMi4C6klPu77+wA=" + }, + "har-validator": { + "version": "2.0.6", + "resolved": "http://registry.npm.taobao.org/har-validator/download/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "requires": { + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/has-ansi/download/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "http://registry.npm.taobao.org/hawk/download/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "http://registry.npm.taobao.org/hoek/download/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz", + "integrity": "sha1-l/I2l3vW4SVAiTD/bePuxigewEc=" + }, + "htmlparser2": { + "version": "3.10.0", + "resolved": "http://registry.npm.taobao.org/htmlparser2/download/htmlparser2-3.10.0.tgz", + "integrity": "sha1-X15CLc9hGcDZg+02Jgzp3tC+5GQ=", + "requires": { + "domelementtype": "^1.3.0", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.0.6" + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "http://registry.npm.taobao.org/http-signature/download/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "inherits": { + "version": "2.0.1", + "resolved": "http://registry.npm.taobao.org/inherits/download/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/invert-kv/download/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "http://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/is-builtin-module/download/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/is-my-ip-valid/download/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha1-ezUbjo7dTTmV1NBmaA5mTZRpaCQ=" + }, + "is-my-json-valid": { + "version": "2.19.0", + "resolved": "http://registry.npm.taobao.org/is-my-json-valid/download/is-my-json-valid-2.19.0.tgz", + "integrity": "sha1-j9bkA2PNBrlj+od9REv7Xt3GIXU=", + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "is-my-ip-valid": "^1.0.0", + "jsonpointer": "^4.0.0", + "xtend": "^4.0.0" + } + }, + "is-property": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/is-property/download/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/is-typedarray/download/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "http://registry.npm.taobao.org/is-utf8/download/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "http://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "http://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "http://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "http://registry.npm.taobao.org/json-schema/download/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "http://registry.npm.taobao.org/json-stringify-safe/download/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "http://registry.npm.taobao.org/jsonpointer/download/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "http://registry.npm.taobao.org/jsprim/download/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/lcid/download/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "http://registry.npm.taobao.org/load-json-file/download/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "lodash.assignin": { + "version": "4.2.0", + "resolved": "http://registry.npm.taobao.org/lodash.assignin/download/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "http://registry.npm.taobao.org/lodash.bind/download/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "http://registry.npm.taobao.org/lodash.defaults/download/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/lodash.filter/download/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "http://registry.npm.taobao.org/lodash.flatten/download/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "http://registry.npm.taobao.org/lodash.foreach/download/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/lodash.map/download/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "http://registry.npm.taobao.org/lodash.merge/download/lodash.merge-4.6.1.tgz", + "integrity": "sha1-rcJdnLmbk5HFliTzefu6YNcRHVQ=" + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "http://registry.npm.taobao.org/lodash.pick/download/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/lodash.reduce/download/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/lodash.reject/download/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "http://registry.npm.taobao.org/lodash.some/download/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "log4js": { + "version": "1.1.1", + "resolved": "http://registry.npm.taobao.org/log4js/download/log4js-1.1.1.tgz", + "integrity": "sha1-wh0px2BAieTyVYM+f5SzRh3h/0M=", + "requires": { + "debug": "^2.2.0", + "semver": "^5.3.0", + "streamroller": "^0.4.0" + } + }, + "mime-db": { + "version": "1.37.0", + "resolved": "http://registry.npm.taobao.org/mime-db/download/mime-db-1.37.0.tgz", + "integrity": "sha1-C2oM5v2+lXbiXx8tL96IMNwK0Ng=" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "http://registry.npm.taobao.org/mime-types/download/mime-types-2.1.21.tgz", + "integrity": "sha1-KJlaoey3cHQv5q5+WPkYHHRLP5Y=", + "requires": { + "mime-db": "~1.37.0" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npm.taobao.org/minimist/download/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mustache": { + "version": "2.3.2", + "resolved": "http://registry.npm.taobao.org/mustache/download/mustache-2.3.2.tgz", + "integrity": "sha1-ptTZw/kdEzWauImoEpVPkjCj0MU=" + }, + "normalize-package-data": { + "version": "2.4.2", + "resolved": "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.2.tgz", + "integrity": "sha1-ayq9hXdOUfeTbxOV5FrLkF3ISbI=", + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "nth-check": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/nth-check/download/nth-check-1.0.2.tgz", + "integrity": "sha1-sr0pXDfj3VijvwcAN2Zjuk2c8Fw=", + "requires": { + "boolbase": "~1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "http://registry.npm.taobao.org/number-is-nan/download/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "http://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "os-locale": { + "version": "1.4.0", + "resolved": "http://registry.npm.taobao.org/os-locale/download/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "requires": { + "lcid": "^1.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "http://registry.npm.taobao.org/parse-json/download/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "http://registry.npm.taobao.org/path-exists/download/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "http://registry.npm.taobao.org/path-type/download/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "http://registry.npm.taobao.org/pify/download/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "http://registry.npm.taobao.org/pinkie/download/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "http://registry.npm.taobao.org/pinkie-promise/download/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "http://registry.npm.taobao.org/punycode/download/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.3.2", + "resolved": "http://registry.npm.taobao.org/qs/download/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=" + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "http://registry.npm.taobao.org/read-pkg/download/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "http://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "readable-stream": { + "version": "3.1.1", + "resolved": "http://registry.npm.taobao.org/readable-stream/download/readable-stream-3.1.1.tgz", + "integrity": "sha1-7Wu8bFuliwkAOf8YzmcFFXla6wY=", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "http://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "request": { + "version": "2.79.0", + "resolved": "http://registry.npm.taobao.org/request/download/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~2.0.6", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "qs": "~6.3.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1", + "uuid": "^3.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "http://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "http://registry.npm.taobao.org/require-main-filename/download/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "http://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz", + "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=" + }, + "semver": { + "version": "5.6.0", + "resolved": "http://registry.npm.taobao.org/semver/download/semver-5.6.0.tgz", + "integrity": "sha1-fnQlb7qknHWqfHogXMInmcrIAAQ=" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/set-blocking/download/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "sntp": { + "version": "1.0.9", + "resolved": "http://registry.npm.taobao.org/sntp/download/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "requires": { + "hoek": "2.x.x" + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-3.1.0.tgz", + "integrity": "sha1-+4PlBERSaPFUsHTiGMh8ADzTHfQ=", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "http://registry.npm.taobao.org/spdx-exceptions/download/spdx-exceptions-2.2.0.tgz", + "integrity": "sha1-LqRQrudPKom/uUUZwH/Nb0EyKXc=" + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "http://registry.npm.taobao.org/spdx-expression-parse/download/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.3", + "resolved": "http://registry.npm.taobao.org/spdx-license-ids/download/spdx-license-ids-3.0.3.tgz", + "integrity": "sha1-gcDOjyFHR1YUi7tfO/wPNr8V124=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "http://registry.npm.taobao.org/sshpk/download/sshpk-1.16.1.tgz", + "integrity": "sha1-+2YcC+8ps520B2nuOfpwCT1vaHc=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "streamroller": { + "version": "0.4.1", + "resolved": "http://registry.npm.taobao.org/streamroller/download/streamroller-0.4.1.tgz", + "integrity": "sha1-1DW9WXQ3Or2b2QaDWVEwhRBswF8=", + "requires": { + "date-format": "^0.0.0", + "debug": "^0.7.2", + "mkdirp": "^0.5.1", + "readable-stream": "^1.1.7" + }, + "dependencies": { + "debug": { + "version": "0.7.4", + "resolved": "http://registry.npm.taobao.org/debug/download/debug-0.7.4.tgz", + "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "http://registry.npm.taobao.org/readable-stream/download/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "http://registry.npm.taobao.org/string_decoder/download/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/string-width/download/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.2.0", + "resolved": "http://registry.npm.taobao.org/string_decoder/download/string_decoder-1.2.0.tgz", + "integrity": "sha1-/obnOLGVRK/nBGkkOyoe6SQOro0=", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringstream": { + "version": "0.0.6", + "resolved": "http://registry.npm.taobao.org/stringstream/download/stringstream-0.0.6.tgz", + "integrity": "sha1-eIAiWw1K0Q4wkn0Weh1vL9OzOnI=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/strip-bom/download/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "thenify": { + "version": "3.3.0", + "resolved": "http://registry.npm.taobao.org/thenify/download/thenify-3.3.0.tgz", + "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", + "requires": { + "any-promise": "^1.0.0" + } + }, + "thenify-all": { + "version": "1.6.0", + "resolved": "http://registry.npm.taobao.org/thenify-all/download/thenify-all-1.6.0.tgz", + "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", + "requires": { + "thenify": ">= 3.1.0 < 4" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "http://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.3.4.tgz", + "integrity": "sha1-7GDO44rGdQY//JelwYlwV47oNlU=", + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "http://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=" + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "http://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "unescape": { + "version": "0.2.0", + "resolved": "http://registry.npm.taobao.org/unescape/download/unescape-0.2.0.tgz", + "integrity": "sha1-t4ubYMhvFinfGBv1Pu47yNY2fd8=" + }, + "util": { + "version": "0.10.3", + "resolved": "http://registry.npm.taobao.org/util/download/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "requires": { + "inherits": "2.0.1" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "http://registry.npm.taobao.org/uuid/download/uuid-3.3.2.tgz", + "integrity": "sha1-G0r0lV6zB3xQHCOHL8ZROBFYcTE=" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "http://registry.npm.taobao.org/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha1-/JH2uce6FchX9MssXe/uw51PQQo=", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "http://registry.npm.taobao.org/verror/download/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "http://registry.npm.taobao.org/which-module/download/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "http://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "http://registry.npm.taobao.org/xtend/download/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "y18n": { + "version": "3.2.1", + "resolved": "http://registry.npm.taobao.org/y18n/download/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + }, + "yargs": { + "version": "6.6.0", + "resolved": "http://registry.npm.taobao.org/yargs/download/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^4.2.0" + } + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "http://registry.npm.taobao.org/yargs-parser/download/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "requires": { + "camelcase": "^3.0.0" + } + } + } +} diff --git a/package.json b/package.json index 953a6a6..90bb7e3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lc-spider": "./bin/leetcode_spider" }, "scripts": { - "dev": "DEBUG=lc-spider lc-spider", + "debug": "DEBUG=lc-spider lc-spider", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { From 6fb710eb08e03258496f89e32563a3f44b97d7da Mon Sep 17 00:00:00 2001 From: zoudikai Date: Tue, 12 Feb 2019 16:44:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?[feat]=20=E6=B7=BB=E5=8A=A0=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=BB=A3=E7=A0=81=E6=9C=89=E6=B2=A1=E6=9C=89=E8=A2=AB?= =?UTF-8?q?=E7=88=AC=E5=8F=96=20=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 472 ++++++++++++++++++++++----------------------- lib/result.js | 11 +- lib/runtimeConf.js | 2 +- lib/spider.js | 28 ++- lib/util.js | 8 +- 5 files changed, 270 insertions(+), 251 deletions(-) diff --git a/README.md b/README.md index dbb66ea..924f2e6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

Language: java
- Last updated: 2019-02-11 + Last updated: 2019-02-12

@@ -18,279 +18,279 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| -|001|[two-sum](https://leetcode.com/problems/two-sum/)| [java](./solutions/001.two-sum/two-sum.java)|Easy|40.20%|| -|002|[add-two-numbers](https://leetcode.com/problems/add-two-numbers/)| [java](./solutions/002.add-two-numbers/add-two-numbers.java)|Medium|30.41%|| -|003|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [java](./solutions/003.longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.java)|Medium|26.08%|| -|005|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring/)| [java](./solutions/005.longest-palindromic-substring/longest-palindromic-substring.java)|Medium|26.32%|| +|001|[two-sum](https://leetcode.com/problems/two-sum/)| [java](./solutions/001.two-sum/two-sum.java)|Easy|40.22%|| +|002|[add-two-numbers](https://leetcode.com/problems/add-two-numbers/)| [java](./solutions/002.add-two-numbers/add-two-numbers.java)|Medium|30.43%|| +|003|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [java](./solutions/003.longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.java)|Medium|26.09%|| +|005|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring/)| [java](./solutions/005.longest-palindromic-substring/longest-palindromic-substring.java)|Medium|26.33%|| |007|[reverse-integer](https://leetcode.com/problems/reverse-integer/)| [java](./solutions/007.reverse-integer/reverse-integer.java)|Easy|25.07%|| |008|[string-to-integer-atoi](https://leetcode.com/problems/string-to-integer-atoi/)| [java](./solutions/008.string-to-integer-atoi/string-to-integer-atoi.java)|Medium|14.44%|| -|009|[palindrome-number](https://leetcode.com/problems/palindrome-number/)| [java](./solutions/009.palindrome-number/palindrome-number.java)|Easy|41.56%|| -|011|[container-with-most-water](https://leetcode.com/problems/container-with-most-water/)| [java](./solutions/011.container-with-most-water/container-with-most-water.java)|Medium|42.08%|| +|009|[palindrome-number](https://leetcode.com/problems/palindrome-number/)| [java](./solutions/009.palindrome-number/palindrome-number.java)|Easy|41.58%|| +|011|[container-with-most-water](https://leetcode.com/problems/container-with-most-water/)| [java](./solutions/011.container-with-most-water/container-with-most-water.java)|Medium|42.10%|| |014|[longest-common-prefix](https://leetcode.com/problems/longest-common-prefix/)| [java](./solutions/014.longest-common-prefix/longest-common-prefix.java)|Easy|32.89%|| -|015|[3sum](https://leetcode.com/problems/3sum/)| [java](./solutions/015.3sum/3sum.java)|Medium|23.14%|| -|016|[3sum-closest](https://leetcode.com/problems/3sum-closest/)| [java](./solutions/016.3sum-closest/3sum-closest.java)|Medium|33.87%|| -|018|[4sum](https://leetcode.com/problems/4sum/)| [java](./solutions/018.4sum/4sum.java)|Medium|29.46%|| +|015|[3sum](https://leetcode.com/problems/3sum/)| [java](./solutions/015.3sum/3sum.java)|Medium|23.15%|| +|016|[3sum-closest](https://leetcode.com/problems/3sum-closest/)| [java](./solutions/016.3sum-closest/3sum-closest.java)|Medium|33.88%|| +|018|[4sum](https://leetcode.com/problems/4sum/)| [java](./solutions/018.4sum/4sum.java)|Medium|29.48%|| |019|[remove-nth-node-from-end-of-list](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)| [java](./solutions/019.remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.java)|Medium|33.92%|| -|020|[valid-parentheses](https://leetcode.com/problems/valid-parentheses/)| [java](./solutions/020.valid-parentheses/valid-parentheses.java)|Easy|35.72%|| -|021|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists/)| [java](./solutions/021.merge-two-sorted-lists/merge-two-sorted-lists.java)|Easy|45.44%|| -|024|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)| [java](./solutions/024.swap-nodes-in-pairs/swap-nodes-in-pairs.java)|Medium|42.76%|| -|026|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| [java](./solutions/026.remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.java)|Easy|39.35%|| -|027|[remove-element](https://leetcode.com/problems/remove-element/)| [java](./solutions/027.remove-element/remove-element.java)|Easy|43.32%|| -|028|[implement-strstr](https://leetcode.com/problems/implement-strstr/)| [java](./solutions/028.implement-strstr/implement-strstr.java)|Easy|31.06%|| +|020|[valid-parentheses](https://leetcode.com/problems/valid-parentheses/)| [java](./solutions/020.valid-parentheses/valid-parentheses.java)|Easy|35.73%|| +|021|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists/)| [java](./solutions/021.merge-two-sorted-lists/merge-two-sorted-lists.java)|Easy|45.47%|| +|024|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)| [java](./solutions/024.swap-nodes-in-pairs/swap-nodes-in-pairs.java)|Medium|42.79%|| +|026|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| [java](./solutions/026.remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.java)|Easy|39.37%|| +|027|[remove-element](https://leetcode.com/problems/remove-element/)| [java](./solutions/027.remove-element/remove-element.java)|Easy|43.33%|| +|028|[implement-strstr](https://leetcode.com/problems/implement-strstr/)| [java](./solutions/028.implement-strstr/implement-strstr.java)|Easy|31.07%|| |031|[next-permutation](https://leetcode.com/problems/next-permutation/)| [java](./solutions/031.next-permutation/next-permutation.java)|Medium|29.95%|| |033|[search-in-rotated-sorted-array](https://leetcode.com/problems/search-in-rotated-sorted-array/)| [java](./solutions/033.search-in-rotated-sorted-array/search-in-rotated-sorted-array.java)|Medium|32.57%|| -|034|[find-first-and-last-position-of-element-in-sorted-array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| [java](./solutions/034.find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.java)|Medium|32.84%|| +|034|[find-first-and-last-position-of-element-in-sorted-array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| [java](./solutions/034.find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.java)|Medium|32.85%|| |035|[search-insert-position](https://leetcode.com/problems/search-insert-position/)| [java](./solutions/035.search-insert-position/search-insert-position.java)|Easy|40.37%|| -|036|[valid-sudoku](https://leetcode.com/problems/valid-sudoku/)| [java](./solutions/036.valid-sudoku/valid-sudoku.java)|Medium|41.53%|| -|038|[count-and-say](https://leetcode.com/problems/count-and-say/)| [java](./solutions/038.count-and-say/count-and-say.java)|Easy|39.27%|| -|039|[combination-sum](https://leetcode.com/problems/combination-sum/)| [java](./solutions/039.combination-sum/combination-sum.java)|Medium|46.23%|| -|040|[combination-sum-ii](https://leetcode.com/problems/combination-sum-ii/)| [java](./solutions/040.combination-sum-ii/combination-sum-ii.java)|Medium|39.77%|| -|045|[jump-game-ii](https://leetcode.com/problems/jump-game-ii/)| [java](./solutions/045.jump-game-ii/jump-game-ii.java)|Hard|27.21%|| -|048|[rotate-image](https://leetcode.com/problems/rotate-image/)| [java](./solutions/048.rotate-image/rotate-image.java)|Medium|46.40%|| -|053|[maximum-subarray](https://leetcode.com/problems/maximum-subarray/)| [java](./solutions/053.maximum-subarray/maximum-subarray.java)|Easy|42.56%|| -|054|[spiral-matrix](https://leetcode.com/problems/spiral-matrix/)| [java](./solutions/054.spiral-matrix/spiral-matrix.java)|Medium|29.41%|| +|036|[valid-sudoku](https://leetcode.com/problems/valid-sudoku/)| [java](./solutions/036.valid-sudoku/valid-sudoku.java)|Medium|41.54%|| +|038|[count-and-say](https://leetcode.com/problems/count-and-say/)| [java](./solutions/038.count-and-say/count-and-say.java)|Easy|39.28%|| +|039|[combination-sum](https://leetcode.com/problems/combination-sum/)| [java](./solutions/039.combination-sum/combination-sum.java)|Medium|46.25%|| +|040|[combination-sum-ii](https://leetcode.com/problems/combination-sum-ii/)| [java](./solutions/040.combination-sum-ii/combination-sum-ii.java)|Medium|39.79%|| +|045|[jump-game-ii](https://leetcode.com/problems/jump-game-ii/)| [java](./solutions/045.jump-game-ii/jump-game-ii.java)|Hard|27.22%|| +|048|[rotate-image](https://leetcode.com/problems/rotate-image/)| [java](./solutions/048.rotate-image/rotate-image.java)|Medium|46.42%|| +|053|[maximum-subarray](https://leetcode.com/problems/maximum-subarray/)| [java](./solutions/053.maximum-subarray/maximum-subarray.java)|Easy|42.57%|| +|054|[spiral-matrix](https://leetcode.com/problems/spiral-matrix/)| [java](./solutions/054.spiral-matrix/spiral-matrix.java)|Medium|29.42%|| |055|[jump-game](https://leetcode.com/problems/jump-game/)| [java](./solutions/055.jump-game/jump-game.java)|Medium|31.12%|| -|056|[merge-intervals](https://leetcode.com/problems/merge-intervals/)| [java](./solutions/056.merge-intervals/merge-intervals.java)|Medium|34.58%|| -|058|[length-of-last-word](https://leetcode.com/problems/length-of-last-word/)| [java](./solutions/058.length-of-last-word/length-of-last-word.java)|Easy|32.13%|| +|056|[merge-intervals](https://leetcode.com/problems/merge-intervals/)| [java](./solutions/056.merge-intervals/merge-intervals.java)|Medium|34.59%|| +|058|[length-of-last-word](https://leetcode.com/problems/length-of-last-word/)| [java](./solutions/058.length-of-last-word/length-of-last-word.java)|Easy|32.14%|| |061|[rotate-list](https://leetcode.com/problems/rotate-list/)| [java](./solutions/061.rotate-list/rotate-list.java)|Medium|26.33%|| -|062|[unique-paths](https://leetcode.com/problems/unique-paths/)| [java](./solutions/062.unique-paths/unique-paths.java)|Medium|46.05%|| +|062|[unique-paths](https://leetcode.com/problems/unique-paths/)| [java](./solutions/062.unique-paths/unique-paths.java)|Medium|46.07%|| |063|[unique-paths-ii](https://leetcode.com/problems/unique-paths-ii/)| [java](./solutions/063.unique-paths-ii/unique-paths-ii.java)|Medium|33.22%|| -|064|[minimum-path-sum](https://leetcode.com/problems/minimum-path-sum/)| [java](./solutions/064.minimum-path-sum/minimum-path-sum.java)|Medium|45.20%|| +|064|[minimum-path-sum](https://leetcode.com/problems/minimum-path-sum/)| [java](./solutions/064.minimum-path-sum/minimum-path-sum.java)|Medium|45.22%|| |066|[plus-one](https://leetcode.com/problems/plus-one/)| [java](./solutions/066.plus-one/plus-one.java)|Easy|40.56%|| -|067|[add-binary](https://leetcode.com/problems/add-binary/)| [java](./solutions/067.add-binary/add-binary.java)|Easy|37.64%|| +|067|[add-binary](https://leetcode.com/problems/add-binary/)| [java](./solutions/067.add-binary/add-binary.java)|Easy|37.65%|| |069|[sqrtx](https://leetcode.com/problems/sqrtx/)| [java](./solutions/069.sqrtx/sqrtx.java)|Easy|30.47%|| -|070|[climbing-stairs](https://leetcode.com/problems/climbing-stairs/)| [java](./solutions/070.climbing-stairs/climbing-stairs.java)|Easy|43.15%|| -|082|[remove-duplicates-from-sorted-list-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/)| [java](./solutions/082.remove-duplicates-from-sorted-list-ii/remove-duplicates-from-sorted-list-ii.java)|Medium|32.01%|| +|070|[climbing-stairs](https://leetcode.com/problems/climbing-stairs/)| [java](./solutions/070.climbing-stairs/climbing-stairs.java)|Easy|43.16%|| +|082|[remove-duplicates-from-sorted-list-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/)| [java](./solutions/082.remove-duplicates-from-sorted-list-ii/remove-duplicates-from-sorted-list-ii.java)|Medium|32.02%|| |083|[remove-duplicates-from-sorted-list](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)| [java](./solutions/083.remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.java)|Easy|41.76%|| -|086|[partition-list](https://leetcode.com/problems/partition-list/)| [java](./solutions/086.partition-list/partition-list.java)|Medium|36.06%|| -|088|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array/)| [java](./solutions/088.merge-sorted-array/merge-sorted-array.java)|Easy|34.62%|| -|091|[decode-ways](https://leetcode.com/problems/decode-ways/)| [java](./solutions/091.decode-ways/decode-ways.java)|Medium|21.74%|| -|092|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii/)| [java](./solutions/092.reverse-linked-list-ii/reverse-linked-list-ii.java)|Medium|33.82%|| -|093|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses/)| [java](./solutions/093.restore-ip-addresses/restore-ip-addresses.java)|Medium|30.52%|| -|094|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)| [java](./solutions/094.binary-tree-inorder-traversal/binary-tree-inorder-traversal.java)|Medium|54.61%|| -|095|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii/)| [java](./solutions/095.unique-binary-search-trees-ii/unique-binary-search-trees-ii.java)|Medium|34.56%|| -|096|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees/)| [java](./solutions/096.unique-binary-search-trees/unique-binary-search-trees.java)|Medium|44.79%|| -|098|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree/)| [java](./solutions/098.validate-binary-search-tree/validate-binary-search-tree.java)|Medium|25.13%|| -|100|[same-tree](https://leetcode.com/problems/same-tree/)| [java](./solutions/100.same-tree/same-tree.java)|Easy|49.26%|| -|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree/)| [java](./solutions/101.symmetric-tree/symmetric-tree.java)|Easy|42.49%|| -|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [java](./solutions/102.binary-tree-level-order-traversal/binary-tree-level-order-traversal.java)|Medium|46.65%|| -|103|[binary-tree-zigzag-level-order-traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)| [java](./solutions/103.binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.java)|Medium|40.14%|| -|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)| [java](./solutions/104.maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.java)|Easy|58.83%|| -|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)| [java](./solutions/105.construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.java)|Medium|39.05%|| -|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)| [java](./solutions/106.construct-binary-tree-from-inorder-and-postorder-traversal/construct-binary-tree-from-inorder-and-postorder-traversal.java)|Medium|37.61%|| -|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)| [java](./solutions/107.binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.java)|Easy|45.36%|| -|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/)| [java](./solutions/108.convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.java)|Easy|48.88%|| -|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| [java](./solutions/109.convert-sorted-list-to-binary-search-tree/convert-sorted-list-to-binary-search-tree.java)|Medium|39.25%|| -|110|[balanced-binary-tree](https://leetcode.com/problems/balanced-binary-tree/)| [java](./solutions/110.balanced-binary-tree/balanced-binary-tree.java)|Easy|40.22%|| -|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)| [java](./solutions/111.minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.java)|Easy|34.74%|| -|112|[path-sum](https://leetcode.com/problems/path-sum/)||Easy|36.84%|| -|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii/)| [java](./solutions/113.path-sum-ii/path-sum-ii.java)|Medium|39.15%|| -|114|[flatten-binary-tree-to-linked-list](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)||Medium|40.77%|| -|116|[populating-next-right-pointers-in-each-node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)||Medium|36.51%|| +|086|[partition-list](https://leetcode.com/problems/partition-list/)| [java](./solutions/086.partition-list/partition-list.java)|Medium|36.07%|| +|088|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array/)| [java](./solutions/088.merge-sorted-array/merge-sorted-array.java)|Easy|34.63%|| +|091|[decode-ways](https://leetcode.com/problems/decode-ways/)| [java](./solutions/091.decode-ways/decode-ways.java)|Medium|21.75%|| +|092|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii/)| [java](./solutions/092.reverse-linked-list-ii/reverse-linked-list-ii.java)|Medium|33.83%|| +|093|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses/)| [java](./solutions/093.restore-ip-addresses/restore-ip-addresses.java)|Medium|30.53%|| +|094|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)| [java](./solutions/094.binary-tree-inorder-traversal/binary-tree-inorder-traversal.java)|Medium|54.64%|| +|095|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii/)| [java](./solutions/095.unique-binary-search-trees-ii/unique-binary-search-trees-ii.java)|Medium|34.57%|| +|096|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees/)| [java](./solutions/096.unique-binary-search-trees/unique-binary-search-trees.java)|Medium|44.80%|| +|098|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree/)| [java](./solutions/098.validate-binary-search-tree/validate-binary-search-tree.java)|Medium|25.14%|| +|100|[same-tree](https://leetcode.com/problems/same-tree/)| [java](./solutions/100.same-tree/same-tree.java)|Easy|49.27%|| +|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree/)| [java](./solutions/101.symmetric-tree/symmetric-tree.java)|Easy|42.51%|| +|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [java](./solutions/102.binary-tree-level-order-traversal/binary-tree-level-order-traversal.java)|Medium|46.68%|| +|103|[binary-tree-zigzag-level-order-traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)| [java](./solutions/103.binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.java)|Medium|40.16%|| +|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)| [java](./solutions/104.maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.java)|Easy|58.85%|| +|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)| [java](./solutions/105.construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.java)|Medium|39.07%|| +|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)| [java](./solutions/106.construct-binary-tree-from-inorder-and-postorder-traversal/construct-binary-tree-from-inorder-and-postorder-traversal.java)|Medium|37.63%|| +|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)| [java](./solutions/107.binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.java)|Easy|45.37%|| +|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/)| [java](./solutions/108.convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.java)|Easy|48.90%|| +|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| [java](./solutions/109.convert-sorted-list-to-binary-search-tree/convert-sorted-list-to-binary-search-tree.java)|Medium|39.27%|| +|110|[balanced-binary-tree](https://leetcode.com/problems/balanced-binary-tree/)| [java](./solutions/110.balanced-binary-tree/balanced-binary-tree.java)|Easy|40.23%|| +|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)| [java](./solutions/111.minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.java)|Easy|34.75%|| +|112|[path-sum](https://leetcode.com/problems/path-sum/)| [java](./solutions/112.path-sum/path-sum.java)|Easy|36.85%|| +|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii/)| [java](./solutions/113.path-sum-ii/path-sum-ii.java)|Medium|39.16%|| +|114|[flatten-binary-tree-to-linked-list](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)| [java](./solutions/114.flatten-binary-tree-to-linked-list/flatten-binary-tree-to-linked-list.java)|Medium|40.78%|| +|116|[populating-next-right-pointers-in-each-node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)| [java](./solutions/116.populating-next-right-pointers-in-each-node/populating-next-right-pointers-in-each-node.java)|Medium|36.51%|| |117|[populating-next-right-pointers-in-each-node-ii](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/)| [java](./solutions/117.populating-next-right-pointers-in-each-node-ii/populating-next-right-pointers-in-each-node-ii.java)|Medium|33.32%|| -|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle/)||Easy|44.15%|| -|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii/)||Easy|41.66%|| -|120|[triangle](https://leetcode.com/problems/triangle/)||Medium|38.09%|| -|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)||Easy|45.94%|| -|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)||Easy|50.66%|| -|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome/)||Easy|29.96%|| -|127|[word-ladder](https://leetcode.com/problems/word-ladder/)||Medium|22.62%|| -|129|[sum-root-to-leaf-numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers/)||Medium|41.10%|| -|130|[surrounded-regions](https://leetcode.com/problems/surrounded-regions/)||Medium|21.94%|| -|133|[clone-graph](https://leetcode.com/problems/clone-graph/)||Medium|25.13%|| -|136|[single-number](https://leetcode.com/problems/single-number/)||Easy|58.68%|| -|139|[word-break](https://leetcode.com/problems/word-break/)||Medium|34.06%|| -|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle/)||Easy|35.45%|| -|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/)||Medium|49.98%|| -|152|[maximum-product-subarray](https://leetcode.com/problems/maximum-product-subarray/)||Medium|28.40%|| -|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists/)||Easy|31.89%|| -|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)||Easy|48.98%|| -|168|[excel-sheet-column-title](https://leetcode.com/problems/excel-sheet-column-title/)||Easy|28.42%|| -|169|[majority-element](https://leetcode.com/problems/majority-element/)||Easy|51.22%|| -|171|[excel-sheet-column-number](https://leetcode.com/problems/excel-sheet-column-number/)||Easy|50.71%|| -|172|[factorial-trailing-zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/)||Easy|37.20%|| -|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator/)||Medium|46.68%|| -|189|[rotate-array](https://leetcode.com/problems/rotate-array/)||Easy|28.63%|| -|190|[reverse-bits](https://leetcode.com/problems/reverse-bits/)||Easy|29.94%|| -|191|[number-of-1-bits](https://leetcode.com/problems/number-of-1-bits/)||Easy|41.70%|| -|198|[house-robber](https://leetcode.com/problems/house-robber/)||Easy|40.73%|| -|199|[binary-tree-right-side-view](https://leetcode.com/problems/binary-tree-right-side-view/)||Medium|46.28%|| -|202|[happy-number](https://leetcode.com/problems/happy-number/)||Easy|44.09%|| -|203|[remove-linked-list-elements](https://leetcode.com/problems/remove-linked-list-elements/)||Easy|35.11%|| -|204|[count-primes](https://leetcode.com/problems/count-primes/)||Easy|28.04%|| -|205|[isomorphic-strings](https://leetcode.com/problems/isomorphic-strings/)||Easy|36.54%|| -|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list/)||Easy|52.22%|| -|213|[house-robber-ii](https://leetcode.com/problems/house-robber-ii/)||Medium|35.02%|| -|217|[contains-duplicate](https://leetcode.com/problems/contains-duplicate/)||Easy|50.51%|| -|219|[contains-duplicate-ii](https://leetcode.com/problems/contains-duplicate-ii/)||Easy|34.54%|| -|221|[maximal-square](https://leetcode.com/problems/maximal-square/)||Medium|32.08%|| -|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes/)||Medium|30.92%|| -|226|[invert-binary-tree](https://leetcode.com/problems/invert-binary-tree/)||Easy|56.73%|| -|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst/)||Medium|49.55%|| -|231|[power-of-two](https://leetcode.com/problems/power-of-two/)||Easy|41.55%|| -|234|[palindrome-linked-list](https://leetcode.com/problems/palindrome-linked-list/)||Easy|35.15%|| -|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)||Easy|43.13%|| -|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)||Medium|34.95%|| -|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list/)||Easy|51.61%|| -|242|[valid-anagram](https://leetcode.com/problems/valid-anagram/)||Easy|50.61%|| -|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths/)| [java](./solutions/257.binary-tree-paths/binary-tree-paths.java)|Easy|44.76%|| -|258|[add-digits](https://leetcode.com/problems/add-digits/)| [java](./solutions/258.add-digits/add-digits.java)|Easy|53.37%|| -|263|[ugly-number](https://leetcode.com/problems/ugly-number/)| [java](./solutions/263.ugly-number/ugly-number.java)|Easy|40.32%|| -|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii/)| [java](./solutions/264.ugly-number-ii/ugly-number-ii.java)|Medium|35.37%|| -|268|[missing-number](https://leetcode.com/problems/missing-number/)| [java](./solutions/268.missing-number/missing-number.java)|Easy|47.33%|| -|278|[first-bad-version](https://leetcode.com/problems/first-bad-version/)| [java](./solutions/278.first-bad-version/first-bad-version.java)|Easy|28.66%|| -|279|[perfect-squares](https://leetcode.com/problems/perfect-squares/)| [java](./solutions/279.perfect-squares/perfect-squares.java)|Medium|40.38%|| -|283|[move-zeroes](https://leetcode.com/problems/move-zeroes/)| [java](./solutions/283.move-zeroes/move-zeroes.java)|Easy|53.42%|| -|290|[word-pattern](https://leetcode.com/problems/word-pattern/)| [java](./solutions/290.word-pattern/word-pattern.java)|Easy|34.43%|| -|300|[longest-increasing-subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|40.08%|| -|303|[range-sum-query-immutable](https://leetcode.com/problems/range-sum-query-immutable/)| [java](./solutions/303.range-sum-query-immutable/range-sum-query-immutable.java)|Easy|36.29%|| -|304|[range-sum-query-2d-immutable](https://leetcode.com/problems/range-sum-query-2d-immutable/)| [java](./solutions/304.range-sum-query-2d-immutable/range-sum-query-2d-immutable.java)|Medium|30.89%|| +|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle/)| [java](./solutions/118.pascals-triangle/pascals-triangle.java)|Easy|44.17%|| +|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii/)| [java](./solutions/119.pascals-triangle-ii/pascals-triangle-ii.java)|Easy|41.68%|| +|120|[triangle](https://leetcode.com/problems/triangle/)| [java](./solutions/120.triangle/triangle.java)|Medium|38.10%|| +|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)| [java](./solutions/121.best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.java)|Easy|45.95%|| +|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)| [java](./solutions/122.best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.java)|Easy|50.67%|| +|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome/)| [java](./solutions/125.valid-palindrome/valid-palindrome.java)|Easy|29.97%|| +|127|[word-ladder](https://leetcode.com/problems/word-ladder/)| [java](./solutions/127.word-ladder/word-ladder.java)|Medium|22.63%|| +|129|[sum-root-to-leaf-numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers/)| [java](./solutions/129.sum-root-to-leaf-numbers/sum-root-to-leaf-numbers.java)|Medium|41.11%|| +|130|[surrounded-regions](https://leetcode.com/problems/surrounded-regions/)| [java](./solutions/130.surrounded-regions/surrounded-regions.java)|Medium|21.95%|| +|133|[clone-graph](https://leetcode.com/problems/clone-graph/)| [java](./solutions/133.clone-graph/clone-graph.java)|Medium|25.12%|| +|136|[single-number](https://leetcode.com/problems/single-number/)| [java](./solutions/136.single-number/single-number.java)|Easy|58.69%|| +|139|[word-break](https://leetcode.com/problems/word-break/)| [java](./solutions/139.word-break/word-break.java)|Medium|34.08%|| +|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle/)| [java](./solutions/141.linked-list-cycle/linked-list-cycle.java)|Easy|35.46%|| +|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/)| [java](./solutions/144.binary-tree-preorder-traversal/binary-tree-preorder-traversal.java)|Medium|49.98%|| +|152|[maximum-product-subarray](https://leetcode.com/problems/maximum-product-subarray/)| [java](./solutions/152.maximum-product-subarray/maximum-product-subarray.java)|Medium|28.40%|| +|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists/)| [java](./solutions/160.intersection-of-two-linked-lists/intersection-of-two-linked-lists.java)|Easy|31.91%|| +|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)| [java](./solutions/167.two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.java)|Easy|49.00%|| +|168|[excel-sheet-column-title](https://leetcode.com/problems/excel-sheet-column-title/)| [java](./solutions/168.excel-sheet-column-title/excel-sheet-column-title.java)|Easy|28.42%|| +|169|[majority-element](https://leetcode.com/problems/majority-element/)| [java](./solutions/169.majority-element/majority-element.java)|Easy|51.23%|| +|171|[excel-sheet-column-number](https://leetcode.com/problems/excel-sheet-column-number/)| [java](./solutions/171.excel-sheet-column-number/excel-sheet-column-number.java)|Easy|50.71%|| +|172|[factorial-trailing-zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/)| [java](./solutions/172.factorial-trailing-zeroes/factorial-trailing-zeroes.java)|Easy|37.21%|| +|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator/)| [java](./solutions/173.binary-search-tree-iterator/binary-search-tree-iterator.java)|Medium|46.71%|| +|189|[rotate-array](https://leetcode.com/problems/rotate-array/)| [java](./solutions/189.rotate-array/rotate-array.java)|Easy|28.65%|| +|190|[reverse-bits](https://leetcode.com/problems/reverse-bits/)| [java](./solutions/190.reverse-bits/reverse-bits.java)|Easy|29.95%|| +|191|[number-of-1-bits](https://leetcode.com/problems/number-of-1-bits/)| [java](./solutions/191.number-of-1-bits/number-of-1-bits.java)|Easy|41.71%|| +|198|[house-robber](https://leetcode.com/problems/house-robber/)| [java](./solutions/198.house-robber/house-robber.java)|Easy|40.73%|| +|199|[binary-tree-right-side-view](https://leetcode.com/problems/binary-tree-right-side-view/)| [java](./solutions/199.binary-tree-right-side-view/binary-tree-right-side-view.java)|Medium|46.30%|| +|202|[happy-number](https://leetcode.com/problems/happy-number/)| [java](./solutions/202.happy-number/happy-number.java)|Easy|44.10%|| +|203|[remove-linked-list-elements](https://leetcode.com/problems/remove-linked-list-elements/)| [java](./solutions/203.remove-linked-list-elements/remove-linked-list-elements.java)|Easy|35.12%|| +|204|[count-primes](https://leetcode.com/problems/count-primes/)| [java](./solutions/204.count-primes/count-primes.java)|Easy|28.05%|| +|205|[isomorphic-strings](https://leetcode.com/problems/isomorphic-strings/)| [java](./solutions/205.isomorphic-strings/isomorphic-strings.java)|Easy|36.55%|| +|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list/)| [java](./solutions/206.reverse-linked-list/reverse-linked-list.java)|Easy|52.25%|| +|213|[house-robber-ii](https://leetcode.com/problems/house-robber-ii/)| [java](./solutions/213.house-robber-ii/house-robber-ii.java)|Medium|35.02%|| +|217|[contains-duplicate](https://leetcode.com/problems/contains-duplicate/)| [java](./solutions/217.contains-duplicate/contains-duplicate.java)|Easy|50.53%|| +|219|[contains-duplicate-ii](https://leetcode.com/problems/contains-duplicate-ii/)| [java](./solutions/219.contains-duplicate-ii/contains-duplicate-ii.java)|Easy|34.54%|| +|221|[maximal-square](https://leetcode.com/problems/maximal-square/)| [java](./solutions/221.maximal-square/maximal-square.java)|Medium|32.08%|| +|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes/)| [java](./solutions/222.count-complete-tree-nodes/count-complete-tree-nodes.java)|Medium|30.94%|| +|226|[invert-binary-tree](https://leetcode.com/problems/invert-binary-tree/)| [java](./solutions/226.invert-binary-tree/invert-binary-tree.java)|Easy|56.74%|| +|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst/)| [java](./solutions/230.kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.java)|Medium|49.57%|| +|231|[power-of-two](https://leetcode.com/problems/power-of-two/)| [java](./solutions/231.power-of-two/power-of-two.java)|Easy|41.55%|| +|234|[palindrome-linked-list](https://leetcode.com/problems/palindrome-linked-list/)| [java](./solutions/234.palindrome-linked-list/palindrome-linked-list.java)|Easy|35.16%|| +|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)| [java](./solutions/235.lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.java)|Easy|43.15%|| +|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)| [java](./solutions/236.lowest-common-ancestor-of-a-binary-tree/lowest-common-ancestor-of-a-binary-tree.java)|Medium|34.98%|| +|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list/)| [java](./solutions/237.delete-node-in-a-linked-list/delete-node-in-a-linked-list.java)|Easy|51.62%|| +|242|[valid-anagram](https://leetcode.com/problems/valid-anagram/)| [java](./solutions/242.valid-anagram/valid-anagram.java)|Easy|50.63%|| +|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths/)| [java](./solutions/257.binary-tree-paths/binary-tree-paths.java)|Easy|44.78%|| +|258|[add-digits](https://leetcode.com/problems/add-digits/)| [java](./solutions/258.add-digits/add-digits.java)|Easy|53.38%|| +|263|[ugly-number](https://leetcode.com/problems/ugly-number/)| [java](./solutions/263.ugly-number/ugly-number.java)|Easy|40.31%|| +|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii/)| [java](./solutions/264.ugly-number-ii/ugly-number-ii.java)|Medium|35.38%|| +|268|[missing-number](https://leetcode.com/problems/missing-number/)| [java](./solutions/268.missing-number/missing-number.java)|Easy|47.34%|| +|278|[first-bad-version](https://leetcode.com/problems/first-bad-version/)| [java](./solutions/278.first-bad-version/first-bad-version.java)|Easy|28.68%|| +|279|[perfect-squares](https://leetcode.com/problems/perfect-squares/)| [java](./solutions/279.perfect-squares/perfect-squares.java)|Medium|40.40%|| +|283|[move-zeroes](https://leetcode.com/problems/move-zeroes/)| [java](./solutions/283.move-zeroes/move-zeroes.java)|Easy|53.43%|| +|290|[word-pattern](https://leetcode.com/problems/word-pattern/)| [java](./solutions/290.word-pattern/word-pattern.java)|Easy|34.44%|| +|300|[longest-increasing-subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|40.09%|| +|303|[range-sum-query-immutable](https://leetcode.com/problems/range-sum-query-immutable/)| [java](./solutions/303.range-sum-query-immutable/range-sum-query-immutable.java)|Easy|36.31%|| +|304|[range-sum-query-2d-immutable](https://leetcode.com/problems/range-sum-query-2d-immutable/)| [java](./solutions/304.range-sum-query-2d-immutable/range-sum-query-2d-immutable.java)|Medium|30.90%|| |309|[best-time-to-buy-and-sell-stock-with-cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/)| [java](./solutions/309.best-time-to-buy-and-sell-stock-with-cooldown/best-time-to-buy-and-sell-stock-with-cooldown.java)|Medium|43.36%|| -|322|[coin-change](https://leetcode.com/problems/coin-change/)| [java](./solutions/322.coin-change/coin-change.java)|Medium|28.75%|| +|322|[coin-change](https://leetcode.com/problems/coin-change/)| [java](./solutions/322.coin-change/coin-change.java)|Medium|28.76%|| |326|[power-of-three](https://leetcode.com/problems/power-of-three/)| [java](./solutions/326.power-of-three/power-of-three.java)|Easy|41.33%|| -|338|[counting-bits](https://leetcode.com/problems/counting-bits/)| [java](./solutions/338.counting-bits/counting-bits.java)|Medium|63.80%|| +|338|[counting-bits](https://leetcode.com/problems/counting-bits/)| [java](./solutions/338.counting-bits/counting-bits.java)|Medium|63.81%|| |342|[power-of-four](https://leetcode.com/problems/power-of-four/)| [java](./solutions/342.power-of-four/power-of-four.java)|Easy|39.92%|| -|343|[integer-break](https://leetcode.com/problems/integer-break/)| [java](./solutions/343.integer-break/integer-break.java)|Medium|47.22%|| -|344|[reverse-string](https://leetcode.com/problems/reverse-string/)| [java](./solutions/344.reverse-string/reverse-string.java)|Easy|62.64%|| -|345|[reverse-vowels-of-a-string](https://leetcode.com/problems/reverse-vowels-of-a-string/)| [java](./solutions/345.reverse-vowels-of-a-string/reverse-vowels-of-a-string.java)|Easy|40.70%|| -|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [java](./solutions/349.intersection-of-two-arrays/intersection-of-two-arrays.java)|Easy|52.46%|| -|350|[intersection-of-two-arrays-ii](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [java](./solutions/350.intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.java)|Easy|46.50%|| +|343|[integer-break](https://leetcode.com/problems/integer-break/)| [java](./solutions/343.integer-break/integer-break.java)|Medium|47.23%|| +|344|[reverse-string](https://leetcode.com/problems/reverse-string/)| [java](./solutions/344.reverse-string/reverse-string.java)|Easy|62.65%|| +|345|[reverse-vowels-of-a-string](https://leetcode.com/problems/reverse-vowels-of-a-string/)| [java](./solutions/345.reverse-vowels-of-a-string/reverse-vowels-of-a-string.java)|Easy|40.71%|| +|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [java](./solutions/349.intersection-of-two-arrays/intersection-of-two-arrays.java)|Easy|52.48%|| +|350|[intersection-of-two-arrays-ii](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [java](./solutions/350.intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.java)|Easy|46.51%|| |357|[count-numbers-with-unique-digits](https://leetcode.com/problems/count-numbers-with-unique-digits/)| [java](./solutions/357.count-numbers-with-unique-digits/count-numbers-with-unique-digits.java)|Medium|46.54%|| |367|[valid-perfect-square](https://leetcode.com/problems/valid-perfect-square/)| [java](./solutions/367.valid-perfect-square/valid-perfect-square.java)|Easy|39.29%|| -|368|[largest-divisible-subset](https://leetcode.com/problems/largest-divisible-subset/)| [java](./solutions/368.largest-divisible-subset/largest-divisible-subset.java)|Medium|34.42%|| -|371|[sum-of-two-integers](https://leetcode.com/problems/sum-of-two-integers/)| [java](./solutions/371.sum-of-two-integers/sum-of-two-integers.java)|Easy|51.36%|| -|374|[guess-number-higher-or-lower](https://leetcode.com/problems/guess-number-higher-or-lower/)| [java](./solutions/374.guess-number-higher-or-lower/guess-number-higher-or-lower.java)|Easy|38.54%|| +|368|[largest-divisible-subset](https://leetcode.com/problems/largest-divisible-subset/)| [java](./solutions/368.largest-divisible-subset/largest-divisible-subset.java)|Medium|34.41%|| +|371|[sum-of-two-integers](https://leetcode.com/problems/sum-of-two-integers/)| [java](./solutions/371.sum-of-two-integers/sum-of-two-integers.java)|Easy|51.35%|| +|374|[guess-number-higher-or-lower](https://leetcode.com/problems/guess-number-higher-or-lower/)| [java](./solutions/374.guess-number-higher-or-lower/guess-number-higher-or-lower.java)|Easy|38.55%|| |375|[guess-number-higher-or-lower-ii](https://leetcode.com/problems/guess-number-higher-or-lower-ii/)| [java](./solutions/375.guess-number-higher-or-lower-ii/guess-number-higher-or-lower-ii.java)|Medium|37.13%|| |376|[wiggle-subsequence](https://leetcode.com/problems/wiggle-subsequence/)| [java](./solutions/376.wiggle-subsequence/wiggle-subsequence.java)|Medium|36.81%|| |377|[combination-sum-iv](https://leetcode.com/problems/combination-sum-iv/)| [java](./solutions/377.combination-sum-iv/combination-sum-iv.java)|Medium|43.80%|| -|383|[ransom-note](https://leetcode.com/problems/ransom-note/)| [java](./solutions/383.ransom-note/ransom-note.java)|Easy|49.13%|| -|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string/)| [java](./solutions/387.first-unique-character-in-a-string/first-unique-character-in-a-string.java)|Easy|48.84%|| -|389|[find-the-difference](https://leetcode.com/problems/find-the-difference/)| [java](./solutions/389.find-the-difference/find-the-difference.java)|Easy|52.60%|| -|392|[is-subsequence](https://leetcode.com/problems/is-subsequence/)| [java](./solutions/392.is-subsequence/is-subsequence.java)|Medium|46.05%|| -|400|[nth-digit](https://leetcode.com/problems/nth-digit/)| [java](./solutions/400.nth-digit/nth-digit.java)|Easy|30.04%|| +|383|[ransom-note](https://leetcode.com/problems/ransom-note/)| [java](./solutions/383.ransom-note/ransom-note.java)|Easy|49.14%|| +|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string/)| [java](./solutions/387.first-unique-character-in-a-string/first-unique-character-in-a-string.java)|Easy|48.86%|| +|389|[find-the-difference](https://leetcode.com/problems/find-the-difference/)| [java](./solutions/389.find-the-difference/find-the-difference.java)|Easy|52.61%|| +|392|[is-subsequence](https://leetcode.com/problems/is-subsequence/)| [java](./solutions/392.is-subsequence/is-subsequence.java)|Medium|46.06%|| +|400|[nth-digit](https://leetcode.com/problems/nth-digit/)| [java](./solutions/400.nth-digit/nth-digit.java)|Easy|30.03%|| |401|[binary-watch](https://leetcode.com/problems/binary-watch/)| [java](./solutions/401.binary-watch/binary-watch.java)|Easy|45.00%|| |404|[sum-of-left-leaves](https://leetcode.com/problems/sum-of-left-leaves/)| [java](./solutions/404.sum-of-left-leaves/sum-of-left-leaves.java)|Easy|48.62%|| -|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal/)| [java](./solutions/405.convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.java)|Easy|41.63%|| -|409|[longest-palindrome](https://leetcode.com/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|47.27%|| -|413|[arithmetic-slices](https://leetcode.com/problems/arithmetic-slices/)| [java](./solutions/413.arithmetic-slices/arithmetic-slices.java)|Medium|55.15%|| -|414|[third-maximum-number](https://leetcode.com/problems/third-maximum-number/)| [java](./solutions/414.third-maximum-number/third-maximum-number.java)|Easy|28.58%|| +|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal/)| [java](./solutions/405.convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.java)|Easy|41.64%|| +|409|[longest-palindrome](https://leetcode.com/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|47.29%|| +|413|[arithmetic-slices](https://leetcode.com/problems/arithmetic-slices/)| [java](./solutions/413.arithmetic-slices/arithmetic-slices.java)|Medium|55.16%|| +|414|[third-maximum-number](https://leetcode.com/problems/third-maximum-number/)| [java](./solutions/414.third-maximum-number/third-maximum-number.java)|Easy|28.59%|| |415|[add-strings](https://leetcode.com/problems/add-strings/)| [java](./solutions/415.add-strings/add-strings.java)|Easy|42.91%|| |416|[partition-equal-subset-sum](https://leetcode.com/problems/partition-equal-subset-sum/)| [java](./solutions/416.partition-equal-subset-sum/partition-equal-subset-sum.java)|Medium|39.65%|| |434|[number-of-segments-in-a-string](https://leetcode.com/problems/number-of-segments-in-a-string/)| [java](./solutions/434.number-of-segments-in-a-string/number-of-segments-in-a-string.java)|Easy|36.60%|| -|437|[path-sum-iii](https://leetcode.com/problems/path-sum-iii/)| [java](./solutions/437.path-sum-iii/path-sum-iii.java)|Easy|41.72%|| -|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string/)| [java](./solutions/438.find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.java)|Easy|36.02%|| -|441|[arranging-coins](https://leetcode.com/problems/arranging-coins/)| [java](./solutions/441.arranging-coins/arranging-coins.java)|Easy|37.33%|| +|437|[path-sum-iii](https://leetcode.com/problems/path-sum-iii/)| [java](./solutions/437.path-sum-iii/path-sum-iii.java)|Easy|41.73%|| +|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string/)| [java](./solutions/438.find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.java)|Easy|36.04%|| +|441|[arranging-coins](https://leetcode.com/problems/arranging-coins/)| [java](./solutions/441.arranging-coins/arranging-coins.java)|Easy|37.34%|| |443|[string-compression](https://leetcode.com/problems/string-compression/)| [java](./solutions/443.string-compression/string-compression.java)|Easy|36.64%|| -|447|[number-of-boomerangs](https://leetcode.com/problems/number-of-boomerangs/)| [java](./solutions/447.number-of-boomerangs/number-of-boomerangs.java)|Easy|48.89%|| +|447|[number-of-boomerangs](https://leetcode.com/problems/number-of-boomerangs/)| [java](./solutions/447.number-of-boomerangs/number-of-boomerangs.java)|Easy|48.90%|| |448|[find-all-numbers-disappeared-in-an-array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/)| [java](./solutions/448.find-all-numbers-disappeared-in-an-array/find-all-numbers-disappeared-in-an-array.java)|Easy|52.54%|| -|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst/)| [java](./solutions/450.delete-node-in-a-bst/delete-node-in-a-bst.java)|Medium|39.06%|| -|453|[minimum-moves-to-equal-array-elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements/)| [java](./solutions/453.minimum-moves-to-equal-array-elements/minimum-moves-to-equal-array-elements.java)|Easy|48.96%|| -|454|[4sum-ii](https://leetcode.com/problems/4sum-ii/)| [java](./solutions/454.4sum-ii/4sum-ii.java)|Medium|49.63%|| -|459|[repeated-substring-pattern](https://leetcode.com/problems/repeated-substring-pattern/)| [java](./solutions/459.repeated-substring-pattern/repeated-substring-pattern.java)|Easy|39.26%|| -|461|[hamming-distance](https://leetcode.com/problems/hamming-distance/)| [java](./solutions/461.hamming-distance/hamming-distance.java)|Easy|69.94%|| -|463|[island-perimeter](https://leetcode.com/problems/island-perimeter/)| [java](./solutions/463.island-perimeter/island-perimeter.java)|Easy|60.07%|| -|464|[can-i-win](https://leetcode.com/problems/can-i-win/)| [java](./solutions/464.can-i-win/can-i-win.java)|Medium|26.70%|| +|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst/)| [java](./solutions/450.delete-node-in-a-bst/delete-node-in-a-bst.java)|Medium|39.08%|| +|453|[minimum-moves-to-equal-array-elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements/)| [java](./solutions/453.minimum-moves-to-equal-array-elements/minimum-moves-to-equal-array-elements.java)|Easy|48.97%|| +|454|[4sum-ii](https://leetcode.com/problems/4sum-ii/)| [java](./solutions/454.4sum-ii/4sum-ii.java)|Medium|49.64%|| +|459|[repeated-substring-pattern](https://leetcode.com/problems/repeated-substring-pattern/)| [java](./solutions/459.repeated-substring-pattern/repeated-substring-pattern.java)|Easy|39.27%|| +|461|[hamming-distance](https://leetcode.com/problems/hamming-distance/)| [java](./solutions/461.hamming-distance/hamming-distance.java)|Easy|69.95%|| +|463|[island-perimeter](https://leetcode.com/problems/island-perimeter/)| [java](./solutions/463.island-perimeter/island-perimeter.java)|Easy|60.08%|| +|464|[can-i-win](https://leetcode.com/problems/can-i-win/)| [java](./solutions/464.can-i-win/can-i-win.java)|Medium|26.71%|| |467|[unique-substrings-in-wraparound-string](https://leetcode.com/problems/unique-substrings-in-wraparound-string/)| [java](./solutions/467.unique-substrings-in-wraparound-string/unique-substrings-in-wraparound-string.java)|Medium|33.41%|| -|474|[ones-and-zeroes](https://leetcode.com/problems/ones-and-zeroes/)| [java](./solutions/474.ones-and-zeroes/ones-and-zeroes.java)|Medium|39.11%|| -|475|[heaters](https://leetcode.com/problems/heaters/)| [java](./solutions/475.heaters/heaters.java)|Easy|30.91%|| -|476|[number-complement](https://leetcode.com/problems/number-complement/)||Easy|61.98%|| -|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones/)||Easy|54.38%|| -|486|[predict-the-winner](https://leetcode.com/problems/predict-the-winner/)||Medium|46.56%|| -|494|[target-sum](https://leetcode.com/problems/target-sum/)||Medium|44.77%|| -|500|[keyboard-row](https://leetcode.com/problems/keyboard-row/)||Easy|61.51%|| -|501|[find-mode-in-binary-search-tree](https://leetcode.com/problems/find-mode-in-binary-search-tree/)||Easy|38.78%|| -|507|[perfect-number](https://leetcode.com/problems/perfect-number/)||Easy|33.30%|| -|508|[most-frequent-subtree-sum](https://leetcode.com/problems/most-frequent-subtree-sum/)||Medium|53.65%|| -|513|[find-bottom-left-tree-value](https://leetcode.com/problems/find-bottom-left-tree-value/)||Medium|57.80%|| -|515|[find-largest-value-in-each-tree-row](https://leetcode.com/problems/find-largest-value-in-each-tree-row/)||Medium|57.10%|| -|516|[longest-palindromic-subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/)||Medium|45.08%|| -|520|[detect-capital](https://leetcode.com/problems/detect-capital/)||Easy|52.18%|| -|521|[longest-uncommon-subsequence-i](https://leetcode.com/problems/longest-uncommon-subsequence-i/)||Easy|56.03%|| -|523|[continuous-subarray-sum](https://leetcode.com/problems/continuous-subarray-sum/)||Medium|24.06%|| -|532|[k-diff-pairs-in-an-array](https://leetcode.com/problems/k-diff-pairs-in-an-array/)||Easy|29.15%|| -|538|[convert-bst-to-greater-tree](https://leetcode.com/problems/convert-bst-to-greater-tree/)||Easy|49.78%|| -|541|[reverse-string-ii](https://leetcode.com/problems/reverse-string-ii/)||Easy|44.94%|| -|543|[diameter-of-binary-tree](https://leetcode.com/problems/diameter-of-binary-tree/)||Easy|46.10%|| -|551|[student-attendance-record-i](https://leetcode.com/problems/student-attendance-record-i/)||Easy|45.15%|| -|557|[reverse-words-in-a-string-iii](https://leetcode.com/problems/reverse-words-in-a-string-iii/)||Easy|62.91%|| -|560|[subarray-sum-equals-k](https://leetcode.com/problems/subarray-sum-equals-k/)||Medium|41.43%|| -|561|[array-partition-i](https://leetcode.com/problems/array-partition-i/)||Easy|68.15%|| -|563|[binary-tree-tilt](https://leetcode.com/problems/binary-tree-tilt/)||Easy|46.83%|| -|565|[array-nesting](https://leetcode.com/problems/array-nesting/)||Medium|51.32%|| -|566|[reshape-the-matrix](https://leetcode.com/problems/reshape-the-matrix/)||Easy|58.35%|| -|572|[subtree-of-another-tree](https://leetcode.com/problems/subtree-of-another-tree/)||Easy|41.13%|| -|575|[distribute-candies](https://leetcode.com/problems/distribute-candies/)||Easy|59.01%|| -|576|[out-of-boundary-paths](https://leetcode.com/problems/out-of-boundary-paths/)||Medium|31.14%|| -|581|[shortest-unsorted-continuous-subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/)||Easy|29.58%|| -|594|[longest-harmonious-subsequence](https://leetcode.com/problems/longest-harmonious-subsequence/)||Easy|42.82%|| -|598|[range-addition-ii](https://leetcode.com/problems/range-addition-ii/)||Easy|48.35%|| -|599|[minimum-index-sum-of-two-lists](https://leetcode.com/problems/minimum-index-sum-of-two-lists/)||Easy|47.05%|| -|605|[can-place-flowers](https://leetcode.com/problems/can-place-flowers/)||Easy|30.62%|| -|606|[construct-string-from-binary-tree](https://leetcode.com/problems/construct-string-from-binary-tree/)||Easy|50.94%|| -|611|[valid-triangle-number](https://leetcode.com/problems/valid-triangle-number/)||Medium|44.00%|| -|617|[merge-two-binary-trees](https://leetcode.com/problems/merge-two-binary-trees/)||Easy|68.93%|| -|621|[task-scheduler](https://leetcode.com/problems/task-scheduler/)||Medium|44.08%|| -|628|[maximum-product-of-three-numbers](https://leetcode.com/problems/maximum-product-of-three-numbers/)||Easy|45.44%|| -|633|[sum-of-square-numbers](https://leetcode.com/problems/sum-of-square-numbers/)||Easy|32.79%|| -|637|[average-of-levels-in-binary-tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/)||Easy|57.76%|| -|638|[shopping-offers](https://leetcode.com/problems/shopping-offers/)||Medium|47.73%|| -|643|[maximum-average-subarray-i](https://leetcode.com/problems/maximum-average-subarray-i/)||Easy|38.82%|| -|645|[set-mismatch](https://leetcode.com/problems/set-mismatch/)||Easy|40.31%|| -|646|[maximum-length-of-pair-chain](https://leetcode.com/problems/maximum-length-of-pair-chain/)||Medium|47.77%|| -|647|[palindromic-substrings](https://leetcode.com/problems/palindromic-substrings/)||Medium|55.49%|| -|650|[2-keys-keyboard](https://leetcode.com/problems/2-keys-keyboard/)||Medium|46.04%|| -|653|[two-sum-iv-input-is-a-bst](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)||Easy|51.60%|| -|657|[robot-return-to-origin](https://leetcode.com/problems/robot-return-to-origin/)| [java](./solutions/657.robot-return-to-origin/robot-return-to-origin.java)|Easy|70.57%|| +|474|[ones-and-zeroes](https://leetcode.com/problems/ones-and-zeroes/)| [java](./solutions/474.ones-and-zeroes/ones-and-zeroes.java)|Medium|39.12%|| +|475|[heaters](https://leetcode.com/problems/heaters/)| [java](./solutions/475.heaters/heaters.java)|Easy|30.92%|| +|476|[number-complement](https://leetcode.com/problems/number-complement/)| [java](./solutions/476.number-complement/number-complement.java)|Easy|61.99%|| +|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones/)| [java](./solutions/485.max-consecutive-ones/max-consecutive-ones.java)|Easy|54.38%|| +|486|[predict-the-winner](https://leetcode.com/problems/predict-the-winner/)| [java](./solutions/486.predict-the-winner/predict-the-winner.java)|Medium|46.56%|| +|494|[target-sum](https://leetcode.com/problems/target-sum/)| [java](./solutions/494.target-sum/target-sum.java)|Medium|44.77%|| +|500|[keyboard-row](https://leetcode.com/problems/keyboard-row/)| [java](./solutions/500.keyboard-row/keyboard-row.java)|Easy|61.52%|| +|501|[find-mode-in-binary-search-tree](https://leetcode.com/problems/find-mode-in-binary-search-tree/)| [java](./solutions/501.find-mode-in-binary-search-tree/find-mode-in-binary-search-tree.java)|Easy|38.78%|| +|507|[perfect-number](https://leetcode.com/problems/perfect-number/)| [java](./solutions/507.perfect-number/perfect-number.java)|Easy|33.31%|| +|508|[most-frequent-subtree-sum](https://leetcode.com/problems/most-frequent-subtree-sum/)| [java](./solutions/508.most-frequent-subtree-sum/most-frequent-subtree-sum.java)|Medium|53.66%|| +|513|[find-bottom-left-tree-value](https://leetcode.com/problems/find-bottom-left-tree-value/)| [java](./solutions/513.find-bottom-left-tree-value/find-bottom-left-tree-value.java)|Medium|57.81%|| +|515|[find-largest-value-in-each-tree-row](https://leetcode.com/problems/find-largest-value-in-each-tree-row/)| [java](./solutions/515.find-largest-value-in-each-tree-row/find-largest-value-in-each-tree-row.java)|Medium|57.10%|| +|516|[longest-palindromic-subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/)| [java](./solutions/516.longest-palindromic-subsequence/longest-palindromic-subsequence.java)|Medium|45.10%|| +|520|[detect-capital](https://leetcode.com/problems/detect-capital/)| [java](./solutions/520.detect-capital/detect-capital.java)|Easy|52.18%|| +|521|[longest-uncommon-subsequence-i](https://leetcode.com/problems/longest-uncommon-subsequence-i/)| [java](./solutions/521.longest-uncommon-subsequence-i/longest-uncommon-subsequence-i.java)|Easy|56.03%|| +|523|[continuous-subarray-sum](https://leetcode.com/problems/continuous-subarray-sum/)| [java](./solutions/523.continuous-subarray-sum/continuous-subarray-sum.java)|Medium|24.06%|| +|532|[k-diff-pairs-in-an-array](https://leetcode.com/problems/k-diff-pairs-in-an-array/)| [java](./solutions/532.k-diff-pairs-in-an-array/k-diff-pairs-in-an-array.java)|Easy|29.16%|| +|538|[convert-bst-to-greater-tree](https://leetcode.com/problems/convert-bst-to-greater-tree/)| [java](./solutions/538.convert-bst-to-greater-tree/convert-bst-to-greater-tree.java)|Easy|49.79%|| +|541|[reverse-string-ii](https://leetcode.com/problems/reverse-string-ii/)| [java](./solutions/541.reverse-string-ii/reverse-string-ii.java)|Easy|44.94%|| +|543|[diameter-of-binary-tree](https://leetcode.com/problems/diameter-of-binary-tree/)| [java](./solutions/543.diameter-of-binary-tree/diameter-of-binary-tree.java)|Easy|46.10%|| +|551|[student-attendance-record-i](https://leetcode.com/problems/student-attendance-record-i/)| [java](./solutions/551.student-attendance-record-i/student-attendance-record-i.java)|Easy|45.15%|| +|557|[reverse-words-in-a-string-iii](https://leetcode.com/problems/reverse-words-in-a-string-iii/)| [java](./solutions/557.reverse-words-in-a-string-iii/reverse-words-in-a-string-iii.java)|Easy|62.92%|| +|560|[subarray-sum-equals-k](https://leetcode.com/problems/subarray-sum-equals-k/)| [java](./solutions/560.subarray-sum-equals-k/subarray-sum-equals-k.java)|Medium|41.45%|| +|561|[array-partition-i](https://leetcode.com/problems/array-partition-i/)| [java](./solutions/561.array-partition-i/array-partition-i.java)|Easy|68.16%|| +|563|[binary-tree-tilt](https://leetcode.com/problems/binary-tree-tilt/)| [java](./solutions/563.binary-tree-tilt/binary-tree-tilt.java)|Easy|46.83%|| +|565|[array-nesting](https://leetcode.com/problems/array-nesting/)| [java](./solutions/565.array-nesting/array-nesting.java)|Medium|51.34%|| +|566|[reshape-the-matrix](https://leetcode.com/problems/reshape-the-matrix/)| [java](./solutions/566.reshape-the-matrix/reshape-the-matrix.java)|Easy|58.36%|| +|572|[subtree-of-another-tree](https://leetcode.com/problems/subtree-of-another-tree/)| [java](./solutions/572.subtree-of-another-tree/subtree-of-another-tree.java)|Easy|41.14%|| +|575|[distribute-candies](https://leetcode.com/problems/distribute-candies/)| [java](./solutions/575.distribute-candies/distribute-candies.java)|Easy|59.01%|| +|576|[out-of-boundary-paths](https://leetcode.com/problems/out-of-boundary-paths/)| [java](./solutions/576.out-of-boundary-paths/out-of-boundary-paths.java)|Medium|31.16%|| +|581|[shortest-unsorted-continuous-subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/)| [java](./solutions/581.shortest-unsorted-continuous-subarray/shortest-unsorted-continuous-subarray.java)|Easy|29.58%|| +|594|[longest-harmonious-subsequence](https://leetcode.com/problems/longest-harmonious-subsequence/)| [java](./solutions/594.longest-harmonious-subsequence/longest-harmonious-subsequence.java)|Easy|42.83%|| +|598|[range-addition-ii](https://leetcode.com/problems/range-addition-ii/)| [java](./solutions/598.range-addition-ii/range-addition-ii.java)|Easy|48.35%|| +|599|[minimum-index-sum-of-two-lists](https://leetcode.com/problems/minimum-index-sum-of-two-lists/)| [java](./solutions/599.minimum-index-sum-of-two-lists/minimum-index-sum-of-two-lists.java)|Easy|47.06%|| +|605|[can-place-flowers](https://leetcode.com/problems/can-place-flowers/)| [java](./solutions/605.can-place-flowers/can-place-flowers.java)|Easy|30.62%|| +|606|[construct-string-from-binary-tree](https://leetcode.com/problems/construct-string-from-binary-tree/)| [java](./solutions/606.construct-string-from-binary-tree/construct-string-from-binary-tree.java)|Easy|50.94%|| +|611|[valid-triangle-number](https://leetcode.com/problems/valid-triangle-number/)| [java](./solutions/611.valid-triangle-number/valid-triangle-number.java)|Medium|44.02%|| +|617|[merge-two-binary-trees](https://leetcode.com/problems/merge-two-binary-trees/)| [java](./solutions/617.merge-two-binary-trees/merge-two-binary-trees.java)|Easy|68.95%|| +|621|[task-scheduler](https://leetcode.com/problems/task-scheduler/)| [java](./solutions/621.task-scheduler/task-scheduler.java)|Medium|44.08%|| +|628|[maximum-product-of-three-numbers](https://leetcode.com/problems/maximum-product-of-three-numbers/)| [java](./solutions/628.maximum-product-of-three-numbers/maximum-product-of-three-numbers.java)|Easy|45.44%|| +|633|[sum-of-square-numbers](https://leetcode.com/problems/sum-of-square-numbers/)| [java](./solutions/633.sum-of-square-numbers/sum-of-square-numbers.java)|Easy|32.78%|| +|637|[average-of-levels-in-binary-tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/)| [java](./solutions/637.average-of-levels-in-binary-tree/average-of-levels-in-binary-tree.java)|Easy|57.76%|| +|638|[shopping-offers](https://leetcode.com/problems/shopping-offers/)| [java](./solutions/638.shopping-offers/shopping-offers.java)|Medium|47.71%|| +|643|[maximum-average-subarray-i](https://leetcode.com/problems/maximum-average-subarray-i/)| [java](./solutions/643.maximum-average-subarray-i/maximum-average-subarray-i.java)|Easy|38.83%|| +|645|[set-mismatch](https://leetcode.com/problems/set-mismatch/)| [java](./solutions/645.set-mismatch/set-mismatch.java)|Easy|40.32%|| +|646|[maximum-length-of-pair-chain](https://leetcode.com/problems/maximum-length-of-pair-chain/)| [java](./solutions/646.maximum-length-of-pair-chain/maximum-length-of-pair-chain.java)|Medium|47.78%|| +|647|[palindromic-substrings](https://leetcode.com/problems/palindromic-substrings/)| [java](./solutions/647.palindromic-substrings/palindromic-substrings.java)|Medium|55.49%|| +|650|[2-keys-keyboard](https://leetcode.com/problems/2-keys-keyboard/)| [java](./solutions/650.2-keys-keyboard/2-keys-keyboard.java)|Medium|46.06%|| +|653|[two-sum-iv-input-is-a-bst](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)| [java](./solutions/653.two-sum-iv-input-is-a-bst/two-sum-iv-input-is-a-bst.java)|Easy|51.60%|| +|657|[robot-return-to-origin](https://leetcode.com/problems/robot-return-to-origin/)| [java](./solutions/657.robot-return-to-origin/robot-return-to-origin.java)|Easy|70.58%|| |661|[image-smoother](https://leetcode.com/problems/image-smoother/)| [java](./solutions/661.image-smoother/image-smoother.java)|Easy|47.69%|| -|665|[non-decreasing-array](https://leetcode.com/problems/non-decreasing-array/)||Easy|19.58%|| -|669|[trim-a-binary-search-tree](https://leetcode.com/problems/trim-a-binary-search-tree/)||Easy|59.56%|| -|671|[second-minimum-node-in-a-binary-tree](https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/)||Easy|43.23%|| -|673|[number-of-longest-increasing-subsequence](https://leetcode.com/problems/number-of-longest-increasing-subsequence/)||Medium|33.01%|| -|674|[longest-continuous-increasing-subsequence](https://leetcode.com/problems/longest-continuous-increasing-subsequence/)| [java](./solutions/674.longest-continuous-increasing-subsequence/longest-continuous-increasing-subsequence.java)|Easy|43.66%|| -|680|[valid-palindrome-ii](https://leetcode.com/problems/valid-palindrome-ii/)| [java](./solutions/680.valid-palindrome-ii/valid-palindrome-ii.java)|Easy|33.61%|| -|686|[repeated-string-match](https://leetcode.com/problems/repeated-string-match/)| [java](./solutions/686.repeated-string-match/repeated-string-match.java)|Easy|31.30%|| -|687|[longest-univalue-path](https://leetcode.com/problems/longest-univalue-path/)| [java](./solutions/687.longest-univalue-path/longest-univalue-path.java)|Easy|33.21%|| -|690|[employee-importance](https://leetcode.com/problems/employee-importance/)| [java](./solutions/690.employee-importance/employee-importance.java)|Easy|53.00%|| -|693|[binary-number-with-alternating-bits](https://leetcode.com/problems/binary-number-with-alternating-bits/)| [java](./solutions/693.binary-number-with-alternating-bits/binary-number-with-alternating-bits.java)|Easy|57.43%|| -|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|55.57%|| +|665|[non-decreasing-array](https://leetcode.com/problems/non-decreasing-array/)| [java](./solutions/665.non-decreasing-array/non-decreasing-array.java)|Easy|19.58%|| +|669|[trim-a-binary-search-tree](https://leetcode.com/problems/trim-a-binary-search-tree/)| [java](./solutions/669.trim-a-binary-search-tree/trim-a-binary-search-tree.java)|Easy|59.57%|| +|671|[second-minimum-node-in-a-binary-tree](https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/)| [java](./solutions/671.second-minimum-node-in-a-binary-tree/second-minimum-node-in-a-binary-tree.java)|Easy|43.24%|| +|673|[number-of-longest-increasing-subsequence](https://leetcode.com/problems/number-of-longest-increasing-subsequence/)| [java](./solutions/673.number-of-longest-increasing-subsequence/number-of-longest-increasing-subsequence.java)|Medium|33.01%|| +|674|[longest-continuous-increasing-subsequence](https://leetcode.com/problems/longest-continuous-increasing-subsequence/)| [java](./solutions/674.longest-continuous-increasing-subsequence/longest-continuous-increasing-subsequence.java)|Easy|43.67%|| +|680|[valid-palindrome-ii](https://leetcode.com/problems/valid-palindrome-ii/)| [java](./solutions/680.valid-palindrome-ii/valid-palindrome-ii.java)|Easy|33.62%|| +|686|[repeated-string-match](https://leetcode.com/problems/repeated-string-match/)| [java](./solutions/686.repeated-string-match/repeated-string-match.java)|Easy|31.31%|| +|687|[longest-univalue-path](https://leetcode.com/problems/longest-univalue-path/)| [java](./solutions/687.longest-univalue-path/longest-univalue-path.java)|Easy|33.22%|| +|690|[employee-importance](https://leetcode.com/problems/employee-importance/)| [java](./solutions/690.employee-importance/employee-importance.java)|Easy|53.02%|| +|693|[binary-number-with-alternating-bits](https://leetcode.com/problems/binary-number-with-alternating-bits/)| [java](./solutions/693.binary-number-with-alternating-bits/binary-number-with-alternating-bits.java)|Easy|57.44%|| +|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|55.58%|| |696|[count-binary-substrings](https://leetcode.com/problems/count-binary-substrings/)| [java](./solutions/696.count-binary-substrings/count-binary-substrings.java)|Easy|52.24%|| -|697|[degree-of-an-array](https://leetcode.com/problems/degree-of-an-array/)| [java](./solutions/697.degree-of-an-array/degree-of-an-array.java)|Easy|48.86%|| +|697|[degree-of-an-array](https://leetcode.com/problems/degree-of-an-array/)| [java](./solutions/697.degree-of-an-array/degree-of-an-array.java)|Easy|48.83%|| |698|[partition-to-k-equal-sum-subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets/)| [java](./solutions/698.partition-to-k-equal-sum-subsets/partition-to-k-equal-sum-subsets.java)|Medium|40.77%|| -|712|[minimum-ascii-delete-sum-for-two-strings](https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/)| [java](./solutions/712.minimum-ascii-delete-sum-for-two-strings/minimum-ascii-delete-sum-for-two-strings.java)|Medium|53.23%|| -|714|[best-time-to-buy-and-sell-stock-with-transaction-fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/)| [java](./solutions/714.best-time-to-buy-and-sell-stock-with-transaction-fee/best-time-to-buy-and-sell-stock-with-transaction-fee.java)|Medium|49.31%|| +|712|[minimum-ascii-delete-sum-for-two-strings](https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/)| [java](./solutions/712.minimum-ascii-delete-sum-for-two-strings/minimum-ascii-delete-sum-for-two-strings.java)|Medium|53.22%|| +|714|[best-time-to-buy-and-sell-stock-with-transaction-fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/)| [java](./solutions/714.best-time-to-buy-and-sell-stock-with-transaction-fee/best-time-to-buy-and-sell-stock-with-transaction-fee.java)|Medium|49.32%|| |717|[1-bit-and-2-bit-characters](https://leetcode.com/problems/1-bit-and-2-bit-characters/)| [java](./solutions/717.1-bit-and-2-bit-characters/1-bit-and-2-bit-characters.java)|Easy|48.81%|| -|718|[maximum-length-of-repeated-subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| [java](./solutions/718.maximum-length-of-repeated-subarray/maximum-length-of-repeated-subarray.java)|Medium|44.51%|| -|720|[longest-word-in-dictionary](https://leetcode.com/problems/longest-word-in-dictionary/)| [java](./solutions/720.longest-word-in-dictionary/longest-word-in-dictionary.java)|Easy|43.58%|| -|724|[find-pivot-index](https://leetcode.com/problems/find-pivot-index/)| [java](./solutions/724.find-pivot-index/find-pivot-index.java)|Easy|40.35%|| -|728|[self-dividing-numbers](https://leetcode.com/problems/self-dividing-numbers/)| [java](./solutions/728.self-dividing-numbers/self-dividing-numbers.java)|Easy|68.74%|| -|740|[delete-and-earn](https://leetcode.com/problems/delete-and-earn/)| [java](./solutions/740.delete-and-earn/delete-and-earn.java)|Medium|44.87%|| -|742|[to-lower-case](https://leetcode.com/problems/to-lower-case/)| [java](./solutions/742.to-lower-case/to-lower-case.java)|Easy|75.94%|| -|745|[find-smallest-letter-greater-than-target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/)| [java](./solutions/745.find-smallest-letter-greater-than-target/find-smallest-letter-greater-than-target.java)|Easy|43.46%|| -|747|[min-cost-climbing-stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [java](./solutions/747.min-cost-climbing-stairs/min-cost-climbing-stairs.java)|Easy|45.67%|| -|748|[largest-number-at-least-twice-of-others](https://leetcode.com/problems/largest-number-at-least-twice-of-others/)| [java](./solutions/748.largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.java)|Easy|40.20%|| +|718|[maximum-length-of-repeated-subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| [java](./solutions/718.maximum-length-of-repeated-subarray/maximum-length-of-repeated-subarray.java)|Medium|44.52%|| +|720|[longest-word-in-dictionary](https://leetcode.com/problems/longest-word-in-dictionary/)| [java](./solutions/720.longest-word-in-dictionary/longest-word-in-dictionary.java)|Easy|43.57%|| +|724|[find-pivot-index](https://leetcode.com/problems/find-pivot-index/)| [java](./solutions/724.find-pivot-index/find-pivot-index.java)|Easy|40.37%|| +|728|[self-dividing-numbers](https://leetcode.com/problems/self-dividing-numbers/)| [java](./solutions/728.self-dividing-numbers/self-dividing-numbers.java)|Easy|68.75%|| +|740|[delete-and-earn](https://leetcode.com/problems/delete-and-earn/)| [java](./solutions/740.delete-and-earn/delete-and-earn.java)|Medium|44.91%|| +|742|[to-lower-case](https://leetcode.com/problems/to-lower-case/)| [java](./solutions/742.to-lower-case/to-lower-case.java)|Easy|75.97%|| +|745|[find-smallest-letter-greater-than-target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/)| [java](./solutions/745.find-smallest-letter-greater-than-target/find-smallest-letter-greater-than-target.java)|Easy|43.47%|| +|747|[min-cost-climbing-stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [java](./solutions/747.min-cost-climbing-stairs/min-cost-climbing-stairs.java)|Easy|45.69%|| +|748|[largest-number-at-least-twice-of-others](https://leetcode.com/problems/largest-number-at-least-twice-of-others/)| [java](./solutions/748.largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.java)|Easy|40.21%|| |764|[n-ary-tree-level-order-traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal/)| [java](./solutions/764.n-ary-tree-level-order-traversal/n-ary-tree-level-order-traversal.java)|Easy|58.00%|| |767|[prime-number-of-set-bits-in-binary-representation](https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/)| [java](./solutions/767.prime-number-of-set-bits-in-binary-representation/prime-number-of-set-bits-in-binary-representation.java)|Easy|57.53%|| |769|[largest-plus-sign](https://leetcode.com/problems/largest-plus-sign/)| [java](./solutions/769.largest-plus-sign/largest-plus-sign.java)|Medium|42.38%|| -|774|[maximum-depth-of-n-ary-tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree/)| [java](./solutions/774.maximum-depth-of-n-ary-tree/maximum-depth-of-n-ary-tree.java)|Easy|64.09%|| -|775|[n-ary-tree-preorder-traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)| [java](./solutions/775.n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.java)|Easy|65.60%|| -|776|[n-ary-tree-postorder-traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal/)| [java](./solutions/776.n-ary-tree-postorder-traversal/n-ary-tree-postorder-traversal.java)|Easy|65.66%|| -|777|[toeplitz-matrix](https://leetcode.com/problems/toeplitz-matrix/)| [java](./solutions/777.toeplitz-matrix/toeplitz-matrix.java)|Easy|60.96%|| -|782|[jewels-and-stones](https://leetcode.com/problems/jewels-and-stones/)| [java](./solutions/782.jewels-and-stones/jewels-and-stones.java)|Easy|82.60%|| -|783|[search-in-a-binary-search-tree](https://leetcode.com/problems/search-in-a-binary-search-tree/)| [java](./solutions/783.search-in-a-binary-search-tree/search-in-a-binary-search-tree.java)|Easy|66.25%|| -|792|[binary-search](https://leetcode.com/problems/binary-search/)| [java](./solutions/792.binary-search/binary-search.java)|Easy|44.73%|| -|800|[letter-case-permutation](https://leetcode.com/problems/letter-case-permutation/)| [java](./solutions/800.letter-case-permutation/letter-case-permutation.java)|Easy|54.98%|| -|803|[cheapest-flights-within-k-stops](https://leetcode.com/problems/cheapest-flights-within-k-stops/)| [java](./solutions/803.cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.java)|Medium|33.69%|| +|774|[maximum-depth-of-n-ary-tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree/)| [java](./solutions/774.maximum-depth-of-n-ary-tree/maximum-depth-of-n-ary-tree.java)|Easy|64.11%|| +|775|[n-ary-tree-preorder-traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)| [java](./solutions/775.n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.java)|Easy|65.66%|| +|776|[n-ary-tree-postorder-traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal/)| [java](./solutions/776.n-ary-tree-postorder-traversal/n-ary-tree-postorder-traversal.java)|Easy|65.65%|| +|777|[toeplitz-matrix](https://leetcode.com/problems/toeplitz-matrix/)| [java](./solutions/777.toeplitz-matrix/toeplitz-matrix.java)|Easy|60.97%|| +|782|[jewels-and-stones](https://leetcode.com/problems/jewels-and-stones/)| [java](./solutions/782.jewels-and-stones/jewels-and-stones.java)|Easy|82.61%|| +|783|[search-in-a-binary-search-tree](https://leetcode.com/problems/search-in-a-binary-search-tree/)| [java](./solutions/783.search-in-a-binary-search-tree/search-in-a-binary-search-tree.java)|Easy|66.29%|| +|792|[binary-search](https://leetcode.com/problems/binary-search/)| [java](./solutions/792.binary-search/binary-search.java)|Easy|44.75%|| +|800|[letter-case-permutation](https://leetcode.com/problems/letter-case-permutation/)| [java](./solutions/800.letter-case-permutation/letter-case-permutation.java)|Easy|55.01%|| +|803|[cheapest-flights-within-k-stops](https://leetcode.com/problems/cheapest-flights-within-k-stops/)| [java](./solutions/803.cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.java)|Medium|33.71%|| |806|[domino-and-tromino-tiling](https://leetcode.com/problems/domino-and-tromino-tiling/)| [java](./solutions/806.domino-and-tromino-tiling/domino-and-tromino-tiling.java)|Medium|34.80%|| -|822|[unique-morse-code-words](https://leetcode.com/problems/unique-morse-code-words/)| [java](./solutions/822.unique-morse-code-words/unique-morse-code-words.java)|Easy|73.66%|| +|822|[unique-morse-code-words](https://leetcode.com/problems/unique-morse-code-words/)| [java](./solutions/822.unique-morse-code-words/unique-morse-code-words.java)|Easy|73.68%|| |829|[subdomain-visit-count](https://leetcode.com/problems/subdomain-visit-count/)| [java](./solutions/829.subdomain-visit-count/subdomain-visit-count.java)|Easy|63.43%|| -|837|[most-common-word](https://leetcode.com/problems/most-common-word/)| [java](./solutions/837.most-common-word/most-common-word.java)|Easy|41.36%|| -|851|[goat-latin](https://leetcode.com/problems/goat-latin/)| [java](./solutions/851.goat-latin/goat-latin.java)|Easy|56.68%|| +|837|[most-common-word](https://leetcode.com/problems/most-common-word/)| [java](./solutions/837.most-common-word/most-common-word.java)|Easy|41.39%|| +|851|[goat-latin](https://leetcode.com/problems/goat-latin/)| [java](./solutions/851.goat-latin/goat-latin.java)|Easy|56.66%|| |857|[positions-of-large-groups](https://leetcode.com/problems/positions-of-large-groups/)| [java](./solutions/857.positions-of-large-groups/positions-of-large-groups.java)|Easy|47.29%|| -|861|[flipping-an-image](https://leetcode.com/problems/flipping-an-image/)| [java](./solutions/861.flipping-an-image/flipping-an-image.java)|Easy|71.14%|| -|870|[magic-squares-in-grid](https://leetcode.com/problems/magic-squares-in-grid/)| [java](./solutions/870.magic-squares-in-grid/magic-squares-in-grid.java)|Easy|35.14%|| -|879|[maximize-distance-to-closest-person](https://leetcode.com/problems/maximize-distance-to-closest-person/)| [java](./solutions/879.maximize-distance-to-closest-person/maximize-distance-to-closest-person.java)|Easy|40.34%|| -|882|[peak-index-in-a-mountain-array](https://leetcode.com/problems/peak-index-in-a-mountain-array/)| [java](./solutions/882.peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.java)|Easy|68.85%|| -|889|[buddy-strings](https://leetcode.com/problems/buddy-strings/)| [java](./solutions/889.buddy-strings/buddy-strings.java)|Easy|27.40%|| -|898|[transpose-matrix](https://leetcode.com/problems/transpose-matrix/)| [java](./solutions/898.transpose-matrix/transpose-matrix.java)|Easy|63.64%|| -|904|[leaf-similar-trees](https://leetcode.com/problems/leaf-similar-trees/)| [java](./solutions/904.leaf-similar-trees/leaf-similar-trees.java)|Easy|61.97%|| +|861|[flipping-an-image](https://leetcode.com/problems/flipping-an-image/)| [java](./solutions/861.flipping-an-image/flipping-an-image.java)|Easy|71.15%|| +|870|[magic-squares-in-grid](https://leetcode.com/problems/magic-squares-in-grid/)| [java](./solutions/870.magic-squares-in-grid/magic-squares-in-grid.java)|Easy|35.15%|| +|879|[maximize-distance-to-closest-person](https://leetcode.com/problems/maximize-distance-to-closest-person/)| [java](./solutions/879.maximize-distance-to-closest-person/maximize-distance-to-closest-person.java)|Easy|40.35%|| +|882|[peak-index-in-a-mountain-array](https://leetcode.com/problems/peak-index-in-a-mountain-array/)| [java](./solutions/882.peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.java)|Easy|68.86%|| +|889|[buddy-strings](https://leetcode.com/problems/buddy-strings/)| [java](./solutions/889.buddy-strings/buddy-strings.java)|Easy|27.38%|| +|898|[transpose-matrix](https://leetcode.com/problems/transpose-matrix/)| [java](./solutions/898.transpose-matrix/transpose-matrix.java)|Easy|63.65%|| +|904|[leaf-similar-trees](https://leetcode.com/problems/leaf-similar-trees/)| [java](./solutions/904.leaf-similar-trees/leaf-similar-trees.java)|Easy|62.01%|| diff --git a/lib/result.js b/lib/result.js index 6252a6c..8338ead 100644 --- a/lib/result.js +++ b/lib/result.js @@ -3,6 +3,7 @@ const fs = require('fs') const co = require('co') const thenifyAll = require('thenify-all') const thenFs = thenifyAll(fs, {}, ['stat', 'unlink', 'writeFile']) +const logger = require('log4js').getLogger('layout-pattern') let result @@ -14,7 +15,7 @@ let result * @return {Object} last spider result * @api public */ -exports.getResult = co.wrap(function * (resultJsonPath) { +exports.getResult = co.wrap(function* (resultJsonPath) { try { let stats = yield thenFs.stat(resultJsonPath) if (stats.isFile()) { @@ -39,7 +40,8 @@ exports.getResult = co.wrap(function * (resultJsonPath) { * @return {Object} result * @api public */ -exports.writeResult = co.wrap(function * (languageCodeMapArr, leetcodeNumObj, resultJsonPath) { +exports.writeResult = co.wrap(function* (languageCodeMapArr, leetcodeNumObj, resultJsonPath) { + logger.info("Build result.json") languageCodeMapArr.forEach(element => { let ele = {} result[element['_id']] = ele @@ -50,9 +52,10 @@ exports.writeResult = co.wrap(function * (languageCodeMapArr, leetcodeNumObj, re ele.acceptance = element['_acceptance'] ele.language = element['_solveLang'] }) - yield thenFs.unlink(resultJsonPath).catch(function () {}) + yield thenFs.unlink(resultJsonPath).catch(function () { }) result.lastUpdatedTime = getTimeStr('yyyy-MM-dd') Object.assign(result, leetcodeNumObj) + logger.info("Write to result.json : " + JSON.stringify(result)) yield thenFs.writeFile(resultJsonPath, JSON.stringify(result)) return result }) @@ -64,7 +67,7 @@ exports.writeResult = co.wrap(function * (languageCodeMapArr, leetcodeNumObj, re * @return {String} * @api public */ -function getTimeStr (fmt) { +function getTimeStr(fmt) { let time = new Date() let o = { 'M+': time.getMonth() + 1, // 月份 diff --git a/lib/runtimeConf.js b/lib/runtimeConf.js index 75ce8b7..9cd9632 100644 --- a/lib/runtimeConf.js +++ b/lib/runtimeConf.js @@ -1,4 +1,4 @@ 'use strict' module.exports = { - concurrency: 10 + concurrency: 4 } diff --git a/lib/spider.js b/lib/spider.js index 6b1dfbd..8ddd0a9 100644 --- a/lib/spider.js +++ b/lib/spider.js @@ -7,6 +7,7 @@ const logger = require('log4js').getLogger('layout-pattern') const baseUrl = 'https://leetcode.com/' const requestLib = require('request') const jar = requestLib.jar() + // set default http request settings let request = requestLib .defaults({ @@ -66,7 +67,7 @@ exports.fetch = co.wrap(function* (conf, numObj) { let fetchList try { if (undefined === numObj) { - fetchList = yield fetchSolutionsNotEverFetched(acList) + fetchList = yield fetchSolutionsNotEverFetched(acList, conf.language[0]) } else { fetchList = yield fetchWithGivenNumber(acList, numObj) } @@ -178,7 +179,7 @@ let fetchWithGivenNumber = co.wrap(function* (acLists, numObj) { }).reverse() }) -let fetchSolutionsNotEverFetched = co.wrap(function* (acLists) { +let fetchSolutionsNotEverFetched = co.wrap(function* (acLists, lang) { // load the last spider result from result.json // if result.json doesn't exist that means never fetched solutions before let result = yield resultUtils.getResult(resultJsonPath) @@ -189,7 +190,15 @@ let fetchSolutionsNotEverFetched = co.wrap(function* (acLists) { } //! (element.stat['question_id'] in result) // if we fetched once we will not fetch this problem any more - return element.status === 'ac' && !(element.stat['question_id'] in result) + // if due to network error, source file hasn't been fetched(xxx.java or xxx.cpp not existed), then fetch again. + if (element.status === 'ac') { + if (!(element.stat['question_id'] in result)) { + return true + } + return result[element.stat['question_id']]["language"].indexOf(lang) === -1 + } else { + return false + } }).reverse() }) @@ -294,7 +303,7 @@ let fetchACSolutionOfProblem = co.wrap(function* (problemInfo, languageToFetch, __typename } }`, - { offset: 0, limit: 20, lastKey: null, questionSlug: 'search-insert-position' }) + { offset: 0, limit: 20, lastKey: null, questionSlug: problemInfo.stat['question__title_slug'] }) // responseAndBody = yield request.get({ // url: '/api/submissions/' + problemInfo.stat['question__title_slug'] + '/?offset=' + (page * 50) + '&limit=50' // }) @@ -332,7 +341,7 @@ let fetchACSolutionOfProblem = co.wrap(function* (problemInfo, languageToFetch, } }) - if(acSolutionPromise.length>0){ + if (acSolutionPromise.length > 0) { yield acSolutionPromise } @@ -409,7 +418,7 @@ let fetchQuestion = co.wrap(function* (problemInfo, languageCodeMap) { } } `, - {titleSlug: "search-insert-position"} + { titleSlug: problemInfo.stat['question__title_slug'] } ) // responseAndBody = yield request.get('/problems/' + problemInfo.stat['question__title_slug'] + '/') } catch (err) { @@ -444,7 +453,7 @@ let fetchSolutionsOfUrl = co.wrap(function* (url, times) { // so i repeat at most 5 times return yield co(fetchSolutionsOfUrl, url, ++times) } - throw new Error('network error:cannot get the page of url' + url) + throw new Error('network error:cannot get the page of url ' + url) }; let body = responseAndBody[1] @@ -455,8 +464,9 @@ let fetchSolutionsOfUrl = co.wrap(function* (url, times) { // so i repeat at most 5 times return yield fetchSolutionsOfUrl(url, ++times) } - debug('can not get full page of' + url) - throw new Error('network error:the page of' + url + 'is not complete') + + debug('can not get full page of ' + url) + throw new Error('network error:the page of ' + url + ' is not complete') } let codeInUnicode = matchResult[1] diff --git a/lib/util.js b/lib/util.js index bd36b12..65995c9 100644 --- a/lib/util.js +++ b/lib/util.js @@ -11,11 +11,17 @@ const path = require('path') * * @api public */ -function ensureDirectoryExists (dirname) { +function ensureDirectoryExists(dirname) { if (fs.existsSync(dirname)) { return true } ensureDirectoryExists(path.dirname(dirname)) fs.mkdirSync(dirname) } + +function fileExists(filename) { + return fs.existsSync(filename) +} + exports.ensureDirectoryExists = ensureDirectoryExists +exports.fileExists = fileExists \ No newline at end of file From 3d2d95c83ef779a3ef76f18869ce689533a1040b Mon Sep 17 00:00:00 2001 From: zoudikai Date: Thu, 21 Feb 2019 13:49:14 +0800 Subject: [PATCH 3/7] =?UTF-8?q?[doc]=20=E8=BF=98=E5=8E=9FREADME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 408 +++++++++++++++--------------------------------------- 1 file changed, 113 insertions(+), 295 deletions(-) diff --git a/README.md b/README.md index 924f2e6..98a7e37 100644 --- a/README.md +++ b/README.md @@ -1,296 +1,114 @@ -

-

- - - - -

-

My leetcode solutions

- -

- Language: java -
- Last updated: 2019-02-12 -

-

- -

The source code is fetched using the tool leetcode-spider.

- -| # | Problems | Solutions | Difficulty | Acceptance | Paid-Only -|:--:|:-----:|:---------:|:----:|:----:|:----:| -|001|[two-sum](https://leetcode.com/problems/two-sum/)| [java](./solutions/001.two-sum/two-sum.java)|Easy|40.22%|| -|002|[add-two-numbers](https://leetcode.com/problems/add-two-numbers/)| [java](./solutions/002.add-two-numbers/add-two-numbers.java)|Medium|30.43%|| -|003|[longest-substring-without-repeating-characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)| [java](./solutions/003.longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.java)|Medium|26.09%|| -|005|[longest-palindromic-substring](https://leetcode.com/problems/longest-palindromic-substring/)| [java](./solutions/005.longest-palindromic-substring/longest-palindromic-substring.java)|Medium|26.33%|| -|007|[reverse-integer](https://leetcode.com/problems/reverse-integer/)| [java](./solutions/007.reverse-integer/reverse-integer.java)|Easy|25.07%|| -|008|[string-to-integer-atoi](https://leetcode.com/problems/string-to-integer-atoi/)| [java](./solutions/008.string-to-integer-atoi/string-to-integer-atoi.java)|Medium|14.44%|| -|009|[palindrome-number](https://leetcode.com/problems/palindrome-number/)| [java](./solutions/009.palindrome-number/palindrome-number.java)|Easy|41.58%|| -|011|[container-with-most-water](https://leetcode.com/problems/container-with-most-water/)| [java](./solutions/011.container-with-most-water/container-with-most-water.java)|Medium|42.10%|| -|014|[longest-common-prefix](https://leetcode.com/problems/longest-common-prefix/)| [java](./solutions/014.longest-common-prefix/longest-common-prefix.java)|Easy|32.89%|| -|015|[3sum](https://leetcode.com/problems/3sum/)| [java](./solutions/015.3sum/3sum.java)|Medium|23.15%|| -|016|[3sum-closest](https://leetcode.com/problems/3sum-closest/)| [java](./solutions/016.3sum-closest/3sum-closest.java)|Medium|33.88%|| -|018|[4sum](https://leetcode.com/problems/4sum/)| [java](./solutions/018.4sum/4sum.java)|Medium|29.48%|| -|019|[remove-nth-node-from-end-of-list](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)| [java](./solutions/019.remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.java)|Medium|33.92%|| -|020|[valid-parentheses](https://leetcode.com/problems/valid-parentheses/)| [java](./solutions/020.valid-parentheses/valid-parentheses.java)|Easy|35.73%|| -|021|[merge-two-sorted-lists](https://leetcode.com/problems/merge-two-sorted-lists/)| [java](./solutions/021.merge-two-sorted-lists/merge-two-sorted-lists.java)|Easy|45.47%|| -|024|[swap-nodes-in-pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)| [java](./solutions/024.swap-nodes-in-pairs/swap-nodes-in-pairs.java)|Medium|42.79%|| -|026|[remove-duplicates-from-sorted-array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| [java](./solutions/026.remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.java)|Easy|39.37%|| -|027|[remove-element](https://leetcode.com/problems/remove-element/)| [java](./solutions/027.remove-element/remove-element.java)|Easy|43.33%|| -|028|[implement-strstr](https://leetcode.com/problems/implement-strstr/)| [java](./solutions/028.implement-strstr/implement-strstr.java)|Easy|31.07%|| -|031|[next-permutation](https://leetcode.com/problems/next-permutation/)| [java](./solutions/031.next-permutation/next-permutation.java)|Medium|29.95%|| -|033|[search-in-rotated-sorted-array](https://leetcode.com/problems/search-in-rotated-sorted-array/)| [java](./solutions/033.search-in-rotated-sorted-array/search-in-rotated-sorted-array.java)|Medium|32.57%|| -|034|[find-first-and-last-position-of-element-in-sorted-array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)| [java](./solutions/034.find-first-and-last-position-of-element-in-sorted-array/find-first-and-last-position-of-element-in-sorted-array.java)|Medium|32.85%|| -|035|[search-insert-position](https://leetcode.com/problems/search-insert-position/)| [java](./solutions/035.search-insert-position/search-insert-position.java)|Easy|40.37%|| -|036|[valid-sudoku](https://leetcode.com/problems/valid-sudoku/)| [java](./solutions/036.valid-sudoku/valid-sudoku.java)|Medium|41.54%|| -|038|[count-and-say](https://leetcode.com/problems/count-and-say/)| [java](./solutions/038.count-and-say/count-and-say.java)|Easy|39.28%|| -|039|[combination-sum](https://leetcode.com/problems/combination-sum/)| [java](./solutions/039.combination-sum/combination-sum.java)|Medium|46.25%|| -|040|[combination-sum-ii](https://leetcode.com/problems/combination-sum-ii/)| [java](./solutions/040.combination-sum-ii/combination-sum-ii.java)|Medium|39.79%|| -|045|[jump-game-ii](https://leetcode.com/problems/jump-game-ii/)| [java](./solutions/045.jump-game-ii/jump-game-ii.java)|Hard|27.22%|| -|048|[rotate-image](https://leetcode.com/problems/rotate-image/)| [java](./solutions/048.rotate-image/rotate-image.java)|Medium|46.42%|| -|053|[maximum-subarray](https://leetcode.com/problems/maximum-subarray/)| [java](./solutions/053.maximum-subarray/maximum-subarray.java)|Easy|42.57%|| -|054|[spiral-matrix](https://leetcode.com/problems/spiral-matrix/)| [java](./solutions/054.spiral-matrix/spiral-matrix.java)|Medium|29.42%|| -|055|[jump-game](https://leetcode.com/problems/jump-game/)| [java](./solutions/055.jump-game/jump-game.java)|Medium|31.12%|| -|056|[merge-intervals](https://leetcode.com/problems/merge-intervals/)| [java](./solutions/056.merge-intervals/merge-intervals.java)|Medium|34.59%|| -|058|[length-of-last-word](https://leetcode.com/problems/length-of-last-word/)| [java](./solutions/058.length-of-last-word/length-of-last-word.java)|Easy|32.14%|| -|061|[rotate-list](https://leetcode.com/problems/rotate-list/)| [java](./solutions/061.rotate-list/rotate-list.java)|Medium|26.33%|| -|062|[unique-paths](https://leetcode.com/problems/unique-paths/)| [java](./solutions/062.unique-paths/unique-paths.java)|Medium|46.07%|| -|063|[unique-paths-ii](https://leetcode.com/problems/unique-paths-ii/)| [java](./solutions/063.unique-paths-ii/unique-paths-ii.java)|Medium|33.22%|| -|064|[minimum-path-sum](https://leetcode.com/problems/minimum-path-sum/)| [java](./solutions/064.minimum-path-sum/minimum-path-sum.java)|Medium|45.22%|| -|066|[plus-one](https://leetcode.com/problems/plus-one/)| [java](./solutions/066.plus-one/plus-one.java)|Easy|40.56%|| -|067|[add-binary](https://leetcode.com/problems/add-binary/)| [java](./solutions/067.add-binary/add-binary.java)|Easy|37.65%|| -|069|[sqrtx](https://leetcode.com/problems/sqrtx/)| [java](./solutions/069.sqrtx/sqrtx.java)|Easy|30.47%|| -|070|[climbing-stairs](https://leetcode.com/problems/climbing-stairs/)| [java](./solutions/070.climbing-stairs/climbing-stairs.java)|Easy|43.16%|| -|082|[remove-duplicates-from-sorted-list-ii](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/)| [java](./solutions/082.remove-duplicates-from-sorted-list-ii/remove-duplicates-from-sorted-list-ii.java)|Medium|32.02%|| -|083|[remove-duplicates-from-sorted-list](https://leetcode.com/problems/remove-duplicates-from-sorted-list/)| [java](./solutions/083.remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.java)|Easy|41.76%|| -|086|[partition-list](https://leetcode.com/problems/partition-list/)| [java](./solutions/086.partition-list/partition-list.java)|Medium|36.07%|| -|088|[merge-sorted-array](https://leetcode.com/problems/merge-sorted-array/)| [java](./solutions/088.merge-sorted-array/merge-sorted-array.java)|Easy|34.63%|| -|091|[decode-ways](https://leetcode.com/problems/decode-ways/)| [java](./solutions/091.decode-ways/decode-ways.java)|Medium|21.75%|| -|092|[reverse-linked-list-ii](https://leetcode.com/problems/reverse-linked-list-ii/)| [java](./solutions/092.reverse-linked-list-ii/reverse-linked-list-ii.java)|Medium|33.83%|| -|093|[restore-ip-addresses](https://leetcode.com/problems/restore-ip-addresses/)| [java](./solutions/093.restore-ip-addresses/restore-ip-addresses.java)|Medium|30.53%|| -|094|[binary-tree-inorder-traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)| [java](./solutions/094.binary-tree-inorder-traversal/binary-tree-inorder-traversal.java)|Medium|54.64%|| -|095|[unique-binary-search-trees-ii](https://leetcode.com/problems/unique-binary-search-trees-ii/)| [java](./solutions/095.unique-binary-search-trees-ii/unique-binary-search-trees-ii.java)|Medium|34.57%|| -|096|[unique-binary-search-trees](https://leetcode.com/problems/unique-binary-search-trees/)| [java](./solutions/096.unique-binary-search-trees/unique-binary-search-trees.java)|Medium|44.80%|| -|098|[validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree/)| [java](./solutions/098.validate-binary-search-tree/validate-binary-search-tree.java)|Medium|25.14%|| -|100|[same-tree](https://leetcode.com/problems/same-tree/)| [java](./solutions/100.same-tree/same-tree.java)|Easy|49.27%|| -|101|[symmetric-tree](https://leetcode.com/problems/symmetric-tree/)| [java](./solutions/101.symmetric-tree/symmetric-tree.java)|Easy|42.51%|| -|102|[binary-tree-level-order-traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)| [java](./solutions/102.binary-tree-level-order-traversal/binary-tree-level-order-traversal.java)|Medium|46.68%|| -|103|[binary-tree-zigzag-level-order-traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)| [java](./solutions/103.binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.java)|Medium|40.16%|| -|104|[maximum-depth-of-binary-tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)| [java](./solutions/104.maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.java)|Easy|58.85%|| -|105|[construct-binary-tree-from-preorder-and-inorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)| [java](./solutions/105.construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.java)|Medium|39.07%|| -|106|[construct-binary-tree-from-inorder-and-postorder-traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)| [java](./solutions/106.construct-binary-tree-from-inorder-and-postorder-traversal/construct-binary-tree-from-inorder-and-postorder-traversal.java)|Medium|37.63%|| -|107|[binary-tree-level-order-traversal-ii](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)| [java](./solutions/107.binary-tree-level-order-traversal-ii/binary-tree-level-order-traversal-ii.java)|Easy|45.37%|| -|108|[convert-sorted-array-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/)| [java](./solutions/108.convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.java)|Easy|48.90%|| -|109|[convert-sorted-list-to-binary-search-tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| [java](./solutions/109.convert-sorted-list-to-binary-search-tree/convert-sorted-list-to-binary-search-tree.java)|Medium|39.27%|| -|110|[balanced-binary-tree](https://leetcode.com/problems/balanced-binary-tree/)| [java](./solutions/110.balanced-binary-tree/balanced-binary-tree.java)|Easy|40.23%|| -|111|[minimum-depth-of-binary-tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)| [java](./solutions/111.minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.java)|Easy|34.75%|| -|112|[path-sum](https://leetcode.com/problems/path-sum/)| [java](./solutions/112.path-sum/path-sum.java)|Easy|36.85%|| -|113|[path-sum-ii](https://leetcode.com/problems/path-sum-ii/)| [java](./solutions/113.path-sum-ii/path-sum-ii.java)|Medium|39.16%|| -|114|[flatten-binary-tree-to-linked-list](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)| [java](./solutions/114.flatten-binary-tree-to-linked-list/flatten-binary-tree-to-linked-list.java)|Medium|40.78%|| -|116|[populating-next-right-pointers-in-each-node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)| [java](./solutions/116.populating-next-right-pointers-in-each-node/populating-next-right-pointers-in-each-node.java)|Medium|36.51%|| -|117|[populating-next-right-pointers-in-each-node-ii](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/)| [java](./solutions/117.populating-next-right-pointers-in-each-node-ii/populating-next-right-pointers-in-each-node-ii.java)|Medium|33.32%|| -|118|[pascals-triangle](https://leetcode.com/problems/pascals-triangle/)| [java](./solutions/118.pascals-triangle/pascals-triangle.java)|Easy|44.17%|| -|119|[pascals-triangle-ii](https://leetcode.com/problems/pascals-triangle-ii/)| [java](./solutions/119.pascals-triangle-ii/pascals-triangle-ii.java)|Easy|41.68%|| -|120|[triangle](https://leetcode.com/problems/triangle/)| [java](./solutions/120.triangle/triangle.java)|Medium|38.10%|| -|121|[best-time-to-buy-and-sell-stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)| [java](./solutions/121.best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.java)|Easy|45.95%|| -|122|[best-time-to-buy-and-sell-stock-ii](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)| [java](./solutions/122.best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.java)|Easy|50.67%|| -|125|[valid-palindrome](https://leetcode.com/problems/valid-palindrome/)| [java](./solutions/125.valid-palindrome/valid-palindrome.java)|Easy|29.97%|| -|127|[word-ladder](https://leetcode.com/problems/word-ladder/)| [java](./solutions/127.word-ladder/word-ladder.java)|Medium|22.63%|| -|129|[sum-root-to-leaf-numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers/)| [java](./solutions/129.sum-root-to-leaf-numbers/sum-root-to-leaf-numbers.java)|Medium|41.11%|| -|130|[surrounded-regions](https://leetcode.com/problems/surrounded-regions/)| [java](./solutions/130.surrounded-regions/surrounded-regions.java)|Medium|21.95%|| -|133|[clone-graph](https://leetcode.com/problems/clone-graph/)| [java](./solutions/133.clone-graph/clone-graph.java)|Medium|25.12%|| -|136|[single-number](https://leetcode.com/problems/single-number/)| [java](./solutions/136.single-number/single-number.java)|Easy|58.69%|| -|139|[word-break](https://leetcode.com/problems/word-break/)| [java](./solutions/139.word-break/word-break.java)|Medium|34.08%|| -|141|[linked-list-cycle](https://leetcode.com/problems/linked-list-cycle/)| [java](./solutions/141.linked-list-cycle/linked-list-cycle.java)|Easy|35.46%|| -|144|[binary-tree-preorder-traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/)| [java](./solutions/144.binary-tree-preorder-traversal/binary-tree-preorder-traversal.java)|Medium|49.98%|| -|152|[maximum-product-subarray](https://leetcode.com/problems/maximum-product-subarray/)| [java](./solutions/152.maximum-product-subarray/maximum-product-subarray.java)|Medium|28.40%|| -|160|[intersection-of-two-linked-lists](https://leetcode.com/problems/intersection-of-two-linked-lists/)| [java](./solutions/160.intersection-of-two-linked-lists/intersection-of-two-linked-lists.java)|Easy|31.91%|| -|167|[two-sum-ii-input-array-is-sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)| [java](./solutions/167.two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.java)|Easy|49.00%|| -|168|[excel-sheet-column-title](https://leetcode.com/problems/excel-sheet-column-title/)| [java](./solutions/168.excel-sheet-column-title/excel-sheet-column-title.java)|Easy|28.42%|| -|169|[majority-element](https://leetcode.com/problems/majority-element/)| [java](./solutions/169.majority-element/majority-element.java)|Easy|51.23%|| -|171|[excel-sheet-column-number](https://leetcode.com/problems/excel-sheet-column-number/)| [java](./solutions/171.excel-sheet-column-number/excel-sheet-column-number.java)|Easy|50.71%|| -|172|[factorial-trailing-zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/)| [java](./solutions/172.factorial-trailing-zeroes/factorial-trailing-zeroes.java)|Easy|37.21%|| -|173|[binary-search-tree-iterator](https://leetcode.com/problems/binary-search-tree-iterator/)| [java](./solutions/173.binary-search-tree-iterator/binary-search-tree-iterator.java)|Medium|46.71%|| -|189|[rotate-array](https://leetcode.com/problems/rotate-array/)| [java](./solutions/189.rotate-array/rotate-array.java)|Easy|28.65%|| -|190|[reverse-bits](https://leetcode.com/problems/reverse-bits/)| [java](./solutions/190.reverse-bits/reverse-bits.java)|Easy|29.95%|| -|191|[number-of-1-bits](https://leetcode.com/problems/number-of-1-bits/)| [java](./solutions/191.number-of-1-bits/number-of-1-bits.java)|Easy|41.71%|| -|198|[house-robber](https://leetcode.com/problems/house-robber/)| [java](./solutions/198.house-robber/house-robber.java)|Easy|40.73%|| -|199|[binary-tree-right-side-view](https://leetcode.com/problems/binary-tree-right-side-view/)| [java](./solutions/199.binary-tree-right-side-view/binary-tree-right-side-view.java)|Medium|46.30%|| -|202|[happy-number](https://leetcode.com/problems/happy-number/)| [java](./solutions/202.happy-number/happy-number.java)|Easy|44.10%|| -|203|[remove-linked-list-elements](https://leetcode.com/problems/remove-linked-list-elements/)| [java](./solutions/203.remove-linked-list-elements/remove-linked-list-elements.java)|Easy|35.12%|| -|204|[count-primes](https://leetcode.com/problems/count-primes/)| [java](./solutions/204.count-primes/count-primes.java)|Easy|28.05%|| -|205|[isomorphic-strings](https://leetcode.com/problems/isomorphic-strings/)| [java](./solutions/205.isomorphic-strings/isomorphic-strings.java)|Easy|36.55%|| -|206|[reverse-linked-list](https://leetcode.com/problems/reverse-linked-list/)| [java](./solutions/206.reverse-linked-list/reverse-linked-list.java)|Easy|52.25%|| -|213|[house-robber-ii](https://leetcode.com/problems/house-robber-ii/)| [java](./solutions/213.house-robber-ii/house-robber-ii.java)|Medium|35.02%|| -|217|[contains-duplicate](https://leetcode.com/problems/contains-duplicate/)| [java](./solutions/217.contains-duplicate/contains-duplicate.java)|Easy|50.53%|| -|219|[contains-duplicate-ii](https://leetcode.com/problems/contains-duplicate-ii/)| [java](./solutions/219.contains-duplicate-ii/contains-duplicate-ii.java)|Easy|34.54%|| -|221|[maximal-square](https://leetcode.com/problems/maximal-square/)| [java](./solutions/221.maximal-square/maximal-square.java)|Medium|32.08%|| -|222|[count-complete-tree-nodes](https://leetcode.com/problems/count-complete-tree-nodes/)| [java](./solutions/222.count-complete-tree-nodes/count-complete-tree-nodes.java)|Medium|30.94%|| -|226|[invert-binary-tree](https://leetcode.com/problems/invert-binary-tree/)| [java](./solutions/226.invert-binary-tree/invert-binary-tree.java)|Easy|56.74%|| -|230|[kth-smallest-element-in-a-bst](https://leetcode.com/problems/kth-smallest-element-in-a-bst/)| [java](./solutions/230.kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.java)|Medium|49.57%|| -|231|[power-of-two](https://leetcode.com/problems/power-of-two/)| [java](./solutions/231.power-of-two/power-of-two.java)|Easy|41.55%|| -|234|[palindrome-linked-list](https://leetcode.com/problems/palindrome-linked-list/)| [java](./solutions/234.palindrome-linked-list/palindrome-linked-list.java)|Easy|35.16%|| -|235|[lowest-common-ancestor-of-a-binary-search-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/)| [java](./solutions/235.lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.java)|Easy|43.15%|| -|236|[lowest-common-ancestor-of-a-binary-tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/)| [java](./solutions/236.lowest-common-ancestor-of-a-binary-tree/lowest-common-ancestor-of-a-binary-tree.java)|Medium|34.98%|| -|237|[delete-node-in-a-linked-list](https://leetcode.com/problems/delete-node-in-a-linked-list/)| [java](./solutions/237.delete-node-in-a-linked-list/delete-node-in-a-linked-list.java)|Easy|51.62%|| -|242|[valid-anagram](https://leetcode.com/problems/valid-anagram/)| [java](./solutions/242.valid-anagram/valid-anagram.java)|Easy|50.63%|| -|257|[binary-tree-paths](https://leetcode.com/problems/binary-tree-paths/)| [java](./solutions/257.binary-tree-paths/binary-tree-paths.java)|Easy|44.78%|| -|258|[add-digits](https://leetcode.com/problems/add-digits/)| [java](./solutions/258.add-digits/add-digits.java)|Easy|53.38%|| -|263|[ugly-number](https://leetcode.com/problems/ugly-number/)| [java](./solutions/263.ugly-number/ugly-number.java)|Easy|40.31%|| -|264|[ugly-number-ii](https://leetcode.com/problems/ugly-number-ii/)| [java](./solutions/264.ugly-number-ii/ugly-number-ii.java)|Medium|35.38%|| -|268|[missing-number](https://leetcode.com/problems/missing-number/)| [java](./solutions/268.missing-number/missing-number.java)|Easy|47.34%|| -|278|[first-bad-version](https://leetcode.com/problems/first-bad-version/)| [java](./solutions/278.first-bad-version/first-bad-version.java)|Easy|28.68%|| -|279|[perfect-squares](https://leetcode.com/problems/perfect-squares/)| [java](./solutions/279.perfect-squares/perfect-squares.java)|Medium|40.40%|| -|283|[move-zeroes](https://leetcode.com/problems/move-zeroes/)| [java](./solutions/283.move-zeroes/move-zeroes.java)|Easy|53.43%|| -|290|[word-pattern](https://leetcode.com/problems/word-pattern/)| [java](./solutions/290.word-pattern/word-pattern.java)|Easy|34.44%|| -|300|[longest-increasing-subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|40.09%|| -|303|[range-sum-query-immutable](https://leetcode.com/problems/range-sum-query-immutable/)| [java](./solutions/303.range-sum-query-immutable/range-sum-query-immutable.java)|Easy|36.31%|| -|304|[range-sum-query-2d-immutable](https://leetcode.com/problems/range-sum-query-2d-immutable/)| [java](./solutions/304.range-sum-query-2d-immutable/range-sum-query-2d-immutable.java)|Medium|30.90%|| -|309|[best-time-to-buy-and-sell-stock-with-cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/)| [java](./solutions/309.best-time-to-buy-and-sell-stock-with-cooldown/best-time-to-buy-and-sell-stock-with-cooldown.java)|Medium|43.36%|| -|322|[coin-change](https://leetcode.com/problems/coin-change/)| [java](./solutions/322.coin-change/coin-change.java)|Medium|28.76%|| -|326|[power-of-three](https://leetcode.com/problems/power-of-three/)| [java](./solutions/326.power-of-three/power-of-three.java)|Easy|41.33%|| -|338|[counting-bits](https://leetcode.com/problems/counting-bits/)| [java](./solutions/338.counting-bits/counting-bits.java)|Medium|63.81%|| -|342|[power-of-four](https://leetcode.com/problems/power-of-four/)| [java](./solutions/342.power-of-four/power-of-four.java)|Easy|39.92%|| -|343|[integer-break](https://leetcode.com/problems/integer-break/)| [java](./solutions/343.integer-break/integer-break.java)|Medium|47.23%|| -|344|[reverse-string](https://leetcode.com/problems/reverse-string/)| [java](./solutions/344.reverse-string/reverse-string.java)|Easy|62.65%|| -|345|[reverse-vowels-of-a-string](https://leetcode.com/problems/reverse-vowels-of-a-string/)| [java](./solutions/345.reverse-vowels-of-a-string/reverse-vowels-of-a-string.java)|Easy|40.71%|| -|349|[intersection-of-two-arrays](https://leetcode.com/problems/intersection-of-two-arrays/)| [java](./solutions/349.intersection-of-two-arrays/intersection-of-two-arrays.java)|Easy|52.48%|| -|350|[intersection-of-two-arrays-ii](https://leetcode.com/problems/intersection-of-two-arrays-ii/)| [java](./solutions/350.intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.java)|Easy|46.51%|| -|357|[count-numbers-with-unique-digits](https://leetcode.com/problems/count-numbers-with-unique-digits/)| [java](./solutions/357.count-numbers-with-unique-digits/count-numbers-with-unique-digits.java)|Medium|46.54%|| -|367|[valid-perfect-square](https://leetcode.com/problems/valid-perfect-square/)| [java](./solutions/367.valid-perfect-square/valid-perfect-square.java)|Easy|39.29%|| -|368|[largest-divisible-subset](https://leetcode.com/problems/largest-divisible-subset/)| [java](./solutions/368.largest-divisible-subset/largest-divisible-subset.java)|Medium|34.41%|| -|371|[sum-of-two-integers](https://leetcode.com/problems/sum-of-two-integers/)| [java](./solutions/371.sum-of-two-integers/sum-of-two-integers.java)|Easy|51.35%|| -|374|[guess-number-higher-or-lower](https://leetcode.com/problems/guess-number-higher-or-lower/)| [java](./solutions/374.guess-number-higher-or-lower/guess-number-higher-or-lower.java)|Easy|38.55%|| -|375|[guess-number-higher-or-lower-ii](https://leetcode.com/problems/guess-number-higher-or-lower-ii/)| [java](./solutions/375.guess-number-higher-or-lower-ii/guess-number-higher-or-lower-ii.java)|Medium|37.13%|| -|376|[wiggle-subsequence](https://leetcode.com/problems/wiggle-subsequence/)| [java](./solutions/376.wiggle-subsequence/wiggle-subsequence.java)|Medium|36.81%|| -|377|[combination-sum-iv](https://leetcode.com/problems/combination-sum-iv/)| [java](./solutions/377.combination-sum-iv/combination-sum-iv.java)|Medium|43.80%|| -|383|[ransom-note](https://leetcode.com/problems/ransom-note/)| [java](./solutions/383.ransom-note/ransom-note.java)|Easy|49.14%|| -|387|[first-unique-character-in-a-string](https://leetcode.com/problems/first-unique-character-in-a-string/)| [java](./solutions/387.first-unique-character-in-a-string/first-unique-character-in-a-string.java)|Easy|48.86%|| -|389|[find-the-difference](https://leetcode.com/problems/find-the-difference/)| [java](./solutions/389.find-the-difference/find-the-difference.java)|Easy|52.61%|| -|392|[is-subsequence](https://leetcode.com/problems/is-subsequence/)| [java](./solutions/392.is-subsequence/is-subsequence.java)|Medium|46.06%|| -|400|[nth-digit](https://leetcode.com/problems/nth-digit/)| [java](./solutions/400.nth-digit/nth-digit.java)|Easy|30.03%|| -|401|[binary-watch](https://leetcode.com/problems/binary-watch/)| [java](./solutions/401.binary-watch/binary-watch.java)|Easy|45.00%|| -|404|[sum-of-left-leaves](https://leetcode.com/problems/sum-of-left-leaves/)| [java](./solutions/404.sum-of-left-leaves/sum-of-left-leaves.java)|Easy|48.62%|| -|405|[convert-a-number-to-hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal/)| [java](./solutions/405.convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.java)|Easy|41.64%|| -|409|[longest-palindrome](https://leetcode.com/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|47.29%|| -|413|[arithmetic-slices](https://leetcode.com/problems/arithmetic-slices/)| [java](./solutions/413.arithmetic-slices/arithmetic-slices.java)|Medium|55.16%|| -|414|[third-maximum-number](https://leetcode.com/problems/third-maximum-number/)| [java](./solutions/414.third-maximum-number/third-maximum-number.java)|Easy|28.59%|| -|415|[add-strings](https://leetcode.com/problems/add-strings/)| [java](./solutions/415.add-strings/add-strings.java)|Easy|42.91%|| -|416|[partition-equal-subset-sum](https://leetcode.com/problems/partition-equal-subset-sum/)| [java](./solutions/416.partition-equal-subset-sum/partition-equal-subset-sum.java)|Medium|39.65%|| -|434|[number-of-segments-in-a-string](https://leetcode.com/problems/number-of-segments-in-a-string/)| [java](./solutions/434.number-of-segments-in-a-string/number-of-segments-in-a-string.java)|Easy|36.60%|| -|437|[path-sum-iii](https://leetcode.com/problems/path-sum-iii/)| [java](./solutions/437.path-sum-iii/path-sum-iii.java)|Easy|41.73%|| -|438|[find-all-anagrams-in-a-string](https://leetcode.com/problems/find-all-anagrams-in-a-string/)| [java](./solutions/438.find-all-anagrams-in-a-string/find-all-anagrams-in-a-string.java)|Easy|36.04%|| -|441|[arranging-coins](https://leetcode.com/problems/arranging-coins/)| [java](./solutions/441.arranging-coins/arranging-coins.java)|Easy|37.34%|| -|443|[string-compression](https://leetcode.com/problems/string-compression/)| [java](./solutions/443.string-compression/string-compression.java)|Easy|36.64%|| -|447|[number-of-boomerangs](https://leetcode.com/problems/number-of-boomerangs/)| [java](./solutions/447.number-of-boomerangs/number-of-boomerangs.java)|Easy|48.90%|| -|448|[find-all-numbers-disappeared-in-an-array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/)| [java](./solutions/448.find-all-numbers-disappeared-in-an-array/find-all-numbers-disappeared-in-an-array.java)|Easy|52.54%|| -|450|[delete-node-in-a-bst](https://leetcode.com/problems/delete-node-in-a-bst/)| [java](./solutions/450.delete-node-in-a-bst/delete-node-in-a-bst.java)|Medium|39.08%|| -|453|[minimum-moves-to-equal-array-elements](https://leetcode.com/problems/minimum-moves-to-equal-array-elements/)| [java](./solutions/453.minimum-moves-to-equal-array-elements/minimum-moves-to-equal-array-elements.java)|Easy|48.97%|| -|454|[4sum-ii](https://leetcode.com/problems/4sum-ii/)| [java](./solutions/454.4sum-ii/4sum-ii.java)|Medium|49.64%|| -|459|[repeated-substring-pattern](https://leetcode.com/problems/repeated-substring-pattern/)| [java](./solutions/459.repeated-substring-pattern/repeated-substring-pattern.java)|Easy|39.27%|| -|461|[hamming-distance](https://leetcode.com/problems/hamming-distance/)| [java](./solutions/461.hamming-distance/hamming-distance.java)|Easy|69.95%|| -|463|[island-perimeter](https://leetcode.com/problems/island-perimeter/)| [java](./solutions/463.island-perimeter/island-perimeter.java)|Easy|60.08%|| -|464|[can-i-win](https://leetcode.com/problems/can-i-win/)| [java](./solutions/464.can-i-win/can-i-win.java)|Medium|26.71%|| -|467|[unique-substrings-in-wraparound-string](https://leetcode.com/problems/unique-substrings-in-wraparound-string/)| [java](./solutions/467.unique-substrings-in-wraparound-string/unique-substrings-in-wraparound-string.java)|Medium|33.41%|| -|474|[ones-and-zeroes](https://leetcode.com/problems/ones-and-zeroes/)| [java](./solutions/474.ones-and-zeroes/ones-and-zeroes.java)|Medium|39.12%|| -|475|[heaters](https://leetcode.com/problems/heaters/)| [java](./solutions/475.heaters/heaters.java)|Easy|30.92%|| -|476|[number-complement](https://leetcode.com/problems/number-complement/)| [java](./solutions/476.number-complement/number-complement.java)|Easy|61.99%|| -|485|[max-consecutive-ones](https://leetcode.com/problems/max-consecutive-ones/)| [java](./solutions/485.max-consecutive-ones/max-consecutive-ones.java)|Easy|54.38%|| -|486|[predict-the-winner](https://leetcode.com/problems/predict-the-winner/)| [java](./solutions/486.predict-the-winner/predict-the-winner.java)|Medium|46.56%|| -|494|[target-sum](https://leetcode.com/problems/target-sum/)| [java](./solutions/494.target-sum/target-sum.java)|Medium|44.77%|| -|500|[keyboard-row](https://leetcode.com/problems/keyboard-row/)| [java](./solutions/500.keyboard-row/keyboard-row.java)|Easy|61.52%|| -|501|[find-mode-in-binary-search-tree](https://leetcode.com/problems/find-mode-in-binary-search-tree/)| [java](./solutions/501.find-mode-in-binary-search-tree/find-mode-in-binary-search-tree.java)|Easy|38.78%|| -|507|[perfect-number](https://leetcode.com/problems/perfect-number/)| [java](./solutions/507.perfect-number/perfect-number.java)|Easy|33.31%|| -|508|[most-frequent-subtree-sum](https://leetcode.com/problems/most-frequent-subtree-sum/)| [java](./solutions/508.most-frequent-subtree-sum/most-frequent-subtree-sum.java)|Medium|53.66%|| -|513|[find-bottom-left-tree-value](https://leetcode.com/problems/find-bottom-left-tree-value/)| [java](./solutions/513.find-bottom-left-tree-value/find-bottom-left-tree-value.java)|Medium|57.81%|| -|515|[find-largest-value-in-each-tree-row](https://leetcode.com/problems/find-largest-value-in-each-tree-row/)| [java](./solutions/515.find-largest-value-in-each-tree-row/find-largest-value-in-each-tree-row.java)|Medium|57.10%|| -|516|[longest-palindromic-subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/)| [java](./solutions/516.longest-palindromic-subsequence/longest-palindromic-subsequence.java)|Medium|45.10%|| -|520|[detect-capital](https://leetcode.com/problems/detect-capital/)| [java](./solutions/520.detect-capital/detect-capital.java)|Easy|52.18%|| -|521|[longest-uncommon-subsequence-i](https://leetcode.com/problems/longest-uncommon-subsequence-i/)| [java](./solutions/521.longest-uncommon-subsequence-i/longest-uncommon-subsequence-i.java)|Easy|56.03%|| -|523|[continuous-subarray-sum](https://leetcode.com/problems/continuous-subarray-sum/)| [java](./solutions/523.continuous-subarray-sum/continuous-subarray-sum.java)|Medium|24.06%|| -|532|[k-diff-pairs-in-an-array](https://leetcode.com/problems/k-diff-pairs-in-an-array/)| [java](./solutions/532.k-diff-pairs-in-an-array/k-diff-pairs-in-an-array.java)|Easy|29.16%|| -|538|[convert-bst-to-greater-tree](https://leetcode.com/problems/convert-bst-to-greater-tree/)| [java](./solutions/538.convert-bst-to-greater-tree/convert-bst-to-greater-tree.java)|Easy|49.79%|| -|541|[reverse-string-ii](https://leetcode.com/problems/reverse-string-ii/)| [java](./solutions/541.reverse-string-ii/reverse-string-ii.java)|Easy|44.94%|| -|543|[diameter-of-binary-tree](https://leetcode.com/problems/diameter-of-binary-tree/)| [java](./solutions/543.diameter-of-binary-tree/diameter-of-binary-tree.java)|Easy|46.10%|| -|551|[student-attendance-record-i](https://leetcode.com/problems/student-attendance-record-i/)| [java](./solutions/551.student-attendance-record-i/student-attendance-record-i.java)|Easy|45.15%|| -|557|[reverse-words-in-a-string-iii](https://leetcode.com/problems/reverse-words-in-a-string-iii/)| [java](./solutions/557.reverse-words-in-a-string-iii/reverse-words-in-a-string-iii.java)|Easy|62.92%|| -|560|[subarray-sum-equals-k](https://leetcode.com/problems/subarray-sum-equals-k/)| [java](./solutions/560.subarray-sum-equals-k/subarray-sum-equals-k.java)|Medium|41.45%|| -|561|[array-partition-i](https://leetcode.com/problems/array-partition-i/)| [java](./solutions/561.array-partition-i/array-partition-i.java)|Easy|68.16%|| -|563|[binary-tree-tilt](https://leetcode.com/problems/binary-tree-tilt/)| [java](./solutions/563.binary-tree-tilt/binary-tree-tilt.java)|Easy|46.83%|| -|565|[array-nesting](https://leetcode.com/problems/array-nesting/)| [java](./solutions/565.array-nesting/array-nesting.java)|Medium|51.34%|| -|566|[reshape-the-matrix](https://leetcode.com/problems/reshape-the-matrix/)| [java](./solutions/566.reshape-the-matrix/reshape-the-matrix.java)|Easy|58.36%|| -|572|[subtree-of-another-tree](https://leetcode.com/problems/subtree-of-another-tree/)| [java](./solutions/572.subtree-of-another-tree/subtree-of-another-tree.java)|Easy|41.14%|| -|575|[distribute-candies](https://leetcode.com/problems/distribute-candies/)| [java](./solutions/575.distribute-candies/distribute-candies.java)|Easy|59.01%|| -|576|[out-of-boundary-paths](https://leetcode.com/problems/out-of-boundary-paths/)| [java](./solutions/576.out-of-boundary-paths/out-of-boundary-paths.java)|Medium|31.16%|| -|581|[shortest-unsorted-continuous-subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/)| [java](./solutions/581.shortest-unsorted-continuous-subarray/shortest-unsorted-continuous-subarray.java)|Easy|29.58%|| -|594|[longest-harmonious-subsequence](https://leetcode.com/problems/longest-harmonious-subsequence/)| [java](./solutions/594.longest-harmonious-subsequence/longest-harmonious-subsequence.java)|Easy|42.83%|| -|598|[range-addition-ii](https://leetcode.com/problems/range-addition-ii/)| [java](./solutions/598.range-addition-ii/range-addition-ii.java)|Easy|48.35%|| -|599|[minimum-index-sum-of-two-lists](https://leetcode.com/problems/minimum-index-sum-of-two-lists/)| [java](./solutions/599.minimum-index-sum-of-two-lists/minimum-index-sum-of-two-lists.java)|Easy|47.06%|| -|605|[can-place-flowers](https://leetcode.com/problems/can-place-flowers/)| [java](./solutions/605.can-place-flowers/can-place-flowers.java)|Easy|30.62%|| -|606|[construct-string-from-binary-tree](https://leetcode.com/problems/construct-string-from-binary-tree/)| [java](./solutions/606.construct-string-from-binary-tree/construct-string-from-binary-tree.java)|Easy|50.94%|| -|611|[valid-triangle-number](https://leetcode.com/problems/valid-triangle-number/)| [java](./solutions/611.valid-triangle-number/valid-triangle-number.java)|Medium|44.02%|| -|617|[merge-two-binary-trees](https://leetcode.com/problems/merge-two-binary-trees/)| [java](./solutions/617.merge-two-binary-trees/merge-two-binary-trees.java)|Easy|68.95%|| -|621|[task-scheduler](https://leetcode.com/problems/task-scheduler/)| [java](./solutions/621.task-scheduler/task-scheduler.java)|Medium|44.08%|| -|628|[maximum-product-of-three-numbers](https://leetcode.com/problems/maximum-product-of-three-numbers/)| [java](./solutions/628.maximum-product-of-three-numbers/maximum-product-of-three-numbers.java)|Easy|45.44%|| -|633|[sum-of-square-numbers](https://leetcode.com/problems/sum-of-square-numbers/)| [java](./solutions/633.sum-of-square-numbers/sum-of-square-numbers.java)|Easy|32.78%|| -|637|[average-of-levels-in-binary-tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/)| [java](./solutions/637.average-of-levels-in-binary-tree/average-of-levels-in-binary-tree.java)|Easy|57.76%|| -|638|[shopping-offers](https://leetcode.com/problems/shopping-offers/)| [java](./solutions/638.shopping-offers/shopping-offers.java)|Medium|47.71%|| -|643|[maximum-average-subarray-i](https://leetcode.com/problems/maximum-average-subarray-i/)| [java](./solutions/643.maximum-average-subarray-i/maximum-average-subarray-i.java)|Easy|38.83%|| -|645|[set-mismatch](https://leetcode.com/problems/set-mismatch/)| [java](./solutions/645.set-mismatch/set-mismatch.java)|Easy|40.32%|| -|646|[maximum-length-of-pair-chain](https://leetcode.com/problems/maximum-length-of-pair-chain/)| [java](./solutions/646.maximum-length-of-pair-chain/maximum-length-of-pair-chain.java)|Medium|47.78%|| -|647|[palindromic-substrings](https://leetcode.com/problems/palindromic-substrings/)| [java](./solutions/647.palindromic-substrings/palindromic-substrings.java)|Medium|55.49%|| -|650|[2-keys-keyboard](https://leetcode.com/problems/2-keys-keyboard/)| [java](./solutions/650.2-keys-keyboard/2-keys-keyboard.java)|Medium|46.06%|| -|653|[two-sum-iv-input-is-a-bst](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)| [java](./solutions/653.two-sum-iv-input-is-a-bst/two-sum-iv-input-is-a-bst.java)|Easy|51.60%|| -|657|[robot-return-to-origin](https://leetcode.com/problems/robot-return-to-origin/)| [java](./solutions/657.robot-return-to-origin/robot-return-to-origin.java)|Easy|70.58%|| -|661|[image-smoother](https://leetcode.com/problems/image-smoother/)| [java](./solutions/661.image-smoother/image-smoother.java)|Easy|47.69%|| -|665|[non-decreasing-array](https://leetcode.com/problems/non-decreasing-array/)| [java](./solutions/665.non-decreasing-array/non-decreasing-array.java)|Easy|19.58%|| -|669|[trim-a-binary-search-tree](https://leetcode.com/problems/trim-a-binary-search-tree/)| [java](./solutions/669.trim-a-binary-search-tree/trim-a-binary-search-tree.java)|Easy|59.57%|| -|671|[second-minimum-node-in-a-binary-tree](https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/)| [java](./solutions/671.second-minimum-node-in-a-binary-tree/second-minimum-node-in-a-binary-tree.java)|Easy|43.24%|| -|673|[number-of-longest-increasing-subsequence](https://leetcode.com/problems/number-of-longest-increasing-subsequence/)| [java](./solutions/673.number-of-longest-increasing-subsequence/number-of-longest-increasing-subsequence.java)|Medium|33.01%|| -|674|[longest-continuous-increasing-subsequence](https://leetcode.com/problems/longest-continuous-increasing-subsequence/)| [java](./solutions/674.longest-continuous-increasing-subsequence/longest-continuous-increasing-subsequence.java)|Easy|43.67%|| -|680|[valid-palindrome-ii](https://leetcode.com/problems/valid-palindrome-ii/)| [java](./solutions/680.valid-palindrome-ii/valid-palindrome-ii.java)|Easy|33.62%|| -|686|[repeated-string-match](https://leetcode.com/problems/repeated-string-match/)| [java](./solutions/686.repeated-string-match/repeated-string-match.java)|Easy|31.31%|| -|687|[longest-univalue-path](https://leetcode.com/problems/longest-univalue-path/)| [java](./solutions/687.longest-univalue-path/longest-univalue-path.java)|Easy|33.22%|| -|690|[employee-importance](https://leetcode.com/problems/employee-importance/)| [java](./solutions/690.employee-importance/employee-importance.java)|Easy|53.02%|| -|693|[binary-number-with-alternating-bits](https://leetcode.com/problems/binary-number-with-alternating-bits/)| [java](./solutions/693.binary-number-with-alternating-bits/binary-number-with-alternating-bits.java)|Easy|57.44%|| -|695|[max-area-of-island](https://leetcode.com/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|55.58%|| -|696|[count-binary-substrings](https://leetcode.com/problems/count-binary-substrings/)| [java](./solutions/696.count-binary-substrings/count-binary-substrings.java)|Easy|52.24%|| -|697|[degree-of-an-array](https://leetcode.com/problems/degree-of-an-array/)| [java](./solutions/697.degree-of-an-array/degree-of-an-array.java)|Easy|48.83%|| -|698|[partition-to-k-equal-sum-subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets/)| [java](./solutions/698.partition-to-k-equal-sum-subsets/partition-to-k-equal-sum-subsets.java)|Medium|40.77%|| -|712|[minimum-ascii-delete-sum-for-two-strings](https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/)| [java](./solutions/712.minimum-ascii-delete-sum-for-two-strings/minimum-ascii-delete-sum-for-two-strings.java)|Medium|53.22%|| -|714|[best-time-to-buy-and-sell-stock-with-transaction-fee](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/)| [java](./solutions/714.best-time-to-buy-and-sell-stock-with-transaction-fee/best-time-to-buy-and-sell-stock-with-transaction-fee.java)|Medium|49.32%|| -|717|[1-bit-and-2-bit-characters](https://leetcode.com/problems/1-bit-and-2-bit-characters/)| [java](./solutions/717.1-bit-and-2-bit-characters/1-bit-and-2-bit-characters.java)|Easy|48.81%|| -|718|[maximum-length-of-repeated-subarray](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| [java](./solutions/718.maximum-length-of-repeated-subarray/maximum-length-of-repeated-subarray.java)|Medium|44.52%|| -|720|[longest-word-in-dictionary](https://leetcode.com/problems/longest-word-in-dictionary/)| [java](./solutions/720.longest-word-in-dictionary/longest-word-in-dictionary.java)|Easy|43.57%|| -|724|[find-pivot-index](https://leetcode.com/problems/find-pivot-index/)| [java](./solutions/724.find-pivot-index/find-pivot-index.java)|Easy|40.37%|| -|728|[self-dividing-numbers](https://leetcode.com/problems/self-dividing-numbers/)| [java](./solutions/728.self-dividing-numbers/self-dividing-numbers.java)|Easy|68.75%|| -|740|[delete-and-earn](https://leetcode.com/problems/delete-and-earn/)| [java](./solutions/740.delete-and-earn/delete-and-earn.java)|Medium|44.91%|| -|742|[to-lower-case](https://leetcode.com/problems/to-lower-case/)| [java](./solutions/742.to-lower-case/to-lower-case.java)|Easy|75.97%|| -|745|[find-smallest-letter-greater-than-target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/)| [java](./solutions/745.find-smallest-letter-greater-than-target/find-smallest-letter-greater-than-target.java)|Easy|43.47%|| -|747|[min-cost-climbing-stairs](https://leetcode.com/problems/min-cost-climbing-stairs/)| [java](./solutions/747.min-cost-climbing-stairs/min-cost-climbing-stairs.java)|Easy|45.69%|| -|748|[largest-number-at-least-twice-of-others](https://leetcode.com/problems/largest-number-at-least-twice-of-others/)| [java](./solutions/748.largest-number-at-least-twice-of-others/largest-number-at-least-twice-of-others.java)|Easy|40.21%|| -|764|[n-ary-tree-level-order-traversal](https://leetcode.com/problems/n-ary-tree-level-order-traversal/)| [java](./solutions/764.n-ary-tree-level-order-traversal/n-ary-tree-level-order-traversal.java)|Easy|58.00%|| -|767|[prime-number-of-set-bits-in-binary-representation](https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/)| [java](./solutions/767.prime-number-of-set-bits-in-binary-representation/prime-number-of-set-bits-in-binary-representation.java)|Easy|57.53%|| -|769|[largest-plus-sign](https://leetcode.com/problems/largest-plus-sign/)| [java](./solutions/769.largest-plus-sign/largest-plus-sign.java)|Medium|42.38%|| -|774|[maximum-depth-of-n-ary-tree](https://leetcode.com/problems/maximum-depth-of-n-ary-tree/)| [java](./solutions/774.maximum-depth-of-n-ary-tree/maximum-depth-of-n-ary-tree.java)|Easy|64.11%|| -|775|[n-ary-tree-preorder-traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)| [java](./solutions/775.n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.java)|Easy|65.66%|| -|776|[n-ary-tree-postorder-traversal](https://leetcode.com/problems/n-ary-tree-postorder-traversal/)| [java](./solutions/776.n-ary-tree-postorder-traversal/n-ary-tree-postorder-traversal.java)|Easy|65.65%|| -|777|[toeplitz-matrix](https://leetcode.com/problems/toeplitz-matrix/)| [java](./solutions/777.toeplitz-matrix/toeplitz-matrix.java)|Easy|60.97%|| -|782|[jewels-and-stones](https://leetcode.com/problems/jewels-and-stones/)| [java](./solutions/782.jewels-and-stones/jewels-and-stones.java)|Easy|82.61%|| -|783|[search-in-a-binary-search-tree](https://leetcode.com/problems/search-in-a-binary-search-tree/)| [java](./solutions/783.search-in-a-binary-search-tree/search-in-a-binary-search-tree.java)|Easy|66.29%|| -|792|[binary-search](https://leetcode.com/problems/binary-search/)| [java](./solutions/792.binary-search/binary-search.java)|Easy|44.75%|| -|800|[letter-case-permutation](https://leetcode.com/problems/letter-case-permutation/)| [java](./solutions/800.letter-case-permutation/letter-case-permutation.java)|Easy|55.01%|| -|803|[cheapest-flights-within-k-stops](https://leetcode.com/problems/cheapest-flights-within-k-stops/)| [java](./solutions/803.cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.java)|Medium|33.71%|| -|806|[domino-and-tromino-tiling](https://leetcode.com/problems/domino-and-tromino-tiling/)| [java](./solutions/806.domino-and-tromino-tiling/domino-and-tromino-tiling.java)|Medium|34.80%|| -|822|[unique-morse-code-words](https://leetcode.com/problems/unique-morse-code-words/)| [java](./solutions/822.unique-morse-code-words/unique-morse-code-words.java)|Easy|73.68%|| -|829|[subdomain-visit-count](https://leetcode.com/problems/subdomain-visit-count/)| [java](./solutions/829.subdomain-visit-count/subdomain-visit-count.java)|Easy|63.43%|| -|837|[most-common-word](https://leetcode.com/problems/most-common-word/)| [java](./solutions/837.most-common-word/most-common-word.java)|Easy|41.39%|| -|851|[goat-latin](https://leetcode.com/problems/goat-latin/)| [java](./solutions/851.goat-latin/goat-latin.java)|Easy|56.66%|| -|857|[positions-of-large-groups](https://leetcode.com/problems/positions-of-large-groups/)| [java](./solutions/857.positions-of-large-groups/positions-of-large-groups.java)|Easy|47.29%|| -|861|[flipping-an-image](https://leetcode.com/problems/flipping-an-image/)| [java](./solutions/861.flipping-an-image/flipping-an-image.java)|Easy|71.15%|| -|870|[magic-squares-in-grid](https://leetcode.com/problems/magic-squares-in-grid/)| [java](./solutions/870.magic-squares-in-grid/magic-squares-in-grid.java)|Easy|35.15%|| -|879|[maximize-distance-to-closest-person](https://leetcode.com/problems/maximize-distance-to-closest-person/)| [java](./solutions/879.maximize-distance-to-closest-person/maximize-distance-to-closest-person.java)|Easy|40.35%|| -|882|[peak-index-in-a-mountain-array](https://leetcode.com/problems/peak-index-in-a-mountain-array/)| [java](./solutions/882.peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.java)|Easy|68.86%|| -|889|[buddy-strings](https://leetcode.com/problems/buddy-strings/)| [java](./solutions/889.buddy-strings/buddy-strings.java)|Easy|27.38%|| -|898|[transpose-matrix](https://leetcode.com/problems/transpose-matrix/)| [java](./solutions/898.transpose-matrix/transpose-matrix.java)|Easy|63.65%|| -|904|[leaf-similar-trees](https://leetcode.com/problems/leaf-similar-trees/)| [java](./solutions/904.leaf-similar-trees/leaf-similar-trees.java)|Easy|62.01%|| +# 此项目已不再维护,有需要者,欢迎 fork +苦于工作繁忙,我已经不刷题很久了,没有使用需求就难以保持爬虫逻辑紧跟 leetcode 官网更新。欢迎 fork,解决需求。 +# leetcode-spider [![npm package](https://img.shields.io/npm/v/leetcode-spider.svg)](https://www.npmjs.com/package/leetcode-spider) + +使用 JS 编写的 leetcode 解题源码爬虫.爬取你自己的 leetcode 解题源码. + +如果你也想把你在 [leetcode](https://leetcode.com/) 上提交且 accepted 的解题代码爬下来,那么本工具就是为此需求而生!爬下来的代码可以放在 github 上管理和开源出来,可以作为个人展示,更可以借助 [leetcode-viewer](https://github.com/Ma63d/leetcode-viewer) 将代码通过一个单页应用完美展现,几条命令就可以呈现一个 leetcode 源码博客,交流和展示搞起来! + +## 新版本来了 + +- 支持使用模板语法来配置你自己的 README.md 模板了! +- 新增部分配置项 +- 优化 README.md 输出: + ![](img/example.png) +- 优化网络错误处理机制 + + +**需要 Node 4.0 及以上版本!** + +## 安装 Installation + +``` +npm i leetcode-spider -g +``` + + +## 使用 Usage + +请事先建立好如下 json 文件(以命名为 config.json 为例): + + +``` +{ + "username" : "hello@gmail.com", + "password" : "xxxxxxxxx", + "language": ["java","c++","c"], + "outputDir": "./solutions", (可选字段) + "template": "./README.tpl" (可选字段) +} +``` + +- `username` 和 `password` 对应你的的 leetcode 账户. + + +- `language` 对应于你用来解 leetcode 的编程语言,该项为一个数组,即使只有一种语言. +目前 `language` 字段支持填写所有 leetcode 的编程语言: + - `c++`(别填`cpp`) + - `c` + - `java` + - `javascript` (别填`js`) + - `python` + - `c#` (别填`csharp`) + - `ruby` + - `swift` + - `go` + +- `outputDir` **选填**,表示你希望存放源码文件的目录,默认`"./solutions"` +- `template` **选填**,表示你自己定义的 README.tpl 路径,默认 "./README.tpl" + + +## 运行 Execution + +``` +lc-spider // 默认使用config.json为配置文件运行爬虫 +``` +**程序会记录上一次爬取了哪些题目,之前爬取过的题目再次运行的时候不会爬取,除非你通过-n选项手动指定.** + +**这也意味着,当你在进行增量爬取时,根本不需要去指定要爬哪些题目, leetcode-spider 会自动知道哪些题目需要爬.** + +举个例子,按照我们的日常使用: + +* 当你昨天 A 了5道题,你用爬虫爬了下来 +* 然后今天你 A 了6道题,你今天再次运行程序 + +程序此时会自动检查你跟上一次爬取结果相比多写了哪些题,然后把这些新增的代码爬取下来,不会重复的去爬取,你也不用手工指定你今天 AC 了哪些题. + +永远只用一行命令: `lc-spider`.(除非你想要再去爬以前爬过的题,比如你改进了修改了原先AC的代码,想把新代码爬下来,或者你新增了另一种语言的解法, 那么这种时候可以用-n选项指定具体要爬取的题目,请参考[选项](https://github.com/Ma63d/leetcode-spider#选项)章节的具体内容.) + +此外源码对应的 leetcode 的题目,也会爬取下来,放在代码目录, markdown 格式. + +爬取完成后会自动生成 README.md 文件,当你把爬下来的代码放在 github 上时,README.md 起一个介绍和导航的作用.另外,有的同学的 config.json 文件是直接放在当前的代码存放目录的,那你在把这个目录上传到 github 上之前,请记得写 `.gitignore` 文件,在里面忽略掉你的 config.json 文件!不然你的用户名和密码也传到 github 上公开给大家了(虽然 leetcode 账户屁用没有)。 + +如果你运行 lc-spider 却显示无法找到命令,首先请确认一下你在 npm 安装 lc-spider 的时候是否是全局安装(也就是有没有那个`-g`),如果你是全局安装的,那就是你的 npm 的环境变量配置得不对了,请参考百度的 fis 团队写的 [这篇文章](https://github.com/fex-team/fis/issues/565),方便不熟悉 npm 的同学解决自己遇到的问题. + +## 模板功能 + +嫌默认生成自带的 README.md 不好看?嫌我写的文案不够好? +没关系,现在你可以自定义你的 README.md 模板,使用 [mustache](https://github.com/janl/mustache.js) 语法(就是 vue 用的那一套),自己书写你的 README.md 模板: + +leetcode-spider 第一次运行之后会在你运行命令的目录下生成 [README.tpl](https://github.com/Ma63d/leetcode-spider/blob/master/lib/README.tpl) 文件,如果你对默认生成的 README.md 文件不满意,那你自行修改这个 README.tpl 模板文件即可。程序会在下次运行时使用这个模板文件来生成 README.md . + + + +## 帮助 Help +``` +lc-spider -h +``` + +## 选项 + +### -config or -c +``` +lc-spider -c xxx.json +``` + +使用指定的配置文件运行 lc-spider. 默认使用的是 config.json. + +### -number or -n +``` +lc-spider -n 2-15 3 78-101 +``` + +只爬取你指定的题目,可以使用连字符(如15-100),此处指定的是需要爬取的题号.程序会检查哪些题目你 AC 了,因此你可以放心的填写.比如你a了200-300之间的某几道题,但是不想一个个的指定出来,那你就大胆的写上200-300,程序会查找200-300范围内你 AC 的源码,并爬取下来. From 74a3caec3add74058c1fe14f93531a48e3ec5c88 Mon Sep 17 00:00:00 2001 From: kherrisan Date: Sun, 29 Mar 2020 14:58:59 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=94=B9=E6=88=90=20leet?= =?UTF-8?q?code-cn=EF=BC=8C=E5=B9=B6=E4=B8=94=E6=8D=A2=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=20api=20=E7=9A=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 149 ++++++++++++------------------------------------- README.tpl | 2 +- lib/README.tpl | 2 +- lib/spider.js | 16 +++--- 4 files changed, 46 insertions(+), 123 deletions(-) diff --git a/README.md b/README.md index 98a7e37..4dfca3c 100644 --- a/README.md +++ b/README.md @@ -1,114 +1,37 @@ -# 此项目已不再维护,有需要者,欢迎 fork -苦于工作繁忙,我已经不刷题很久了,没有使用需求就难以保持爬虫逻辑紧跟 leetcode 官网更新。欢迎 fork,解决需求。 +

+

+ + + + +

+

My leetcode solutions

+ +

+ Language: java c++ c +
+ Last updated: 2020-03-29 +

+

+ +

The source code is fetched using the tool leetcode-spider.

+ +| # | Problems | Solutions | Difficulty | Acceptance | Paid-Only +|:--:|:-----:|:---------:|:----:|:----:|:----:| +|169|[majority-element](https://leetcode.com-cn/problems/majority-element/)| [java](./solutions/169.majority-element/majority-element.java)|Easy|62.80%|| +|300|[longest-increasing-subsequence](https://leetcode.com-cn/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|44.00%|| +|365|[water-and-jug-problem](https://leetcode.com-cn/problems/water-and-jug-problem/)| [java](./solutions/365.water-and-jug-problem/water-and-jug-problem.java)|Medium|35.10%|| +|409|[longest-palindrome](https://leetcode.com-cn/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|54.93%|| +|695|[max-area-of-island](https://leetcode.com-cn/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|63.12%|| +|839|[short-encoding-of-words](https://leetcode.com-cn/problems/short-encoding-of-words/)| [java](./solutions/839.short-encoding-of-words/short-encoding-of-words.java)|Medium|48.29%|| +|866|[rectangle-overlap](https://leetcode.com-cn/problems/rectangle-overlap/)| [java](./solutions/866.rectangle-overlap/rectangle-overlap.java)|Easy|49.88%|| +|908|[middle-of-the-linked-list](https://leetcode.com-cn/problems/middle-of-the-linked-list/)| [java](./solutions/908.middle-of-the-linked-list/middle-of-the-linked-list.java)|Easy|68.67%|| +|928|[surface-area-of-3d-shapes](https://leetcode.com-cn/problems/surface-area-of-3d-shapes/)| [java](./solutions/928.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java)|Easy|64.39%|| +|950|[x-of-a-kind-in-a-deck-of-cards](https://leetcode.com-cn/problems/x-of-a-kind-in-a-deck-of-cards/)| [java](./solutions/950.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java)|Easy|39.31%|| +|982|[minimum-increment-to-make-array-unique](https://leetcode.com-cn/problems/minimum-increment-to-make-array-unique/)| [java](./solutions/982.minimum-increment-to-make-array-unique/minimum-increment-to-make-array-unique.java)|Medium|47.55%|| +|1041|[available-captures-for-rook](https://leetcode.com-cn/problems/available-captures-for-rook/)| [java](./solutions/1041.available-captures-for-rook/available-captures-for-rook.java)|Easy|69.35%|| +|1112|[find-words-that-can-be-formed-by-characters](https://leetcode.com-cn/problems/find-words-that-can-be-formed-by-characters/)| [java](./solutions/1112.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java)|Easy|69.48%|| +|1117|[as-far-from-land-as-possible](https://leetcode.com-cn/problems/as-far-from-land-as-possible/)| [java](./solutions/1117.as-far-from-land-as-possible/as-far-from-land-as-possible.java)|Medium|42.89%|| +|100161|[compress-string-lcci](https://leetcode.com-cn/problems/compress-string-lcci/)| [java](./solutions/100161.compress-string-lcci/compress-string-lcci.java)|Easy|49.01%|| +|1000023|[the-masseuse-lcci](https://leetcode.com-cn/problems/the-masseuse-lcci/)| [java](./solutions/1000023.the-masseuse-lcci/the-masseuse-lcci.java)|Easy|53.74%|| -# leetcode-spider [![npm package](https://img.shields.io/npm/v/leetcode-spider.svg)](https://www.npmjs.com/package/leetcode-spider) - -使用 JS 编写的 leetcode 解题源码爬虫.爬取你自己的 leetcode 解题源码. - -如果你也想把你在 [leetcode](https://leetcode.com/) 上提交且 accepted 的解题代码爬下来,那么本工具就是为此需求而生!爬下来的代码可以放在 github 上管理和开源出来,可以作为个人展示,更可以借助 [leetcode-viewer](https://github.com/Ma63d/leetcode-viewer) 将代码通过一个单页应用完美展现,几条命令就可以呈现一个 leetcode 源码博客,交流和展示搞起来! - -## 新版本来了 - -- 支持使用模板语法来配置你自己的 README.md 模板了! -- 新增部分配置项 -- 优化 README.md 输出: - ![](img/example.png) -- 优化网络错误处理机制 - - -**需要 Node 4.0 及以上版本!** - -## 安装 Installation - -``` -npm i leetcode-spider -g -``` - - -## 使用 Usage - -请事先建立好如下 json 文件(以命名为 config.json 为例): - - -``` -{ - "username" : "hello@gmail.com", - "password" : "xxxxxxxxx", - "language": ["java","c++","c"], - "outputDir": "./solutions", (可选字段) - "template": "./README.tpl" (可选字段) -} -``` - -- `username` 和 `password` 对应你的的 leetcode 账户. - - -- `language` 对应于你用来解 leetcode 的编程语言,该项为一个数组,即使只有一种语言. -目前 `language` 字段支持填写所有 leetcode 的编程语言: - - `c++`(别填`cpp`) - - `c` - - `java` - - `javascript` (别填`js`) - - `python` - - `c#` (别填`csharp`) - - `ruby` - - `swift` - - `go` - -- `outputDir` **选填**,表示你希望存放源码文件的目录,默认`"./solutions"` -- `template` **选填**,表示你自己定义的 README.tpl 路径,默认 "./README.tpl" - - -## 运行 Execution - -``` -lc-spider // 默认使用config.json为配置文件运行爬虫 -``` -**程序会记录上一次爬取了哪些题目,之前爬取过的题目再次运行的时候不会爬取,除非你通过-n选项手动指定.** - -**这也意味着,当你在进行增量爬取时,根本不需要去指定要爬哪些题目, leetcode-spider 会自动知道哪些题目需要爬.** - -举个例子,按照我们的日常使用: - -* 当你昨天 A 了5道题,你用爬虫爬了下来 -* 然后今天你 A 了6道题,你今天再次运行程序 - -程序此时会自动检查你跟上一次爬取结果相比多写了哪些题,然后把这些新增的代码爬取下来,不会重复的去爬取,你也不用手工指定你今天 AC 了哪些题. - -永远只用一行命令: `lc-spider`.(除非你想要再去爬以前爬过的题,比如你改进了修改了原先AC的代码,想把新代码爬下来,或者你新增了另一种语言的解法, 那么这种时候可以用-n选项指定具体要爬取的题目,请参考[选项](https://github.com/Ma63d/leetcode-spider#选项)章节的具体内容.) - -此外源码对应的 leetcode 的题目,也会爬取下来,放在代码目录, markdown 格式. - -爬取完成后会自动生成 README.md 文件,当你把爬下来的代码放在 github 上时,README.md 起一个介绍和导航的作用.另外,有的同学的 config.json 文件是直接放在当前的代码存放目录的,那你在把这个目录上传到 github 上之前,请记得写 `.gitignore` 文件,在里面忽略掉你的 config.json 文件!不然你的用户名和密码也传到 github 上公开给大家了(虽然 leetcode 账户屁用没有)。 - -如果你运行 lc-spider 却显示无法找到命令,首先请确认一下你在 npm 安装 lc-spider 的时候是否是全局安装(也就是有没有那个`-g`),如果你是全局安装的,那就是你的 npm 的环境变量配置得不对了,请参考百度的 fis 团队写的 [这篇文章](https://github.com/fex-team/fis/issues/565),方便不熟悉 npm 的同学解决自己遇到的问题. - -## 模板功能 - -嫌默认生成自带的 README.md 不好看?嫌我写的文案不够好? -没关系,现在你可以自定义你的 README.md 模板,使用 [mustache](https://github.com/janl/mustache.js) 语法(就是 vue 用的那一套),自己书写你的 README.md 模板: - -leetcode-spider 第一次运行之后会在你运行命令的目录下生成 [README.tpl](https://github.com/Ma63d/leetcode-spider/blob/master/lib/README.tpl) 文件,如果你对默认生成的 README.md 文件不满意,那你自行修改这个 README.tpl 模板文件即可。程序会在下次运行时使用这个模板文件来生成 README.md . - - - -## 帮助 Help -``` -lc-spider -h -``` - -## 选项 - -### -config or -c -``` -lc-spider -c xxx.json -``` - -使用指定的配置文件运行 lc-spider. 默认使用的是 config.json. - -### -number or -n -``` -lc-spider -n 2-15 3 78-101 -``` - -只爬取你指定的题目,可以使用连字符(如15-100),此处指定的是需要爬取的题号.程序会检查哪些题目你 AC 了,因此你可以放心的填写.比如你a了200-300之间的某几道题,但是不想一个个的指定出来,那你就大胆的写上200-300,程序会查找200-300范围内你 AC 的源码,并爬取下来. diff --git a/README.tpl b/README.tpl index fa7970a..73fd7b8 100644 --- a/README.tpl +++ b/README.tpl @@ -19,6 +19,6 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| {{#solutions}} -|{{id}}|[{{title}}](https://leetcode.com/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| +|{{id}}|[{{title}}](https://leetcode.com-cn/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| {{/solutions}} diff --git a/lib/README.tpl b/lib/README.tpl index fa7970a..73fd7b8 100644 --- a/lib/README.tpl +++ b/lib/README.tpl @@ -19,6 +19,6 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| {{#solutions}} -|{{id}}|[{{title}}](https://leetcode.com/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| +|{{id}}|[{{title}}](https://leetcode.com-cn/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| {{/solutions}} diff --git a/lib/spider.js b/lib/spider.js index 8ddd0a9..7913f4e 100644 --- a/lib/spider.js +++ b/lib/spider.js @@ -4,7 +4,7 @@ const assert = require('assert') const path = require('path') const logger = require('log4js').getLogger('layout-pattern') -const baseUrl = 'https://leetcode.com/' +const baseUrl = 'https://leetcode-cn.com/' const requestLib = require('request') const jar = requestLib.jar() @@ -14,10 +14,10 @@ let request = requestLib jar: jar, baseUrl: baseUrl, headers: { - 'Host': 'leetcode.com', + 'Host': 'leetcode-cn.com', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', - 'Referer': 'https://leetcode.com/accounts/login/', + 'Referer': 'https://leetcode-cn.com/accounts/login/', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6', @@ -126,9 +126,9 @@ let login = co.wrap(function* (conf) { logger.info('token get') debug('token:' + token) - let cookie = jar.getCookies('https://leetcode.com/') - let cookieOfToken = cookie.find(element => element.key === 'csrftoken') - assert.notEqual(cookieOfToken, undefined, 'network error: cannot get csrftoken') + let cookie = jar.getCookies('https://leetcode-cn.com/') + // let cookieOfToken = cookie.find(element => element.key === 'csrftoken') + // assert.notEqual(cookieOfToken, undefined, 'network error: cannot get csrftoken') yield request({ method: 'POST', @@ -139,7 +139,7 @@ let login = co.wrap(function* (conf) { 'password': conf['password'] } }) - cookie = jar.getCookies('https://leetcode.com/') + cookie = jar.getCookies('https://leetcode-cn.com/') assert.notEqual(cookie.find(element => element.key === 'LEETCODE_SESSION'), undefined, 'incorrect username or password') logger.info('login successfully') }) @@ -154,7 +154,7 @@ let login = co.wrap(function* (conf) { let fetchACLists = co.wrap(function* () { debug('fetch the accepted solutions\' list') - let [, body] = yield request.get('/api/problems/algorithms/') + let [, body] = yield request.get('/api/problems/all/') try { body = JSON.parse(body) } catch (e) { From fc579571f54df58f16cab389af8b3bfea6f73423 Mon Sep 17 00:00:00 2001 From: kherrisan Date: Sun, 29 Mar 2020 15:09:01 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=20read?= =?UTF-8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dfca3c..2afda1d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

My leetcode solutions

- Language: java c++ c + Language: java c++
Last updated: 2020-03-29

From dc341cca33880ccd7feb3e2dfe3ce83ddbd2d2c1 Mon Sep 17 00:00:00 2001 From: kherrisan Date: Sun, 29 Mar 2020 17:11:49 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20frontendId=20=E6=9D=A5?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++++++++++++++----------------- README.tpl | 2 +- lib/README.tpl | 2 +- lib/file.js | 34 +++++++++++++++++----------------- lib/generateMD.js | 20 ++++++++++---------- lib/result.js | 2 +- lib/spider.js | 16 +++++++++------- 7 files changed, 54 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 2afda1d..e3ad011 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ - +

My leetcode solutions

@@ -18,20 +18,18 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| -|169|[majority-element](https://leetcode.com-cn/problems/majority-element/)| [java](./solutions/169.majority-element/majority-element.java)|Easy|62.80%|| -|300|[longest-increasing-subsequence](https://leetcode.com-cn/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|44.00%|| -|365|[water-and-jug-problem](https://leetcode.com-cn/problems/water-and-jug-problem/)| [java](./solutions/365.water-and-jug-problem/water-and-jug-problem.java)|Medium|35.10%|| -|409|[longest-palindrome](https://leetcode.com-cn/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|54.93%|| -|695|[max-area-of-island](https://leetcode.com-cn/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|63.12%|| -|839|[short-encoding-of-words](https://leetcode.com-cn/problems/short-encoding-of-words/)| [java](./solutions/839.short-encoding-of-words/short-encoding-of-words.java)|Medium|48.29%|| -|866|[rectangle-overlap](https://leetcode.com-cn/problems/rectangle-overlap/)| [java](./solutions/866.rectangle-overlap/rectangle-overlap.java)|Easy|49.88%|| -|908|[middle-of-the-linked-list](https://leetcode.com-cn/problems/middle-of-the-linked-list/)| [java](./solutions/908.middle-of-the-linked-list/middle-of-the-linked-list.java)|Easy|68.67%|| -|928|[surface-area-of-3d-shapes](https://leetcode.com-cn/problems/surface-area-of-3d-shapes/)| [java](./solutions/928.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java)|Easy|64.39%|| -|950|[x-of-a-kind-in-a-deck-of-cards](https://leetcode.com-cn/problems/x-of-a-kind-in-a-deck-of-cards/)| [java](./solutions/950.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java)|Easy|39.31%|| -|982|[minimum-increment-to-make-array-unique](https://leetcode.com-cn/problems/minimum-increment-to-make-array-unique/)| [java](./solutions/982.minimum-increment-to-make-array-unique/minimum-increment-to-make-array-unique.java)|Medium|47.55%|| -|1041|[available-captures-for-rook](https://leetcode.com-cn/problems/available-captures-for-rook/)| [java](./solutions/1041.available-captures-for-rook/available-captures-for-rook.java)|Easy|69.35%|| -|1112|[find-words-that-can-be-formed-by-characters](https://leetcode.com-cn/problems/find-words-that-can-be-formed-by-characters/)| [java](./solutions/1112.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java)|Easy|69.48%|| -|1117|[as-far-from-land-as-possible](https://leetcode.com-cn/problems/as-far-from-land-as-possible/)| [java](./solutions/1117.as-far-from-land-as-possible/as-far-from-land-as-possible.java)|Medium|42.89%|| -|100161|[compress-string-lcci](https://leetcode.com-cn/problems/compress-string-lcci/)| [java](./solutions/100161.compress-string-lcci/compress-string-lcci.java)|Easy|49.01%|| -|1000023|[the-masseuse-lcci](https://leetcode.com-cn/problems/the-masseuse-lcci/)| [java](./solutions/1000023.the-masseuse-lcci/the-masseuse-lcci.java)|Easy|53.74%|| +|169|[majority-element](https://leetcode-cn.com/problems/majority-element/)| [java](./solutions/169.majority-element/majority-element.java)|Easy|62.80%|| +|300|[longest-increasing-subsequence](https://leetcode-cn.com/problems/longest-increasing-subsequence/)| [java](./solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java)|Medium|44.00%|| +|365|[water-and-jug-problem](https://leetcode-cn.com/problems/water-and-jug-problem/)| [java](./solutions/365.water-and-jug-problem/water-and-jug-problem.java)|Medium|35.11%|| +|409|[longest-palindrome](https://leetcode-cn.com/problems/longest-palindrome/)| [java](./solutions/409.longest-palindrome/longest-palindrome.java)|Easy|54.93%|| +|695|[max-area-of-island](https://leetcode-cn.com/problems/max-area-of-island/)| [java](./solutions/695.max-area-of-island/max-area-of-island.java)|Medium|63.12%|| +|820|[short-encoding-of-words](https://leetcode-cn.com/problems/short-encoding-of-words/)| [java](./solutions/820.short-encoding-of-words/short-encoding-of-words.java)|Medium|48.32%|| +|836|[rectangle-overlap](https://leetcode-cn.com/problems/rectangle-overlap/)| [java](./solutions/836.rectangle-overlap/rectangle-overlap.java)|Easy|49.87%|| +|876|[middle-of-the-linked-list](https://leetcode-cn.com/problems/middle-of-the-linked-list/)| [java](./solutions/876.middle-of-the-linked-list/middle-of-the-linked-list.java)|Easy|68.67%|| +|892|[surface-area-of-3d-shapes](https://leetcode-cn.com/problems/surface-area-of-3d-shapes/)| [java](./solutions/892.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java)|Easy|64.39%|| +|914|[x-of-a-kind-in-a-deck-of-cards](https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/)| [java](./solutions/914.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java)|Easy|39.32%|| +|945|[minimum-increment-to-make-array-unique](https://leetcode-cn.com/problems/minimum-increment-to-make-array-unique/)| [java](./solutions/945.minimum-increment-to-make-array-unique/minimum-increment-to-make-array-unique.java)|Medium|47.56%|| +|999|[available-captures-for-rook](https://leetcode-cn.com/problems/available-captures-for-rook/)| [java](./solutions/999.available-captures-for-rook/available-captures-for-rook.java)|Easy|69.37%|| +|1160|[find-words-that-can-be-formed-by-characters](https://leetcode-cn.com/problems/find-words-that-can-be-formed-by-characters/)| [java](./solutions/1160.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java)|Easy|69.48%|| +|1162|[as-far-from-land-as-possible](https://leetcode-cn.com/problems/as-far-from-land-as-possible/)| [java](./solutions/1162.as-far-from-land-as-possible/as-far-from-land-as-possible.java)|Medium|43.93%|| diff --git a/README.tpl b/README.tpl index 73fd7b8..4b115c5 100644 --- a/README.tpl +++ b/README.tpl @@ -19,6 +19,6 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| {{#solutions}} -|{{id}}|[{{title}}](https://leetcode.com-cn/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| +|{{id}}|[{{title}}](https://leetcode-cn.com/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| {{/solutions}} diff --git a/lib/README.tpl b/lib/README.tpl index 73fd7b8..4b115c5 100644 --- a/lib/README.tpl +++ b/lib/README.tpl @@ -19,6 +19,6 @@ | # | Problems | Solutions | Difficulty | Acceptance | Paid-Only |:--:|:-----:|:---------:|:----:|:----:|:----:| {{#solutions}} -|{{id}}|[{{title}}](https://leetcode.com-cn/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| +|{{id}}|[{{title}}](https://leetcode-cn.com/problems/{{title}}/)|{{solutionLinks}}|{{difficulty}}|{{acceptance}}|{{paidOnly}}| {{/solutions}} diff --git a/lib/file.js b/lib/file.js index 519522a..43c2dd2 100644 --- a/lib/file.js +++ b/lib/file.js @@ -31,7 +31,7 @@ let write = co.wrap(function * (pathToWrite, content) { * @api public */ exports.writeToFile = co.wrap(function * (languageCodeMap, solutionsDirPath) { - const outputPath = path.resolve(solutionsDirPath, formatId(languageCodeMap._id) + '.' + languageCodeMap._title) + const outputPath = path.resolve(solutionsDirPath, languageCodeMap._frontendId + '.' + languageCodeMap._title) ensureDirectoryExists(outputPath) try { let solveLang = [] @@ -51,19 +51,19 @@ exports.writeToFile = co.wrap(function * (languageCodeMap, solutionsDirPath) { } }) -/** - * Format id to 3-bit. - * - * @param {Number} id - * @return {String} - * @api public - */ -function formatId (id) { - if (id < 10) { - return '00' + id - } else if (id < 100) { - return '0' + id - } else { - return '' + id - } -} +// /** +// * Format id to 3-bit. +// * +// * @param {Number} id +// * @return {String} +// * @api public +// */ +// function formatId (id) { +// if (id < 10) { +// return '00' + id +// } else if (id < 100) { +// return '0' + id +// } else { +// return '' + id +// } +// } diff --git a/lib/generateMD.js b/lib/generateMD.js index 8677174..fbd1824 100644 --- a/lib/generateMD.js +++ b/lib/generateMD.js @@ -39,7 +39,7 @@ exports.generateMarkdown = co.wrap(function * (resultObj, leetcodeNumObj, output }).sort() let solutions = [] problemNumbers.forEach(id => { - let idStr = formatId(id) + let idStr = id let solutionLinks = `` resultObj[id].language.forEach(lang => { solutionLinks += ` [${lang}](./${outputDir}/${idStr}.${resultObj[id].title}/${resultObj[id].title}.${language.nameMap[lang]})` @@ -102,15 +102,15 @@ function getTimeStr (fmt) { return fmt } -function formatId (id) { - if (id < 10) { - return '00' + id - } else if (id < 100) { - return '0' + id - } else { - return '' + id - } -} +// function formatId (id) { +// if (id < 10) { +// return '00' + id +// } else if (id < 100) { +// return '0' + id +// } else { +// return '' + id +// } +// } function leveToStr (level) { switch (level) { case 1: return 'Easy' diff --git a/lib/result.js b/lib/result.js index 8338ead..af30d0a 100644 --- a/lib/result.js +++ b/lib/result.js @@ -44,7 +44,7 @@ exports.writeResult = co.wrap(function* (languageCodeMapArr, leetcodeNumObj, res logger.info("Build result.json") languageCodeMapArr.forEach(element => { let ele = {} - result[element['_id']] = ele + result[element['_frontendId']] = ele ele.id = element['_id'] ele.level = element['_level'] ele.title = element['_title'] diff --git a/lib/spider.js b/lib/spider.js index 7913f4e..4e3b9aa 100644 --- a/lib/spider.js +++ b/lib/spider.js @@ -4,15 +4,16 @@ const assert = require('assert') const path = require('path') const logger = require('log4js').getLogger('layout-pattern') -const baseUrl = 'https://leetcode-cn.com/' const requestLib = require('request') const jar = requestLib.jar() +let thenifyAll = require('thenify-all') + // set default http request settings let request = requestLib .defaults({ jar: jar, - baseUrl: baseUrl, + baseUrl: 'https://leetcode-cn.com/', headers: { 'Host': 'leetcode-cn.com', 'Cache-Control': 'max-age=0', @@ -24,7 +25,6 @@ let request = requestLib 'Content-Type': 'application/x-www-form-urlencoded' } }) -let thenifyAll = require('thenify-all') // promisify the callback-based request API request = thenifyAll(request, {}, ['get', 'post']) let cheerio = require('cheerio') @@ -192,10 +192,10 @@ let fetchSolutionsNotEverFetched = co.wrap(function* (acLists, lang) { // if we fetched once we will not fetch this problem any more // if due to network error, source file hasn't been fetched(xxx.java or xxx.cpp not existed), then fetch again. if (element.status === 'ac') { - if (!(element.stat['question_id'] in result)) { + if (!(element.stat['frontend_question_id'] in result)) { return true } - return result[element.stat['question_id']]["language"].indexOf(lang) === -1 + return result[element.stat['frontend_question_id']]["language"].indexOf(lang) === -1 } else { return false } @@ -222,6 +222,7 @@ let parallelFetch = co.wrap(function* (acLists) { // store the problem's info in languageCodeMap languageCodeMap._title = acProblem.stat['question__title_slug'] languageCodeMap._id = acProblem.stat['question_id'] + languageCodeMap._frontendId = acProblem.stat['frontend_question_id'] languageCodeMap._level = acProblem['difficulty']['level'] languageCodeMap._paid_only = acProblem['paid_only'] languageCodeMap._acceptance = (acProblem['stat']['total_acs'] / acProblem['stat']['total_submitted'] * 100).toFixed(2) + '%' @@ -303,7 +304,7 @@ let fetchACSolutionOfProblem = co.wrap(function* (problemInfo, languageToFetch, __typename } }`, - { offset: 0, limit: 20, lastKey: null, questionSlug: problemInfo.stat['question__title_slug'] }) + { offset: 0, limit: 20, lastKey: null, questionSlug: problemInfo.stat['question__title_slug'] },request) // responseAndBody = yield request.get({ // url: '/api/submissions/' + problemInfo.stat['question__title_slug'] + '/?offset=' + (page * 50) + '&limit=50' // }) @@ -421,6 +422,7 @@ let fetchQuestion = co.wrap(function* (problemInfo, languageCodeMap) { { titleSlug: problemInfo.stat['question__title_slug'] } ) // responseAndBody = yield request.get('/problems/' + problemInfo.stat['question__title_slug'] + '/') + languageCodeMap['_question'] = responseAndBody.data.question.content } catch (err) { debug('network error:error happened when fetching problem \'' + problemInfo.stat['question__title_slug'] + '\'') throw err @@ -430,7 +432,7 @@ let fetchQuestion = co.wrap(function* (problemInfo, languageCodeMap) { // debug('problem :'); // debug($('meta[name=description]').attr('content')); // languageCodeMap['_question'] = $('meta[name=description]').attr('content') - languageCodeMap['_question'] = responseAndBody.data.question.content + }) /** From bcade6dabe718366ca05f81c3d3ffb5c148edcff Mon Sep 17 00:00:00 2001 From: kherrisan Date: Sun, 29 Mar 2020 17:13:39 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=8A=A0=E4=B8=8A=20solutions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - ...ords-that-can-be-formed-by-characters.java | 28 ++++++++ .../question.md | 35 ++++++++++ .../as-far-from-land-as-possible.java | 35 ++++++++++ .../question.md | 38 ++++++++++ .../majority-element.java | 26 +++++++ solutions/169.majority-element/question.md | 16 +++++ .../longest-increasing-subsequence.java | 30 ++++++++ .../question.md | 17 +++++ .../365.water-and-jug-problem/question.md | 25 +++++++ .../water-and-jug-problem.java | 25 +++++++ .../longest-palindrome.java | 23 ++++++ solutions/409.longest-palindrome/question.md | 20 ++++++ .../max-area-of-island.java | 25 +++++++ solutions/695.max-area-of-island/question.md | 25 +++++++ .../820.short-encoding-of-words/question.md | 25 +++++++ .../short-encoding-of-words.java | 23 ++++++ solutions/836.rectangle-overlap/question.md | 26 +++++++ .../rectangle-overlap.java | 8 +++ .../middle-of-the-linked-list.java | 19 +++++ .../876.middle-of-the-linked-list/question.md | 35 ++++++++++ .../892.surface-area-of-3d-shapes/question.md | 70 +++++++++++++++++++ .../surface-area-of-3d-shapes.java | 21 ++++++ .../question.md | 57 +++++++++++++++ .../x-of-a-kind-in-a-deck-of-cards.java | 24 +++++++ ...inimum-increment-to-make-array-unique.java | 23 ++++++ .../question.md | 37 ++++++++++ .../available-captures-for-rook.java | 44 ++++++++++++ .../question.md | 50 +++++++++++++ .../compress-string-lcci.java" | 28 ++++++++ .../question.md" | 25 +++++++ .../question.md" | 29 ++++++++ .../the-masseuse-lcci.java" | 16 +++++ 33 files changed, 928 insertions(+), 1 deletion(-) create mode 100644 solutions/1160.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java create mode 100644 solutions/1160.find-words-that-can-be-formed-by-characters/question.md create mode 100644 solutions/1162.as-far-from-land-as-possible/as-far-from-land-as-possible.java create mode 100644 solutions/1162.as-far-from-land-as-possible/question.md create mode 100644 solutions/169.majority-element/majority-element.java create mode 100644 solutions/169.majority-element/question.md create mode 100644 solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java create mode 100644 solutions/300.longest-increasing-subsequence/question.md create mode 100644 solutions/365.water-and-jug-problem/question.md create mode 100644 solutions/365.water-and-jug-problem/water-and-jug-problem.java create mode 100644 solutions/409.longest-palindrome/longest-palindrome.java create mode 100644 solutions/409.longest-palindrome/question.md create mode 100644 solutions/695.max-area-of-island/max-area-of-island.java create mode 100644 solutions/695.max-area-of-island/question.md create mode 100644 solutions/820.short-encoding-of-words/question.md create mode 100644 solutions/820.short-encoding-of-words/short-encoding-of-words.java create mode 100644 solutions/836.rectangle-overlap/question.md create mode 100644 solutions/836.rectangle-overlap/rectangle-overlap.java create mode 100644 solutions/876.middle-of-the-linked-list/middle-of-the-linked-list.java create mode 100644 solutions/876.middle-of-the-linked-list/question.md create mode 100644 solutions/892.surface-area-of-3d-shapes/question.md create mode 100644 solutions/892.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java create mode 100644 solutions/914.x-of-a-kind-in-a-deck-of-cards/question.md create mode 100644 solutions/914.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java create mode 100644 solutions/945.minimum-increment-to-make-array-unique/minimum-increment-to-make-array-unique.java create mode 100644 solutions/945.minimum-increment-to-make-array-unique/question.md create mode 100644 solutions/999.available-captures-for-rook/available-captures-for-rook.java create mode 100644 solutions/999.available-captures-for-rook/question.md create mode 100644 "solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/compress-string-lcci.java" create mode 100644 "solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/question.md" create mode 100644 "solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/question.md" create mode 100644 "solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/the-masseuse-lcci.java" diff --git a/.gitignore b/.gitignore index 0d4d497..b5bb9e2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,5 @@ log/* .DS_Store result.json npm-debug.log -solutions .vscode config.json \ No newline at end of file diff --git a/solutions/1160.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java b/solutions/1160.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java new file mode 100644 index 0000000..a04b51f --- /dev/null +++ b/solutions/1160.find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.java @@ -0,0 +1,28 @@ +class Solution { + public int countCharacters(String[] words, String chars) { + int[] dictionary = new int[26]; + for(char ch:chars.toCharArray()){ + dictionary[ch-'a']++; + } + int res=0; + boolean learned=true; + int[] counter = new int[26]; + for(String w:words){ + learned=true; + for(char ch:w.toCharArray()){ + counter[ch-'a']++; + if(counter[ch-'a']>dictionary[ch-'a']){ + learned=false; + break; + } + } + if(learned){ + res+=w.length(); + } + for(int i=0;i<26;i++){ + counter[i]=0; + } + } + return res; + } +} \ No newline at end of file diff --git a/solutions/1160.find-words-that-can-be-formed-by-characters/question.md b/solutions/1160.find-words-that-can-be-formed-by-characters/question.md new file mode 100644 index 0000000..276f1e8 --- /dev/null +++ b/solutions/1160.find-words-that-can-be-formed-by-characters/question.md @@ -0,0 +1,35 @@ +

You are given an array of strings words and a string chars.

+ +

A string is good if it can be formed by characters from chars (each character can only be used once).

+ +

Return the sum of lengths of all good strings in words.

+ +

 

+ +

Example 1:

+ +
+Input: words = ["cat","bt","hat","tree"], chars = "atach"
+Output: 6
+Explanation: 
+The strings that can be formed are "cat" and "hat" so the answer is 3 + 3 = 6.
+
+ +

Example 2:

+ +
+Input: words = ["hello","world","leetcode"], chars = "welldonehoneyr"
+Output: 10
+Explanation: 
+The strings that can be formed are "hello" and "world" so the answer is 5 + 5 = 10.
+
+ +

 

+ +

Note:

+ +
    +
  1. 1 <= words.length <= 1000
  2. +
  3. 1 <= words[i].length, chars.length <= 100
  4. +
  5. All strings contain lowercase English letters only.
  6. +
\ No newline at end of file diff --git a/solutions/1162.as-far-from-land-as-possible/as-far-from-land-as-possible.java b/solutions/1162.as-far-from-land-as-possible/as-far-from-land-as-possible.java new file mode 100644 index 0000000..3097a33 --- /dev/null +++ b/solutions/1162.as-far-from-land-as-possible/as-far-from-land-as-possible.java @@ -0,0 +1,35 @@ +class Solution { + public int maxDistance(int[][] grid) { + int M=grid.length;int N=grid[0].length; + Queue queue = new LinkedList(); + int[] dx=new int[]{1,0,0,-1}; + int[] dy=new int[]{0,1,-1,0}; + for(int i=0;i=M||newY<0||newY>=N||grid[newX][newY]!=0){ + continue; + } + grid[newX][newY]=grid[x][y]+1; + last=grid[newX][newY]; + hasOcean=true; + queue.offer(newX); + queue.offer(newY); + } + } + return hasOcean?last-1:-1; + } +} \ No newline at end of file diff --git a/solutions/1162.as-far-from-land-as-possible/question.md b/solutions/1162.as-far-from-land-as-possible/question.md new file mode 100644 index 0000000..b2cbfb3 --- /dev/null +++ b/solutions/1162.as-far-from-land-as-possible/question.md @@ -0,0 +1,38 @@ +

Given an N x N grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the nearest land cell is maximized and return the distance.

+ +

The distance used in this problem is the Manhattan distance: the distance between two cells (x0, y0) and (x1, y1) is |x0 - x1| + |y0 - y1|.

+ +

If no land or water exists in the grid, return -1.

+ +

 

+ +

Example 1:

+ +

+ +
+Input: [[1,0,1],[0,0,0],[1,0,1]]
+Output: 2
+Explanation: 
+The cell (1, 1) is as far as possible from all the land with distance 2.
+
+ +

Example 2:

+ +

+ +
+Input: [[1,0,0],[0,0,0],[0,0,0]]
+Output: 4
+Explanation: 
+The cell (2, 2) is as far as possible from all the land with distance 4.
+
+ +

 

+ +

Note:

+ +
    +
  1. 1 <= grid.length == grid[0].length <= 100
  2. +
  3. grid[i][j] is 0 or 1
  4. +
diff --git a/solutions/169.majority-element/majority-element.java b/solutions/169.majority-element/majority-element.java new file mode 100644 index 0000000..87b6dcb --- /dev/null +++ b/solutions/169.majority-element/majority-element.java @@ -0,0 +1,26 @@ +class Solution { + public int majorityElement(int[] nums) { + if(nums.length==1){ + return nums[0]; + } + int major=0; + boolean start=true; + int majorNums = 0; + for(int i:nums){ + if(start){ + major=i; + majorNums=1; + start=false; + }else if(major==i){ + majorNums++; + }else{ + majorNums--; + if(majorNums<0){ + majorNums=1; + major=i; + } + } + } + return major; + } +} \ No newline at end of file diff --git a/solutions/169.majority-element/question.md b/solutions/169.majority-element/question.md new file mode 100644 index 0000000..1b8cac4 --- /dev/null +++ b/solutions/169.majority-element/question.md @@ -0,0 +1,16 @@ +

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

+ +

You may assume that the array is non-empty and the majority element always exist in the array.

+ +

Example 1:

+ +
+Input: [3,2,3]
+Output: 3
+ +

Example 2:

+ +
+Input: [2,2,1,1,1,2,2]
+Output: 2
+
diff --git a/solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java b/solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java new file mode 100644 index 0000000..afe5695 --- /dev/null +++ b/solutions/300.longest-increasing-subsequence/longest-increasing-subsequence.java @@ -0,0 +1,30 @@ +class Solution { + public int lengthOfLIS(int[] nums) { + if(nums.length<=1){ + return nums.length; + } + int[] tailOfSeqWithLength = new int[nums.length]; + int len=0; + for(int i:nums){ + if(len==0||i>tailOfSeqWithLength[len-1]){ + tailOfSeqWithLength[len++]=i; + }else{ + int left=0; + int right=len-1; + while(left<=right){ + int mid=left+(right-left)/2; + if(tailOfSeqWithLength[mid]Given an unsorted array of integers, find the length of longest increasing subsequence.

+ +

Example:

+ +
+Input: [10,9,2,5,3,7,101,18]
+Output: 4 
+Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4. 
+ +

Note:

+ +
    +
  • There may be more than one LIS combination, it is only necessary for you to return the length.
  • +
  • Your algorithm should run in O(n2) complexity.
  • +
+ +

Follow up: Could you improve it to O(n log n) time complexity?

diff --git a/solutions/365.water-and-jug-problem/question.md b/solutions/365.water-and-jug-problem/question.md new file mode 100644 index 0000000..3800f0d --- /dev/null +++ b/solutions/365.water-and-jug-problem/question.md @@ -0,0 +1,25 @@ +

You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs.

+ +

If z liters of water is measurable, you must have z liters of water contained within one or both buckets by the end.

+ +

Operations allowed:

+ +
    +
  • Fill any of the jugs completely with water.
  • +
  • Empty any of the jugs.
  • +
  • Pour water from one jug into another till the other jug is completely full or the first jug itself is empty.
  • +
+ +

Example 1: (From the famous "Die Hard" example)

+ +
+Input: x = 3, y = 5, z = 4
+Output: True
+
+ +

Example 2:

+ +
+Input: x = 2, y = 6, z = 5
+Output: False
+
\ No newline at end of file diff --git a/solutions/365.water-and-jug-problem/water-and-jug-problem.java b/solutions/365.water-and-jug-problem/water-and-jug-problem.java new file mode 100644 index 0000000..da029e5 --- /dev/null +++ b/solutions/365.water-and-jug-problem/water-and-jug-problem.java @@ -0,0 +1,25 @@ +class Solution { + public boolean canMeasureWater(int x, int y, int z) { + if(x+y='a'){ + charSet[s.charAt(i)-'a']++; + }else{ + charSet[26+s.charAt(i)-'A']++; + } + } + int res=0; + for(int i=0;i<52;i++){ + res+=charSet[i]/2*2; + if(charSet[i]%2==1 && res%2==0){ + res++; + } + } + return res; + } +} \ No newline at end of file diff --git a/solutions/409.longest-palindrome/question.md b/solutions/409.longest-palindrome/question.md new file mode 100644 index 0000000..3e0cd78 --- /dev/null +++ b/solutions/409.longest-palindrome/question.md @@ -0,0 +1,20 @@ +

Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.

+ +

This is case sensitive, for example "Aa" is not considered a palindrome here.

+ +

Note:
+Assume the length of given string will not exceed 1,010. +

+ +

Example: +

+Input:
+"abccccdd"
+
+Output:
+7
+
+Explanation:
+One longest palindrome that can be built is "dccaccd", whose length is 7.
+
+

\ No newline at end of file diff --git a/solutions/695.max-area-of-island/max-area-of-island.java b/solutions/695.max-area-of-island/max-area-of-island.java new file mode 100644 index 0000000..0a0eba3 --- /dev/null +++ b/solutions/695.max-area-of-island/max-area-of-island.java @@ -0,0 +1,25 @@ +class Solution { + public int maxAreaOfIsland(int[][] grid) { + int res=0; + if(grid.length==0){ + return 0; + } + for(int i=0;i=grid.length||j<0||j>=grid[0].length){ + return 0; + } + if(grid[i][j]==1){ + grid[i][j]=-1; + return 1+helper(grid,i-1,j)+helper(grid,i+1,j)+helper(grid,i,j-1)+helper(grid,i,j+1); + } + return 0; + } +} \ No newline at end of file diff --git a/solutions/695.max-area-of-island/question.md b/solutions/695.max-area-of-island/question.md new file mode 100644 index 0000000..86a1dd3 --- /dev/null +++ b/solutions/695.max-area-of-island/question.md @@ -0,0 +1,25 @@ +

Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.

+ +

Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is 0.)

+ +

Example 1:

+ +
+[[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]]
+
+Given the above grid, return 6. Note the answer is not 11, because the island must be connected 4-directionally. + +

Example 2:

+ +
+[[0,0,0,0,0,0,0,0]]
+Given the above grid, return 0. + +

Note: The length of each dimension in the given grid does not exceed 50.

diff --git a/solutions/820.short-encoding-of-words/question.md b/solutions/820.short-encoding-of-words/question.md new file mode 100644 index 0000000..75634d1 --- /dev/null +++ b/solutions/820.short-encoding-of-words/question.md @@ -0,0 +1,25 @@ +

Given a list of words, we may encode it by writing a reference string S and a list of indexes A.

+ +

For example, if the list of words is ["time", "me", "bell"], we can write it as S = "time#bell#" and indexes = [0, 2, 5].

+ +

Then for each index, we will recover the word by reading from the reference string from that index until we reach a "#" character.

+ +

What is the length of the shortest reference string S possible that encodes the given words?

+ +

Example:

+ +
+Input: words = ["time", "me", "bell"]
+Output: 10
+Explanation: S = "time#bell#" and indexes = [0, 2, 5].
+
+ +

 

+ +

Note:

+ +
    +
  1. 1 <= words.length <= 2000.
  2. +
  3. 1 <= words[i].length <= 7.
  4. +
  5. Each word has only lowercase letters.
  6. +
diff --git a/solutions/820.short-encoding-of-words/short-encoding-of-words.java b/solutions/820.short-encoding-of-words/short-encoding-of-words.java new file mode 100644 index 0000000..1d7d8a2 --- /dev/null +++ b/solutions/820.short-encoding-of-words/short-encoding-of-words.java @@ -0,0 +1,23 @@ +class Solution { + public int minimumLengthEncoding(String[] words) { + Comparator cmpor = (s1,s2)->{ + int i1=s1.length()-1; + int i2=s2.length()-1; + for(;i1>=0&&i2>=0;i1--,i2--){ + if(s1.charAt(i1)!=s2.charAt(i2)){ + return s1.charAt(i1)-s2.charAt(i2); + } + } + return i1-i2; + }; + Arrays.sort(words,cmpor); + int length=0; + for(int i=1;iA rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.

+ +

Two rectangles overlap if the area of their intersection is positive.  To be clear, two rectangles that only touch at the corner or edges do not overlap.

+ +

Given two (axis-aligned) rectangles, return whether they overlap.

+ +

Example 1:

+ +
+Input: rec1 = [0,0,2,2], rec2 = [1,1,3,3]
+Output: true
+
+ +

Example 2:

+ +
+Input: rec1 = [0,0,1,1], rec2 = [1,0,2,1]
+Output: false
+
+ +

Notes:

+ +
    +
  1. Both rectangles rec1 and rec2 are lists of 4 integers.
  2. +
  3. All coordinates in rectangles will be between -10^9 and 10^9.
  4. +
diff --git a/solutions/836.rectangle-overlap/rectangle-overlap.java b/solutions/836.rectangle-overlap/rectangle-overlap.java new file mode 100644 index 0000000..6744463 --- /dev/null +++ b/solutions/836.rectangle-overlap/rectangle-overlap.java @@ -0,0 +1,8 @@ +class Solution { + public boolean isRectangleOverlap(int[] rec1, int[] rec2) { + return !(rec1[0]>=rec2[2] + ||rec1[3]<=rec2[1] + ||rec1[2]<=rec2[0] + ||rec1[1]>=rec2[3]); + } +} \ No newline at end of file diff --git a/solutions/876.middle-of-the-linked-list/middle-of-the-linked-list.java b/solutions/876.middle-of-the-linked-list/middle-of-the-linked-list.java new file mode 100644 index 0000000..65ffd5f --- /dev/null +++ b/solutions/876.middle-of-the-linked-list/middle-of-the-linked-list.java @@ -0,0 +1,19 @@ +/** + * Definition for singly-linked list. + * public class ListNode { + * int val; + * ListNode next; + * ListNode(int x) { val = x; } + * } + */ +class Solution { + public ListNode middleNode(ListNode head) { + ListNode slow=head; + ListNode fast=head; + while(fast!=null&&fast.next!=null){ + fast=fast.next.next; + slow=slow.next; + } + return slow; + } +} \ No newline at end of file diff --git a/solutions/876.middle-of-the-linked-list/question.md b/solutions/876.middle-of-the-linked-list/question.md new file mode 100644 index 0000000..338e419 --- /dev/null +++ b/solutions/876.middle-of-the-linked-list/question.md @@ -0,0 +1,35 @@ +

Given a non-empty, singly linked list with head node head, return a middle node of linked list.

+ +

If there are two middle nodes, return the second middle node.

+ +

 

+ +
+

Example 1:

+ +
+Input: [1,2,3,4,5]
+Output: Node 3 from this list (Serialization: [3,4,5])
+The returned node has value 3.  (The judge's serialization of this node is [3,4,5]).
+Note that we returned a ListNode object ans, such that:
+ans.val = 3, ans.next.val = 4, ans.next.next.val = 5, and ans.next.next.next = NULL.
+
+ +
+

Example 2:

+ +
+Input: [1,2,3,4,5,6]
+Output: Node 4 from this list (Serialization: [4,5,6])
+Since the list has two middle nodes with values 3 and 4, we return the second one.
+
+ +

 

+ +

Note:

+ +
    +
  • The number of nodes in the given list will be between 1 and 100.
  • +
+
+
diff --git a/solutions/892.surface-area-of-3d-shapes/question.md b/solutions/892.surface-area-of-3d-shapes/question.md new file mode 100644 index 0000000..b4ec3d0 --- /dev/null +++ b/solutions/892.surface-area-of-3d-shapes/question.md @@ -0,0 +1,70 @@ +

On a N * N grid, we place some 1 * 1 * 1 cubes.

+ +

Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j).

+ +

Return the total surface area of the resulting shapes.

+ +

 

+ +
+
+
+
    +
+
+
+
+ +
+

Example 1:

+ +
+Input: [[2]]
+Output: 10
+
+ +
+

Example 2:

+ +
+Input: [[1,2],[3,4]]
+Output: 34
+
+ +
+

Example 3:

+ +
+Input: [[1,0],[0,2]]
+Output: 16
+
+ +
+

Example 4:

+ +
+Input: [[1,1,1],[1,0,1],[1,1,1]]
+Output: 32
+
+ +
+

Example 5:

+ +
+Input: [[2,2,2],[2,1,2],[2,2,2]]
+Output: 46
+
+ +

 

+ +

Note:

+ +
    +
  • 1 <= N <= 50
  • +
  • 0 <= grid[i][j] <= 50
  • +
+
+
+
+
+
diff --git a/solutions/892.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java b/solutions/892.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java new file mode 100644 index 0000000..3d3db93 --- /dev/null +++ b/solutions/892.surface-area-of-3d-shapes/surface-area-of-3d-shapes.java @@ -0,0 +1,21 @@ +class Solution { + public int surfaceArea(int[][] grid) { + int cubes=0; + int covers=0; + for(int i=0;i1){ + covers+=grid[i][j]-1; + } + if(i>0){ + covers+=Math.min(grid[i-1][j],grid[i][j]); + } + if(j>0){ + covers+=Math.min(grid[i][j-1],grid[i][j]); + } + } + } + return 6*cubes-covers*2; + } +} \ No newline at end of file diff --git a/solutions/914.x-of-a-kind-in-a-deck-of-cards/question.md b/solutions/914.x-of-a-kind-in-a-deck-of-cards/question.md new file mode 100644 index 0000000..9605dfe --- /dev/null +++ b/solutions/914.x-of-a-kind-in-a-deck-of-cards/question.md @@ -0,0 +1,57 @@ +

In a deck of cards, each card has an integer written on it.

+ +

Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where:

+ +
    +
  • Each group has exactly X cards.
  • +
  • All the cards in each group have the same integer.
  • +
+ +

 

+

Example 1:

+ +
+Input: deck = [1,2,3,4,4,3,2,1]
+Output: true
+Explanation: Possible partition [1,1],[2,2],[3,3],[4,4].
+
+ +

Example 2:

+ +
+Input: deck = [1,1,1,2,2,2,3,3]
+Output: false´
+Explanation: No possible partition.
+
+ +

Example 3:

+ +
+Input: deck = [1]
+Output: false
+Explanation: No possible partition.
+
+ +

Example 4:

+ +
+Input: deck = [1,1]
+Output: true
+Explanation: Possible partition [1,1].
+
+ +

Example 5:

+ +
+Input: deck = [1,1,2,2,2,2]
+Output: true
+Explanation: Possible partition [1,1],[2,2],[2,2].
+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= deck.length <= 10^4
  • +
  • 0 <= deck[i] < 10^4
  • +
diff --git a/solutions/914.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java b/solutions/914.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java new file mode 100644 index 0000000..ca1fc1c --- /dev/null +++ b/solutions/914.x-of-a-kind-in-a-deck-of-cards/x-of-a-kind-in-a-deck-of-cards.java @@ -0,0 +1,24 @@ +class Solution { + public boolean hasGroupsSizeX(int[] deck) { + int[] counter=new int[10000]; + for(int d : deck) counter[d]++; + int d=0; + for(int i=0;i<10000;i++){ + if(counter[i]!=0 && d==0)d=counter[i]; + else if(counter[i]!=0) d = gcd(d,counter[i]); + } + return d>1; + } + + private int gcd(int x,int y){ + if(xGiven an array of integers A, a move consists of choosing any A[i], and incrementing it by 1.

+ +

Return the least number of moves to make every value in A unique.

+ +

 

+ +

Example 1:

+ +
+Input: [1,2,2]
+Output: 1
+Explanation:  After 1 move, the array could be [1, 2, 3].
+
+ +
+

Example 2:

+ +
+Input: [3,2,1,2,1,7]
+Output: 6
+Explanation:  After 6 moves, the array could be [3, 4, 1, 2, 5, 7].
+It can be shown with 5 or less moves that it is impossible for the array to have all unique values.
+
+ +

 

+
+ +

Note:

+ +
    +
  1. 0 <= A.length <= 40000
  2. +
  3. 0 <= A[i] < 40000
  4. +
+ +
+
 
+
\ No newline at end of file diff --git a/solutions/999.available-captures-for-rook/available-captures-for-rook.java b/solutions/999.available-captures-for-rook/available-captures-for-rook.java new file mode 100644 index 0000000..a609b1c --- /dev/null +++ b/solutions/999.available-captures-for-rook/available-captures-for-rook.java @@ -0,0 +1,44 @@ +class Solution { + public int numRookCaptures(char[][] board) { + int res=0; + for(int i=0;i<8;i++){ + for(int j=0;j<8;j++){ + if(board[i][j]=='R'){ + for(int d=1;i+d<8;d++){ + if(board[d+i][j]=='B'){ + break; + }else if(board[d+i][j]=='p'){ + res++; + break; + } + } + for(int d=1;i-d>=0;d++){ + if(board[i-d][j]=='B'){ + break; + }else if(board[i-d][j]=='p'){ + res++; + break; + } + } + for(int d=1;j-d>=0;d++){ + if(board[i][j-d]=='B'){ + break; + }else if(board[i][j-d]=='p'){ + res++; + break; + } + } + for(int d=1;j+d<8;d++){ + if(board[i][j+d]=='B'){ + break; + }else if(board[i][j+d]=='p'){ + res++; + break; + } + } + } + } + } + return res; + } +} \ No newline at end of file diff --git a/solutions/999.available-captures-for-rook/question.md b/solutions/999.available-captures-for-rook/question.md new file mode 100644 index 0000000..70df985 --- /dev/null +++ b/solutions/999.available-captures-for-rook/question.md @@ -0,0 +1,50 @@ +

On an 8 x 8 chessboard, there is one white rook.  There also may be empty squares, white bishops, and black pawns.  These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase characters represent black pieces.

+ +

The rook moves as in the rules of Chess: it chooses one of four cardinal directions (north, east, west, and south), then moves in that direction until it chooses to stop, reaches the edge of the board, or captures an opposite colored pawn by moving to the same square it occupies.  Also, rooks cannot move into the same square as other friendly bishops.

+ +

Return the number of pawns the rook can capture in one move.

+ +

 

+ +

Example 1:

+ +

+ +
+Input: [[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","R",".",".",".","p"],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
+Output: 3
+Explanation: 
+In this example the rook is able to capture all the pawns.
+
+ +

Example 2:

+ +

+ +
+Input: [[".",".",".",".",".",".",".","."],[".","p","p","p","p","p",".","."],[".","p","p","B","p","p",".","."],[".","p","B","R","B","p",".","."],[".","p","p","B","p","p",".","."],[".","p","p","p","p","p",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
+Output: 0
+Explanation: 
+Bishops are blocking the rook to capture any pawn.
+
+ +

Example 3:

+ +

+ +
+Input: [[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","p",".",".",".","."],["p","p",".","R",".","p","B","."],[".",".",".",".",".",".",".","."],[".",".",".","B",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."]]
+Output: 3
+Explanation: 
+The rook can capture the pawns at positions b5, d6 and f5.
+
+ +

 

+ +

Note:

+ +
    +
  1. board.length == board[i].length == 8
  2. +
  3. board[i][j] is either 'R', '.', 'B', or 'p'
  4. +
  5. There is exactly one cell with board[i][j] == 'R'
  6. +
diff --git "a/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/compress-string-lcci.java" "b/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/compress-string-lcci.java" new file mode 100644 index 0000000..ff2278e --- /dev/null +++ "b/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/compress-string-lcci.java" @@ -0,0 +1,28 @@ +class Solution { + public String compressString(String S) { + if(S==null||S.length()<=2){ + return S; + } + StringBuilder b=new StringBuilder(); + char cur='0'; + int s=0; + for(char ch:S.toCharArray()){ + if(cur=='0'){ + cur=ch; + s=1; + }else if(cur==ch){ + s++; + }else{ + b.append(cur).append(s); + cur=ch; + s=1; + } + } + b.append(cur).append(s); + if(b.length()>=S.length()){ + return S; + }else{ + return b.toString(); + } + } +} \ No newline at end of file diff --git "a/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/question.md" "b/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/question.md" new file mode 100644 index 0000000..3b1b9ff --- /dev/null +++ "b/solutions/\351\235\242\350\257\225\351\242\230 01.06.compress-string-lcci/question.md" @@ -0,0 +1,25 @@ +

Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the original string, your method should return the original string. You can assume the string has only uppercase and lowercase letters (a - z).

+ +

Example 1:

+ +
+Input: "aabcccccaaa"
+Output: "a2b1c5a3"
+
+ +

Example 2:

+ +
+Input: "abbccd"
+Output: "abbccd"
+Explanation: 
+The compressed string is "a1b2c2d1", which is longer than the original string.
+
+ +

 

+ +

Note:

+ +
    +
  1. 0 <= S.length <= 50000
  2. +
diff --git "a/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/question.md" "b/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/question.md" new file mode 100644 index 0000000..d885a59 --- /dev/null +++ "b/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/question.md" @@ -0,0 +1,29 @@ +

A popular masseuse receives a sequence of back-to-back appointment requests and is debating which ones to accept. She needs a break between appointments and therefore she cannot accept any adjacent requests. Given a sequence of back-to-back appoint­ ment requests, find the optimal (highest total booked minutes) set the masseuse can honor. Return the number of minutes.

+ +

Note: This problem is slightly different from the original one in the book.

+ +

 

+ +

Example 1:

+ +
+Input:  [1,2,3,1]
+Output:  4
+Explanation:  Accept request 1 and 3, total minutes = 1 + 3 = 4
+
+ +

Example 2:

+ +
+Input:  [2,7,9,3,1]
+Output:  12
+Explanation:  Accept request 1, 3 and 5, total minutes = 2 + 9 + 1 = 12
+
+ +

Example 3:

+ +
+Input:  [2,1,4,5,3,1,1,3]
+Output:  12
+Explanation:  Accept request 1, 3, 5 and 8, total minutes = 2 + 4 + 3 + 3 = 12
+
diff --git "a/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/the-masseuse-lcci.java" "b/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/the-masseuse-lcci.java" new file mode 100644 index 0000000..3105fb4 --- /dev/null +++ "b/solutions/\351\235\242\350\257\225\351\242\230 17.16.the-masseuse-lcci/the-masseuse-lcci.java" @@ -0,0 +1,16 @@ +class Solution { + public int massage(int[] nums) { + int[] endOf=new int[nums.length]; + if(nums.length==0){ + return 0; + }else if(nums.length==1){ + return nums[0]; + } + endOf[0]=nums[0]; + endOf[1]=Math.max(nums[0],nums[1]); + for(int i=2;i