![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
xiaohuihuituboshu
这个作者很懒,什么都没留下…
展开
-
leetcode-无重复最长字串
算法分析: 1)使用滑动窗口算法。 /* 字符串 i到j中是否含有重复的字符 */ static bool IsUniqe(char *s, int i, int j) { int charSet[128] = {0}; /* ASCII码表共128个字符集 */ int index = 0; int setIndex = 0; for (index...原创 2020-05-04 20:32:23 · 146 阅读 · 0 评论 -
【leetcode-字符串编码】
给定一个经过编码的字符串,返回它解码后的字符串。 编码规则为: k[encoded_string],表示其中方括号内部的 encoded_string 正好重复 k 次。注意 k 保证为正整数。 你可以认为输入字符串总是有效的;输入字符串中没有额外的空格,且输入的方括号总是符合格式要求的。 此外,你可以认为原始数据不包含数字,所有的数字只表示重复的次数 k ,例如不会出现像3a或2[4...原创 2020-04-05 21:49:01 · 306 阅读 · 0 评论 -
【C语言】lucky string
【每天一道算法题】Lucky String A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters , output all its lucky non...原创 2020-03-29 16:25:40 · 262 阅读 · 0 评论 -
【数组】【leetcode-在指定的位置插入】
#include <stdio.h> #include <stdlib.h> #include <string.h> #if 0 /* 顺序遍历 */ int searchInsert(int* nums, int numsSize, int target) { int index = 0; int i = 0; if (nu...原创 2019-10-16 20:46:15 · 122 阅读 · 0 评论 -
【数组】【leetcode-只出现一次的数字】
给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 说明: 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗? 示例 1: 输入: [2,2,1] 输出: 1 示例2: 输入: [4,1,2,1,2] 输出: 4 实现说明-1: 1、首先对数组进行排序 2、一次遍历,两个一组判断数字是否相等,相等继续,不...原创 2019-10-01 21:21:14 · 96 阅读 · 0 评论