![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
seconp
帅气、阳光、活泼的程序员。
展开
-
LeetCode_220
Given an array of integers, find out whether there are two distinct indicesiandjin the array such that theabsolutedifference betweennums[i]andnums[j]is at mosttand theabsolutedifference betweeniandjis at mostk.Example 1:Input: nums ...原创 2020-06-21 14:05:46 · 388 阅读 · 0 评论 -
String.java中contains方法
讲真,本人很好奇,为什么kmp算法那么快,在String的contains方法中却没有使用这中算法。为什么java String.contains 没有使用类似KMP字符串匹配算法进行优化?这里有提到虽然kmp算法在时间复杂度上让人满意,但是面向公众的时候,kmp算法所带来的空间消耗是没有当前(2020年使用的jdk1.8)算法好的。话不多说,带着求知的心探索一下目前contains使用的算法。/** * Code shared by String and StringBuffe原创 2020-06-21 11:22:14 · 1292 阅读 · 1 评论