码迷,mamicode.com
首页 >  
搜索关键字:first firstordefault    ( 14152个结果
深度优先遍历和广度优先遍历
深度优先遍历(Depth First Search): 自顶点起, 往下一个邻近点走,一直走,走不动了,退回一部。这样反复; /*深度优先遍历三种方式*/ let deepTraversal1 = (node, nodeList = []) => { if (node !== null) { nod ...
分类:其他好文   时间:2020-02-07 22:23:41    阅读次数:68
[CF888G]Xor-MST
"G Xor MST" 题解 最小异或生成树 先把所有二进制数上Trie树,然后为了使得异或最小,根据异或的性质,trie树的左右子树都应该自己先连成一个连通块,然后在两个连通块内找到两个数使得异或值最小,这样就能进行连通了。 左右子树的话递归下去处理,在计算两个子树上异或值最小的时候用启发式合并, ...
分类:其他好文   时间:2020-02-07 22:16:54    阅读次数:84
leetcode21 Merge Two Sorted Lists
1 """ 2 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. ...
分类:其他好文   时间:2020-02-07 18:47:24    阅读次数:67
leetcode24 Swap Nodes in Pairs
1 """ 2 Given a linked list, swap every two adjacent nodes and return its head. 3 You may not modify the values in the list's nodes, only nodes itself ...
分类:其他好文   时间:2020-02-07 18:27:44    阅读次数:58
mysql的group by优化跟limit优化
优化group by查询: explain SELECT actor.first_name, actor.last_name, COUNT( ) from sakila.film_actor INNER JOIN sakila.actor USING(actor_id) GROUP BY film_ ...
分类:数据库   时间:2020-02-07 16:56:51    阅读次数:76
python - 数据结构
数据结构(Data Structures)人如其名,只是一种结构,能够将一些数据聚合在一起。换句话说,它们是用来存储一系列相关数据的集合。python中有四种内置的数据结构: 列表(list) 元组(tuple) 字典(dictionary) 集合(set) 另外,讲解以下三部分内容: 序列 引用 ...
分类:编程语言   时间:2020-02-07 14:56:39    阅读次数:88
find the leftmost column that has number 1
Given a matrix, like this[[0, 0, 1, 1, 1][0, 1, 1, 1, 1][0, 0, 1, 1, 1][0, 0, 0, 0, 0]]each cell is either 1 or 0in each row, from left to right, when ...
分类:其他好文   时间:2020-02-07 13:14:09    阅读次数:85
0207今天是15的一天冲鸭
歧路亡羊是目前的很大敌人,故,统一处理,集中兵力成了我最重要的事情,但凡学习必须专注,否则宁可不学,只有投入和专注才能真正打赢这场仗 疑问: 1.sort函数的[] 优点: 1.从1开始回减,有效控制范围 class Solution { public: bool canAttendMeetings ...
分类:其他好文   时间:2020-02-07 12:51:30    阅读次数:59
dij-堆优化
题目描述 给定一个n个点m条边的有向图,图中可能存在重边和自环,所有边权均为非负值。 请你求出1号点到n号点的最短距离,如果无法从1号点走到n号点,则输出-1。 输入格式 第一行包含整数n和m。 接下来m行每行包含三个整数x,y,z,表示存在一条从点x到点y的有向边,边长为z。 输出格式 输出一个整 ...
分类:其他好文   时间:2020-02-06 19:37:06    阅读次数:106
Codeforces #617 (Div. 3) D. Fight with Monsters(贪心,排序)
There are nn monsters standing in a row numbered from 11 to nn . The ii -th monster has hihi health points (hp). You have your attack power equal to a ...
分类:编程语言   时间:2020-02-06 16:24:55    阅读次数:146
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!