Browse Source

Site updated: 2023-09-06 16:36:02

master
nicksxs 2 years ago
parent
commit
30618b3d77
29 changed files with 11199 additions and 11077 deletions
  1. +1
    -1
      2020/04/26/聊聊-mysql-的-MVCC/index.html
  2. +1
    -1
      2020/05/02/聊聊-mysql-的-MVCC-续篇/index.html
  3. +1
    -1
      2020/05/10/聊聊-mysql-的-MVCC-续续篇之加锁分析/index.html
  4. +1
    -1
      2020/08/06/Linux-下-grep-命令的一点小技巧/index.html
  5. +1
    -1
      2020/09/06/mybatis-的-和-是有啥区别/index.html
  6. +1
    -1
      2020/10/03/mybatis-的缓存是怎么回事/index.html
  7. +2
    -2
      2020/10/25/Leetcode-104-二叉树的最大深度-Maximum-Depth-of-Binary-Tree-题解分析/index.html
  8. +2
    -2
      2020/11/01/Apollo-的-value-注解是怎么自动更新的/index.html
  9. +2
    -2
      2020/11/15/Leetcode-234-回文联表-Palindrome-Linked-List-题解分析/index.html
  10. +2
    -2
      2020/12/13/Leetcode-105-从前序与中序遍历序列构造二叉树-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal-题解分析/index.html
  11. +2
    -2
      2021/01/10/Leetcode-160-相交链表-intersection-of-two-linked-lists-题解分析/index.html
  12. +2
    -2
      2021/01/24/Leetcode-124-二叉树中的最大路径和-Binary-Tree-Maximum-Path-Sum-题解分析/index.html
  13. +2
    -2
      2021/02/14/AQS篇一/index.html
  14. +2
    -2
      2021/02/21/AQS-之-Condition-浅析笔记/index.html
  15. +34
    -34
      baidusitemap.xml
  16. +1
    -1
      categories/docker/index.html
  17. +122
    -0
      code/Solution0034.java
  18. +1
    -1
      leancloud_counter_security_urls.json
  19. +1
    -1
      page/32/index.html
  20. +1
    -1
      page/33/index.html
  21. +1
    -1
      page/34/index.html
  22. +1
    -1
      page/36/index.html
  23. +2
    -2
      page/37/index.html
  24. +10638
    -10638
      search.xml
  25. +371
    -371
      sitemap.xml
  26. +1
    -1
      tags/Dubbo/index.html
  27. +1
    -1
      tags/Windows/index.html
  28. +1
    -1
      tags/docker/index.html
  29. +1
    -1
      tags/php/index.html

+ 1
- 1
2020/04/26/聊聊-mysql-的-MVCC/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
2020/05/02/聊聊-mysql-的-MVCC-续篇/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
2020/05/10/聊聊-mysql-的-MVCC-续续篇之加锁分析/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
2020/08/06/Linux-下-grep-命令的一点小技巧/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
2020/09/06/mybatis-的-和-是有啥区别/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
2020/10/03/mybatis-的缓存是怎么回事/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2020/10/25/Leetcode-104-二叉树的最大深度-Maximum-Depth-of-Binary-Tree-题解分析/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2020/11/01/Apollo-的-value-注解是怎么自动更新的/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2020/11/15/Leetcode-234-回文联表-Palindrome-Linked-List-题解分析/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2020/12/13/Leetcode-105-从前序与中序遍历序列构造二叉树-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal-题解分析/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2021/01/10/Leetcode-160-相交链表-intersection-of-two-linked-lists-题解分析/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2021/01/24/Leetcode-124-二叉树中的最大路径和-Binary-Tree-Maximum-Path-Sum-题解分析/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2021/02/14/AQS篇一/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
2021/02/21/AQS-之-Condition-浅析笔记/index.html
File diff suppressed because it is too large
View File


+ 34
- 34
baidusitemap.xml View File

