上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 108 下一页

2021年9月24日

摘要: 地址 https://leetcode-cn.com/problems/range-sum-query-mutable/ 给你一个数组 nums ,请你完成两类查询,其中一类查询要求更新数组下标对应的值,另一类查询要求返回数组中某个范围内元素的总和。 实现 NumArray 类: NumArray( 阅读全文
posted @ 2021-09-24 11:31 itdef 阅读(29) 评论(0) 推荐(0) 编辑

2021年9月21日

摘要: 地址 https://www.luogu.com.cn/problem/P3375 解法 KMP模板 #include<iostream> #include<cstring> using namespace std; const int N = 1000010, M = 1000010; int n 阅读全文
posted @ 2021-09-21 14:29 itdef 阅读(29) 评论(0) 推荐(0) 编辑

2021年9月19日

摘要: 这里分享下我学习KMP的心得 KMP算法是三位计算机科学家发明的字符串匹配算法。 从暴力逐个比对到最大公共前后缀优化 next数组 假设已经得到next数组,使用数组进行字符串匹配的流程如上,代码如下 const int N = 100010, M = 1000010; int n, m; int 阅读全文
posted @ 2021-09-19 17:38 itdef 阅读(97) 评论(0) 推荐(0) 编辑

2021年9月12日

摘要: 地址 https://leetcode-cn.com/problems/search-a-2d-matrix-ii/ 编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target 。该矩阵具有以下特性: 每行的元素从左到右升序排列。 每列的元素从上到下升序排列。 示例 1: 阅读全文
posted @ 2021-09-12 21:10 itdef 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 地址 https://leetcode-cn.com/problems/summary-ranges/ 给定一个无重复元素的有序整数数组 nums 。 返回 恰好覆盖数组中所有数字 的 最小有序 区间范围列表。 也就是说,nums 的每个元素都恰好被某个区间范围所覆盖,并且不存在属于某个范围但不属于 阅读全文
posted @ 2021-09-12 11:16 itdef 阅读(39) 评论(0) 推荐(0) 编辑

2021年9月11日

摘要: 地址 https://leetcode-cn.com/problems/combination-sum-iii/ 找出所有相加之和为 n 的 k 个数的组合。组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。 说明: 所有数字都是正整数。 解集不能包含重复的组合。 示例 1: 阅读全文
posted @ 2021-09-11 09:44 itdef 阅读(34) 评论(0) 推荐(0) 编辑

2021年9月4日

摘要: 地址 https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 给定整数数组 nums 和整数 k,请返回数组中第 k 个最大的元素。 请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。 示例 阅读全文
posted @ 2021-09-04 21:26 itdef 阅读(88) 评论(0) 推荐(0) 编辑

2021年8月29日

摘要: 地址 https://leetcode-cn.com/problems/design-add-and-search-words-data-structure/ 请你设计一个数据结构,支持 添加新单词 和 查找字符串是否与任何先前添加的字符串匹配 。 实现词典类 WordDictionary : Wo 阅读全文
posted @ 2021-08-29 20:56 itdef 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 地址 https://leetcode-cn.com/problems/implement-trie-prefix-tree/ Trie(发音类似 "try")或者说 前缀树 是一种树形数据结构,用于高效地存储和检索字符串数据集中的键。这一数据结构有相当多的应用情景,例如自动补完和拼写检查。 请你实 阅读全文
posted @ 2021-08-29 19:05 itdef 阅读(217) 评论(0) 推荐(0) 编辑

2021年8月28日

摘要: 地址 https://leetcode-cn.com/problems/minimum-size-subarray-sum/ 给定一个含有 n 个正整数的数组和一个正整数 target 。 找出该数组中满足其和 ≥ target 的长度最小的 连续子数组 [numsl, numsl+1, ..., 阅读全文
posted @ 2021-08-28 13:26 itdef 阅读(55) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 108 下一页

导航