码迷,mamicode.com
首页 >  
搜索关键字:solution upgrade    ( 13024个结果
215. 数组中的第K个最大元素
题目链接:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 1 先快速排序,再取第 K个 class Solution { public int findKthLargest(int[] nums, int k) { ...
分类:编程语言   时间:2020-12-19 12:57:18    阅读次数:1
反三角函数(2)
\(\Large\displaystyle \int_0^{\infty} \frac{(1-x^2)\arctan x^2}{1+4x^2+x^4}\, {\rm d}x\) Solution What comes to mind is to maybe write the integrand a ...
分类:其他好文   时间:2020-12-19 12:54:59    阅读次数:1
Leetcode <136.只出现一次的数字>
题目:只出现一次的数字 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 示例 示例 1: 输入: [2,2,1] 输出: 1 示例 2: 输入: [4,1,2,1,2] 输出: 4 代码 class Solution: def singleNu ...
分类:其他好文   时间:2020-12-19 12:05:55    阅读次数:1
剑指 Offer 11. 旋转数组的最小数字
//二分查找法 class Solution { public int minArray(int[] numbers) { //定义左、右边界 int left = 0; int right = numbers.length - 1; while(left < right){ //中间的元素 int ...
分类:编程语言   时间:2020-12-18 12:13:52    阅读次数:2
LeetCode220. 存在重复元素 III
class Solution { public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) { /** * 本题与219题仅在判断部分有改动 * 时间复杂度O(nlogn) 空间复杂度O(k) */ TreeSet< ...
分类:其他好文   时间:2020-12-18 12:10:35    阅读次数:4
剑指 Offer 04. 二维数组中的查找
//暴力法 时间复杂度 O(m * n) //根据排序的规律观察,得到类似2叉搜索树的解法 O(m + n) class Solution { public boolean findNumberIn2DArray(int[][] matrix, int target) { //判空 if(matri ...
分类:编程语言   时间:2020-12-17 12:41:42    阅读次数:1
P6771 [USACO05MAR]Space Elevator 太空电梯
P6771 [USACO05MAR]Space Elevator 太空电梯 正当你dp的时候突然冒出个贪心. 初见:多重背包,不过取物品的时候要判断一下条件.数据范围还可以,但还是TLE了,甚至还有WA. 算一下可能的最大高度,Khc<=400000. #include <algorithm> #i ...
分类:其他好文   时间:2020-12-17 12:34:25    阅读次数:2
syslog
Logging to syslog from Your Script Problem You’d like your script to be able to log to syslog. Solution Use logger, Netcat, or bash’s built-in network ...
分类:其他好文   时间:2020-12-15 12:59:05    阅读次数:9
力扣#5 最长回文子串
1 class Solution { 2 public String longestPalindrome(String s) { 3 if(s.equals("")) return ""; 4 String origin = s; 5 String reverse = new StringBuffe ...
分类:其他好文   时间:2020-12-14 13:43:53    阅读次数:4
LeetCode 589. N叉树的前序遍历
589. N叉树的前序遍历 Difficulty: 简单 给定一个 N 叉树,返回其节点值的_前序遍历_。 例如,给定一个 3叉树 : 返回其前序遍历: [1,3,5,6,2,4]。 **说明: **递归法很简单,你可以使用迭代法完成此题吗? Solution Language: **** """ ...
分类:其他好文   时间:2020-12-14 13:21:17    阅读次数:3
13024条   上一页 1 ... 34 35 36 37 38 ... 1303 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!