@ -285,19 +285,19 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2022/02/13/Disruptor-%E7%B3%BB%E5%88%97%E4%B8%80/</loc>
<loc>https://nicksxs.me/2020/08/22/Filter-Intercepter-Aop-%E5%95%A5-%E5%95%A5-%E5%95%A5-%E8%BF%99%E4%BA%9B%E9%83%BD%E6%98%AF%E5%95%A5/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2022/02/27/Disruptor-%E7%B3%BB%E5%88%97%E4%BA%8C/</loc>
<loc>https://nicksxs.me/2021/01/24/Leetcode-124-%E4%BA%8C%E5%8F%89%E6%A0%91%E4%B8%AD%E7%9A%84%E6%9C%80%E5%A4%A7%E8%B7%AF%E5%BE%84%E5%92%8C-Binary-Tree-Maximum-Path-Sum-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2020/08/22/Filter-Intercepter-Aop-%E5%95%A5-%E5%95%A5-%E5%95%A5-%E8%BF%99%E4%BA%9B%E9%83%BD%E6%98%AF%E5%95%A5/</loc>
<loc>https://nicksxs.me/2022/02/13/Disruptor-%E7%B3%BB%E5%88%97%E4%B8%80/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/01/24/Leetcode-124-%E4%BA%8C%E5%8F%89%E6%A0%91%E4%B8%AD%E7%9A%84%E6%9C%80%E5%A4%A7%E8%B7%AF%E5%BE%84%E5%92%8C-Binary-Tree-Maximum-Path-Sum-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<loc>https://nicksxs.me/2022/02/27/Disruptor-%E7%B3%BB%E5%88%97%E4%BA%8C/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -305,11 +305,11 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/05/01/Leetcode-48-%E6%97%8B%E8%BD%AC%E5%9B%BE%E5%83%8F-Rotate-Image-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<loc>https://nicksxs.me/2021/07/04/Leetcode-42-%E6%8E%A5%E9%9B%A8%E6%B0%B4-Trapping-Rain-Water-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2020/08/06/Linux-%E4%B8%8B-grep-%E5%91%BD%E4%BB%A4%E7%9A%84%E4%B8%80%E7%82%B9%E5%B0%8F%E6%8A%80%E5%B7%A7/</loc>
<loc>https://nicksxs.me/2021/05/01/Leetcode-48-%E6%97%8B%E8%BD%AC%E5%9B%BE%E5%83%8F-Rotate-Image-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -317,7 +317,7 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/07/04/Leetcode-42-%E6%8E%A5%E9%9B%A8%E6%B0%B4-Trapping-Rain-Water-%E9%A2%98%E8%A7%A3%E5%88%86%E6%9E%90/</loc>
<loc>https://nicksxs.me/2020/08/06/Linux-%E4%B8%8B-grep-%E5%91%BD%E4%BB%A4%E7%9A%84%E4%B8%80%E7%82%B9%E5%B0%8F%E6%8A%80%E5%B7%A7/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -329,19 +329,19 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/04/18/rust%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/</loc>
<loc>https://nicksxs.me/2022/01/30/spring-event-%E4%BB%8B%E7%BB%8D/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2022/01/30/spring-event-%E4%BB%8B%E7%BB%8D/</loc>
<loc>https://nicksxs.me/2021/04/18/rust%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/</loc>
<loc>https://nicksxs.me/2021/12/05/wordpress-%E5%BF%98%E8%AE%B0%E5%AF%86%E7%A0%81%E7%9A%84%E4%B8%80%E7%A7%8D%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/12/05/wordpress-%E5%BF%98%E8%AE%B0%E5%AF%86%E7%A0%81%E7%9A%84%E4%B8%80%E7%A7%8D%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/</loc>
<loc>https://nicksxs.me/2021/03/07/%E3%80%8A%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AE%97%E6%B3%95%E6%89%8B%E5%86%8C%E8%AF%BB%E4%B9%A6%E3%80%8B%E7%AC%94%E8%AE%B0%E4%B9%8B%E6%95%B4%E7%90%86%E7%AE%97%E6%B3%95/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -361,15 +361,15 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/10/03/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E4%B8%89/</loc>
<loc>https://nicksxs.me/2021/09/12/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E4%BA%8C/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/09/19/%E8%81%8A%E4%B8%80%E4%B8%8B-SpringBoot-%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%9A%84-cglib-%E4%BD%9C%E4%B8%BA%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86%E4%B8%AD%E7%9A%84%E4%B8%80%E4%B8%AA%E6%B3%A8%E6%84%8F%E7%82%B9/</loc>
<loc>https://nicksxs.me/2021/10/17/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E5%9B%9B/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/09/12/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E4%BA%8C/</loc>
<loc>https://nicksxs.me/2021/09/19/%E8%81%8A%E4%B8%80%E4%B8%8B-SpringBoot-%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%9A%84-cglib-%E4%BD%9C%E4%B8%BA%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86%E4%B8%AD%E7%9A%84%E4%B8%80%E4%B8%AA%E6%B3%A8%E6%84%8F%E7%82%B9/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -377,31 +377,31 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/10/17/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E5%9B%9B/</loc>
<loc>https://nicksxs.me/2021/10/03/%E8%81%8A%E4%B8%80%E4%B8%8B-RocketMQ-%E7%9A%84%E6%B6%88%E6%81%AF%E5%AD%98%E5%82%A8%E4%B8%89/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2020/11/22/%E8%81%8A%E8%81%8A-Dubbo-%E7%9A%84%E5%AE%B9%E9%94%99%E6%9C%BA%E5%88%B6/</loc>
<loc>https://nicksxs.me/2021/06/27/%E8%81%8A%E8%81%8A-Java-%E4%B8%AD%E7%BB%95%E4%B8%8D%E5%BC%80%E7%9A%84-Synchronized-%E5%85%B3%E9%94%AE%E5%AD%97-%E4%BA%8C/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/06/27/%E8%81%8A%E8%81%8A-Java-%E4%B8%AD%E7%BB%95%E4%B8%8D%E5%BC%80%E7%9A%84-Synchronized-%E5%85%B3%E9%94%AE%E5%AD%97-%E4%BA%8C/</loc>
<loc>https://nicksxs.me/2020/11/22/%E8%81%8A%E8%81%8A-Dubbo-%E7%9A%84%E5%AE%B9%E9%94%99%E6%9C%BA%E5%88%B6/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/06/13/%E8%81%8A%E8%81%8A-Java-%E7%9A%84%E7%B1%BB%E5%8A%A0%E8%BD%BD%E6%9C%BA%E5%88%B6%E4%BA%8C/</loc>
<loc>https://nicksxs.me/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2020/08/02/%E8%81%8A%E8%81%8A-Java-%E8%87%AA%E5%B8%A6%E7%9A%84%E9%82%A3%E4%BA%9B%E9%80%86%E5%A4%A9%E5%B7%A5%E5%85%B7/</loc>
<loc>https://nicksxs.me/2021/12/26/%E8%81%8A%E8%81%8A-Sharding-Jdbc-%E7%9A%84%E7%AE%80%E5%8D%95%E5%8E%9F%E7%90%86%E5%88%9D%E7%AF%87/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2022/01/09/%E8%81%8A%E8%81%8A-Sharding-Jdbc-%E5%88%86%E5%BA%93%E5%88%86%E8%A1%A8%E4%B8%8B%E7%9A%84%E5%88%86%E9%A1%B5%E6%96%B9%E6%A1%88/</loc>
<loc>https://nicksxs.me/2021/04/04/%E8%81%8A%E8%81%8A-dubbo-%E7%9A%84%E7%BA%BF%E7%A8%8B%E6%B1%A0/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/03/28/%E8%81%8A%E8%81%8A-Linux-%E4%B8%8B%E7%9A%84-top-%E5%91%BD%E4%BB%A4/</loc>
<loc>https://nicksxs.me/2022/01/09/%E8%81%8A%E8%81%8A-Sharding-Jdbc-%E5%88%86%E5%BA%93%E5%88%86%E8%A1%A8%E4%B8%8B%E7%9A%84%E5%88%86%E9%A1%B5%E6%96%B9%E6%A1%88/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -409,11 +409,11 @@
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/12/26/%E8%81%8A%E8%81%8A-Sharding-Jdbc-%E7%9A%84%E7%AE%80%E5%8D%95%E5%8E%9F%E7%90%86%E5%88%9D%E7%AF%87/</loc>
<loc>https://nicksxs.me/2020/08/02/%E8%81%8A%E8%81%8A-Java-%E8%87%AA%E5%B8%A6%E7%9A%84%E9%82%A3%E4%BA%9B%E9%80%86%E5%A4%A9%E5%B7%A5%E5%85%B7/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2021/04/04/%E8%81%8A%E8%81%8A-dubbo-%E7%9A%84%E7%BA%BF%E7%A8%8B%E6%B1%A0/</loc>
<loc>https://nicksxs.me/2021/06/13/%E8%81%8A%E8%81%8A-Java-%E7%9A%84%E7%B1%BB%E5%8A%A0%E8%BD%BD%E6%9C%BA%E5%88%B6%E4%BA%8C/</loc>
<lastmod>2022-06-11</lastmod>
</url>
<url>
@ -788,20 +788,16 @@
<loc>https://nicksxs.me/2020/01/19/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E5%9B%9B/</loc>
<lastmod>2020-01-18</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2016/08/14/34-Search-for-a-Range/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/04/14/Add-Two-Number/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/</loc>
<loc>https://nicksxs.me/2016/08/14/34-Search-for-a-Range/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/03/11/Reverse-Bits/</loc>
<loc>https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
@ -809,11 +805,11 @@
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/03/13/Reverse-Integer/</loc>
<loc>https://nicksxs.me/2015/03/11/Reverse-Bits/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2016/09/29/binary-watch/</loc>
<loc>https://nicksxs.me/2015/03/13/Reverse-Integer/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
@ -821,7 +817,7 @@
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/01/14/Two-Sum/</loc>
<loc>https://nicksxs.me/2016/09/29/binary-watch/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
@ -832,6 +828,10 @@
<loc>https://nicksxs.me/2016/10/11/minimum-size-subarray-sum-209/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/01/14/Two-Sum/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2019/06/18/openresty/</loc>
<lastmod>2020-01-12</lastmod>
@ -861,7 +861,7 @@
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/03/11/Number-Of-1-Bits/</loc>
<loc>https://nicksxs.me/2015/04/15/Leetcode-No-3/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>
@ -869,7 +869,7 @@
<lastmod>2020-01-12</lastmod>
</url>
<url>
<loc>https://nicksxs.me/2015/04/15/Leetcode-No-3/</loc>
<loc>https://nicksxs.me/2015/03/11/Number-Of-1-Bits/</loc>
<lastmod>2020-01-12</lastmod>
</url>
<url>


