![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 73
FunctionY
学生
展开
-
Trie Tree匹配算法实现
问题描述:给定一个字符串集合S={“abc”,“gghh”,“yefbgj”},设计并实现一个算法,找出给定文本中这些字符串(可以不连续出现,例如“abdcdshfkajhg”这个文本中就包含了“abc”)。一些多模式匹配算法如:AC算法,WM算法等,都是去寻找给定的文本中是否包含目标字符串,例如在一个网页中寻找多个敏感词。然而,寻找的敏感词必须在文本中是完整连续的。例如其中一个目标字符串为“原创 2017-10-11 14:18:06 · 908 阅读 · 0 评论 -
LeetCode-Medium-Java-Subarray Sum Equals K
和为k的连续子数组题目描述Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1,1,1], k = 2Output:原创 2017-11-07 10:17:28 · 220 阅读 · 0 评论 -
LeetCode-Medium-Java-Maximum Swap
Maximum Swap题目描述:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1:Input:原创 2017-09-18 10:40:08 · 409 阅读 · 0 评论 -
LeetCode-Easy-Java-Longest Continuous Increasing Subsequence
Longest Continuous Increasing Subsequence题目描述:Given an unsorted array of integers, find the length of longest continuous increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 3原创 2017-09-17 15:44:48 · 223 阅读 · 0 评论 -
LeetCode-Easy-Java——Array Partition I
Array Partition I题目描述Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for原创 2017-11-01 21:55:57 · 185 阅读 · 0 评论 -
LeetCode-Easy-Java-Non-decreasing Array
个人记录题目描述:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] holds原创 2017-08-30 16:41:38 · 214 阅读 · 0 评论 -
LeetCode-Easy-Java-Palindrome Number
判断整数是否是回文数个人记录题目描述:Determine whether an integer is a palindrome. Do this without extra space.(不使用额外的空间是指不能使用字符串,整形数组是否可以呢?)Some hints:Could negative integers be palindromes? (ie, -1)If you are thinkin...原创 2017-08-08 14:17:19 · 226 阅读 · 0 评论 -
LeetCode-Easy-Java-Longest Common Prefix
个人记录题目描述:Write a function to find the longest common prefix string amongst an array of strings.找字符串数组的最大前缀。大概思路就是以字符串数组中第一个元素为基准,与其他元素相比较。两种方法。一是将第一个元素分解为char数组,循环判断其他元素是否包含该字符。public cl原创 2017-08-08 16:07:40 · 254 阅读 · 0 评论 -
LeetCode-Easy-Java-Implement strStr()
个人记录题目描述:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.一道字符串处理的简单题目。返回needle在haystack中的位置,无则返回-1.java的话,原创 2017-08-21 16:51:21 · 194 阅读 · 0 评论 -
LeetCode-Easy-Java-Shortest Unsorted Continuous Subarray
题目描述:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You原创 2017-10-16 11:27:38 · 205 阅读 · 0 评论 -
LeetCode-Easy-Java-Maximum Average Subarray I
题目描述:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value.Example 1:原创 2017-09-22 14:18:14 · 246 阅读 · 0 评论 -
LeetCode-Easy部分-图像平滑器
题目描述:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all原创 2017-09-22 14:07:21 · 342 阅读 · 1 评论 -
LeetCode-Easy-Java-Count Binary Substrings
题目描述Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutive原创 2017-11-15 09:37:47 · 217 阅读 · 0 评论