码迷,mamicode.com
首页 >  
搜索关键字:kth largest    ( 1961个结果
PyTorch常用函数:torch.topk; torch.index_select; torch.lt
torch.topk torch.topk(input, k, dim=None, largest=True, sorted=True, out=None) -> (Tensor, LongTensor) pytorch中文官网文档:http://www.mamicode.com/info-deta ...
分类:其他好文   时间:2020-03-14 22:02:14    阅读次数:101
230. Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note:You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:其他好文   时间:2020-03-12 10:13:11    阅读次数:82
152. Maximum Product Subarray
Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has the largest product 6. Input: [2,-5,-2,-4,3] Output: 24 Explanation: [-2,-4,3] has the largest prod ...
分类:其他好文   时间:2020-03-07 13:08:31    阅读次数:54
剑指offer 62.二叉搜索树的第k个结点
剑指offer 62.二叉搜索树的第k个结点 题目 给定一棵二叉搜索树,请找出其中的第k小的结点。例如, (5,3,7,2,4,6,8) 中,按结点数值大小顺序第三小结点的值为4。 思路 二叉搜索树的中序遍历是递增的,找到第k小的话,那就只需要中序遍历即可,遍历的第k个数就是所需的数。 代码 ...
分类:其他好文   时间:2020-03-06 15:37:32    阅读次数:53
LeetCode练题——53. Maximum Subarray
1、题目 Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. In Pascal's ...
分类:其他好文   时间:2020-03-02 01:09:35    阅读次数:82
LeetCode976 三角形的最大周长(Java排序简单应用-防自闭题)
题目: 给定由一些正数(代表长度)组成的数组 A,返回由其中三个长度组成的、面积不为零的三角形的最大周长。 如果不能形成任何面积不为零的三角形,返回 0。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/largest-perimeter-tr ...
分类:编程语言   时间:2020-02-29 22:30:56    阅读次数:136
剑指offer 14.链表中倒数第k个结点
14.链表中倒数第k个结点 题目 输入一个链表,输出该链表中倒数第k个结点。 思路 假设原链表有n个结点,倒数第k个结点就是n k+1个结点,那么这里可以设置两个结点,一个结点先走k 1步,是第k个结点,然后两个结点一起走,第一个结点再走n k步就到达末尾,此时第二个结点也走了n k步,到达了n k ...
分类:其他好文   时间:2020-02-28 11:44:10    阅读次数:44
368. 最大整除子集
题目: 链接:https://leetcode-cn.com/problems/largest-divisible-subset/ 给出一个由无重复的正整数组成的集合,找出其中最大的整除子集,子集中任意一对 (Si,Sj) 都要满足:Si % Sj = 0 或 Sj % Si = 0。 如果有多个目 ...
分类:其他好文   时间:2020-02-26 01:33:16    阅读次数:56
【14】N的二进制中1的个数
``` class Solution { public int findKthLargest(int[] nums, int k) { PriorityQueue h = new PriorityQueue((n1,n2)->n1-n2); for(int i:nums){ h.add(i); if... ...
分类:其他好文   时间:2020-02-24 00:46:36    阅读次数:80
LeetCode 215. Kth Largest Element in an Array(排序)
"题目" 题意:找到一个数组里第K大的数字。 题解:我们当然可以排序好了,之后,选择第K大的数字。但是这样做一点技术含量也没有。 排序算法选用快排。寻找第K大的数字,不必把数组完全排完序之后,再找第K大。快排中是选取一个数字,把大于它的放在右边,小于它的放在左边,在递归的时候,我们判断k 和右边数字 ...
分类:编程语言   时间:2020-02-22 13:39:48    阅读次数:58
1961条   上一页 1 ... 9 10 11 12 13 ... 197 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!