+ 1
- 1
categories/docker/index.html
File diff suppressed because it is too large
View File


+ 122
- 0
code/Solution0034.java View File

@ -0,0 +1,122 @@
/**
* @author shixuesen
* @date 2023/6/18
*/
public class Solution0034 {
public int[] searchRange(int[] nums, int target) {
// 二分法查找但是尝试用两个数绑定作为一个元素
if (nums.length == 0) {
return new int[]{-1, -1};
}
if (nums.length == 1 && nums[0] == target) {
return new int[]{0, 0};
}
int left = 0, right = nums.length - 1;
int leftIndex = -1, rightIndex = -1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (nums[mid] == target) {
int subLeftIndex = - 1;
int subRightIndex = -1;
if (left <= mid - 1) {
subLeftIndex = findLeftIndex(nums, target, left, mid - 1);
}
if (mid + 1 <= right) {
subRightIndex = findRightIndex(nums, target, mid + 1, right);
}
if (subLeftIndex > -1 && subLeftIndex < mid) {
leftIndex = subLeftIndex;
} else {
leftIndex = mid;
}
if (subRightIndex > -1 && subRightIndex > mid) {
rightIndex = subRightIndex;
} else {
rightIndex = mid;
}
return new int[]{leftIndex, rightIndex};
} else if (nums[mid] < target) {
left = mid + 1;
} else {
right = mid - 1;
}
}
// if (leftIndex == -1) {
// return new int[]{-1, -1};
// }
return new int[]{-1, -1};
}
public int findLeftIndex(int[] nums, int target, int left, int right) {
int mid = left + (right - left) / 2;
int leftIndex = -1;
int currentLeftIndex = -1;
if (nums[mid] == target) {
leftIndex = mid;
if (leftIndex > 0) {
if (nums[leftIndex - 1] < target) {
return leftIndex;
} else {
currentLeftIndex = findLeftIndex(nums, target, left, mid - 1);
if (currentLeftIndex != -1 && currentLeftIndex < leftIndex) {
leftIndex = currentLeftIndex;
}
}
} else {
return leftIndex;
}
} else if (nums[mid] < target && left < right) {
return findLeftIndex(nums, target, mid + 1, right);
} else if (left < right){
return findLeftIndex(nums, target, left, mid - 1);
} else {
return leftIndex;
}
return leftIndex;
}
public int findRightIndex(int[] nums, int target, int left, int right) {
int mid = left + (right - left) / 2;
int rightIndex = -1;
int currentRightIndex = -1;
if (nums[mid] == target) {
rightIndex = mid;
if (rightIndex < nums.length - 1) {
if (nums[rightIndex + 1] > target) {
return rightIndex;
} else {
if (mid < right) {
currentRightIndex = findRightIndex(nums, target, mid + 1, right);
if (currentRightIndex != -1 && currentRightIndex > rightIndex) {
rightIndex = currentRightIndex;
}
} else {
return rightIndex;
}
}
} else {
return rightIndex;
}
} else if (nums[mid] < target && left < right && mid < right) {
return findRightIndex(nums, target, mid + 1, right);
} else if (left < right && mid > 0){
return findRightIndex(nums, target, left, mid - 1);
} else {
return rightIndex;
}
return rightIndex;
}
public static void main(String[] args) {
int[] nums = new int[] {1,4};
int target = 4;
int left = 0;
int right = nums.length - 1;
Solution0034 solution0034 = new Solution0034();
int[] res = solution0034.searchRange(nums, target);
System.out.println(res[0]);
System.out.println(res[1]);
}
}

+ 1
- 1
leancloud_counter_security_urls.json
File diff suppressed because it is too large
View File


+ 1
- 1
page/32/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
page/33/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
page/34/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
page/36/index.html
File diff suppressed because it is too large
View File


+ 2
- 2
page/37/index.html
File diff suppressed because it is too large
View File


+ 10638
- 10638
search.xml
File diff suppressed because it is too large
View File


+ 371
- 371
sitemap.xml
File diff suppressed because it is too large
View File


+ 1
- 1
tags/Dubbo/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
tags/Windows/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
tags/docker/index.html
File diff suppressed because it is too large
View File


+ 1
- 1
tags/php/index.html
File diff suppressed because it is too large
View File


Loading…
Cancel
Save