码迷,mamicode.com
首页 >  
搜索关键字:solution upgrade    ( 13024个结果)
leetcode-----33. 搜索旋转排序数组
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array/ 思路 找出两段;通过找出满足条件:第一段的数字都大于第一个数。 第一次二分找出分段点,第二次二分求解。 代码 class Solution { public: in ...
分类:编程语言   时间:2020-06-25 23:26:56    阅读次数:60
leetcode-----32. 最长有效括号
链接:https://leetcode-cn.com/problems/longest-valid-parentheses/ 思路 将整个序列分段,即刚刚不满足左括号数量大于等于右括号数量条件的情况;则任何一个合法序列在每个段内。 使用栈来存储位置。 代码 class Solution { publ ...
分类:其他好文   时间:2020-06-25 23:22:59    阅读次数:45
[题解] LuoguP5443 [APIO2019]桥梁
https://www.luogu.com.cn/problem/P5443 Solution 有一个显然的暴力,对于一个询问直接枚举$m$条边,如果边权$\ge w$就在并查集中合并。 答案就是$s$所在连通块的大小。对于修改,直接更改边的权值即可。 如果没有修改的话还可以将操作离线,排序后不断向 ...
分类:Windows程序   时间:2020-06-25 21:51:46    阅读次数:78
C++中输入一组不确定长度的数
使用cin.peek()判断输入的是否为换行 int main() { Solution a; vector<int> b; int c = 0; while(cin.peek() != '\n') { cin >> c; b.push_back(c); } cout << a.singleNumb ...
分类:编程语言   时间:2020-06-25 21:06:28    阅读次数:89
Python 安装与命令行参数 ,Pip 的命令参数--官方文档
python 解释器: 1、Python 命令行参数 --官方文档:https://docs.python.org/zh-cn/3/using/cmdline.html#options-you-shouldn-t-use 2、在Windows上使用 Python :https://docs.pyth ...
分类:编程语言   时间:2020-06-25 19:13:29    阅读次数:113
反转单链表
方法1: 迭代 时间复杂度:O(n) 空间复杂度:O(1) class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseList(self, head: ListNod ...
分类:其他好文   时间:2020-06-25 17:31:04    阅读次数:44
相交链表判断
方法1: 哈希表 时间复杂度:O(m+n) 空间复杂度:O(m)或O(n) class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def getIntersectionNode(sel ...
分类:其他好文   时间:2020-06-25 15:46:32    阅读次数:40
Leetcode: 1434. Number of Ways to Wear Different Hats to Each Other
Descpition There are n people and 40 types of hats labeled from 1 to 40. Given a list of list of integers hats, where hats[i] is a list of all hats pr ...
分类:其他好文   时间:2020-06-25 13:58:26    阅读次数:56
generateParenthesis
原题解法: 22. 括号生成 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。 示例: 输入:n = 3 输出:[ "((()))", "(()())", "(())()", "()(())", "()()()" ] class Solution { L ...
分类:其他好文   时间:2020-06-25 12:05:12    阅读次数:45
455. 分发饼干
https://leetcode-cn.com/problems/assign-cookies/ 假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,每个孩子最多只能给一块饼干。对每个孩子 i ,都有一个胃口值 gi ,这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 j ,都有一个尺寸 ...
分类:其他好文   时间:2020-06-25 11:45:29    阅读次数:86
共13024条   上一页 1 ... 80 81 82 83 84 ... 1303 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!