码迷,mamicode.com
首页 >  
搜索关键字:leetcode easy    ( 39612个结果
[leetcode] 单调栈
本文总结单调栈算法。 原问题 学习一个算法,我们需要清楚的是:这个算法最原始的问题背景是什么样的? 下一个更小元素 给定一个数组 nums,返回每个元素的下一个更小的元素的下标 res,即 res[i] 记录的是 nums[i] 右端第一个比它小的元素的下标(不存在则为 -1 )。 例如 nums ...
分类:其他好文   时间:2021-04-06 14:47:38    阅读次数:0
LeetCode第235场周赛题解
LeetCode第235场周赛题解 截断句子 按照题目要求模拟即可,把单词读入到vector中,然后按要求拼接即可 class Solution { public: string truncateSentence(string s, int k) { vector<string> a; string ...
分类:其他好文   时间:2021-04-06 14:34:00    阅读次数:0
【LeetCode-415】字符串相加
问题 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。 提示: num1 和num2 的长度都小于 5100 num1 和num2 都只包含数字 0-9 num1 和num2 都不包含任何前导零 你不能使用任何內建 BigInteger 库, 也不能直接将输入的字符串转换为整数形 ...
分类:其他好文   时间:2021-04-06 14:29:11    阅读次数:0
LeetCode1
解法1 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: dit = {} for i in range(len(nums)): other = target - nums[i] if other ...
分类:其他好文   时间:2021-04-06 14:26:04    阅读次数:0
[LeetCode] 781. Rabbits in Forest
In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Th ...
分类:其他好文   时间:2021-04-06 14:17:51    阅读次数:0
31. 下一个排列 + 双指针 + 思维
31. 下一个排列 LeetCode_31 题目描述 题解分析 代码实现 class Solution { public void nextPermutation(int[] nums) { int i = nums.length - 2; while(i >= 0 && nums[i] >= nu ...
分类:其他好文   时间:2021-04-06 14:03:32    阅读次数:0
LeetCode——412. Fizz Buzz
题目描述 题干: 写一个程序,输出从 1 到 n 数字的字符串表示。 1. 如果 n 是3的倍数,输出“Fizz”; 2. 如果 n 是5的倍数,输出“Buzz”; 3.如果 n 同时是3和5的倍数,输出 “FizzBuzz”。 实例: n = 15, 返回: [ "1", "2", "Fizz", ...
分类:其他好文   时间:2021-04-05 12:31:23    阅读次数:0
LeetCode—数组中数字出现的次数
今天刷力扣遇到了这样的问题: 一个整型数组 nums 里除两个数字之外,其他数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度是O(n),空间复杂度是O(1)。 之前没有遇到过类似的题型,看到之后很懵,看了题解才知道要用到分组异或的方式进行分组。题解又看了十分钟才终于理解解法的含义 ...
分类:编程语言   时间:2021-04-05 12:23:52    阅读次数:0
百亿数据,毫秒级返回,如何设计?--浅谈实时索引构建之道
本文已整理致我的 github 地址 https://github.com/allentofight/easy-cs,欢迎大家 star 支持一下 前言 近年来公司业务迅猛发展,数据量爆炸式增长,随之而来的的是海量数据查询等带来的挑战,我们需要数据量在十亿,甚至百亿级别的规模时依然能以秒级甚至毫秒级 ...
分类:其他好文   时间:2021-04-05 12:21:59    阅读次数:0
Leetcode 524. Longest Word in Dictionary through Deleting
Description: Given a string s and a string array dictionary, return the longest string in the dictionary that can be formed by deleting some of the gi ...
分类:其他好文   时间:2021-04-05 12:21:20    阅读次数:0
39612条   上一页 1 ... 24 25 26 27 28 ... 3962 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!