码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
【LeetCode-274】H指数
问题 给定一位研究者论文被引用次数的数组(被引用次数是非负整数)。编写一个方法,计算出研究者的 h 指数。 h 指数的定义: “h 代表“高引用次数”(high citations),一名科研人员的 h 指数是指他(她)的 (N 篇论文中)至多有 h 篇论文分别被引用了至少 h 次。(其余的 N - ...
分类:其他好文   时间:2021-02-08 12:31:13    阅读次数:0
【LeetCode-999】可以被一步捕获的棋子数
问题 在一个 8 x 8 的棋盘上,有一个白色车(rook)。也可能有空方块,白色的象(bishop)和黑色的卒(pawn)。它们分别以字符 “R”,“.”,“B” 和 “p” 给出。大写字符表示白棋,小写字符表示黑棋。 车按国际象棋中的规则移动:它选择四个基本方向中的一个(北,东,西和南),然后朝 ...
分类:其他好文   时间:2021-02-08 12:30:55    阅读次数:0
is_sorted
leetcode打卡 题面 class Solution { public: bool checkPossibility(vector<int> &nums) { int n = nums.size(); for (int i = 0; i < n - 1; ++i) { int x = nums[ ...
分类:其他好文   时间:2021-02-08 12:11:43    阅读次数:0
Leetcode - Gas Station
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and i ...
分类:其他好文   时间:2021-02-08 11:44:08    阅读次数:0
LeetCode 34. 在排序数组中查找元素的第一个和最后一个位置
34. 在排序数组中查找元素的第一个和最后一个位置 Difficulty: 中等 给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 如果数组中不存在目标值 target,返回 [-1, -1]。 进阶: 你可以设计并实现时间复杂度为  ...
分类:编程语言   时间:2021-02-08 11:42:16    阅读次数:0
leetcode一些细节
取数组中点时不要写 int mid = (left + right) // 2;,「这么写有一个问题:数值越界,例如left和right都是最大int,这么操作就越界了,在二分法中尤其需要注意!」 所以可以这么写:int mid = left + ((right - left) // 2); ...
分类:其他好文   时间:2021-02-06 12:01:21    阅读次数:0
leetcode-剑指44-OK
// language C with STL(C++) // 剑指44 // https://leetcode-cn.com/problems/shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi-lcof/ // 同主站400题 // https://leetcode- ...
分类:其他好文   时间:2021-02-06 11:54:26    阅读次数:0
leetcode 关于重复问题
数组重复元素之类问题的整理 lt26 删除排序数组重复项 主要是原地删除,O(1) 空间,很是巧妙 func removeDuplicates(nums []int) int { //O(1)空间复杂 if len(nums)==0{ return 0 } tmp:=0 //不同,tmp+1,放在相 ...
分类:其他好文   时间:2021-02-06 11:42:42    阅读次数:0
Leetcode 634 子数组最大平均数
题目定义: 给定 n 个整数,找出平均数最大且长度为 k 的连续子数组,并输出该最大平均数。 示例: 输入:[1,12,-5,-6,50,3], k = 4 输出:12.75 解释:最大平均数 (12-5-6+50)/4 = 51/4 = 12.75 方式一(滑动窗口): class Solutio ...
分类:编程语言   时间:2021-02-04 12:26:35    阅读次数:0
leetcode643.滑动窗口例题
643 of leetcode class Solution { public: double findMaxAverage(vector<int>& nums, int k) { double len=nums.size(); double sum_now=0; double sum_max=0; ...
分类:其他好文   时间:2021-02-04 12:24:48    阅读次数:0
34993条   上一页 1 ... 36 37 38 39 40 ... 3500 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!