随笔分类 -  LeetCode

摘要:KMP算法 KMP算法是一种改进的字符串匹配算法,由D.E.Knuth、J.H.Morris和V.R.Pratt提出的(简称KMP算法)。 KMP算法的核心是利用匹配失败后的信息,尽量减少模式串与主串的匹配次数以达到快速匹配的目的。具体实现就是通过一个next()函数实现,函数本身包含了模式串的局部 阅读全文
posted @ 2020-10-27 16:40 小清奈 阅读(100) 评论(0) 推荐(0)
摘要:141. 环形链表 Leetcode: https://leetcode cn.com/problems/linked list cycle/ 给定一个链表,判断链表中是否有环。 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 1 阅读全文
posted @ 2020-03-22 21:50 小清奈 阅读(200) 评论(0) 推荐(0)
摘要:一、题目要求 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes 阅读全文
posted @ 2019-01-13 22:49 小清奈 阅读(196) 评论(0) 推荐(0)
摘要:一、题目要求 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would 阅读全文
posted @ 2019-01-11 23:17 小清奈 阅读(161) 评论(0) 推荐(0)