合并K个有序链表。题目即是题意,例子, Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 1->1->2->3->4->4->5->6 这个题的最优解应该是用priority queue解决但是因为JS实现PQ太过麻烦,所以我这里给出次优解,用21 ...
分类:
其他好文 时间:
2020-01-29 10:48:10
阅读次数:
84
Given a m * n matrix mat of integers, sort it diagonally in ascending order from the top-left to the bottom-right then return the sorted array. Exampl ...
分类:
其他好文 时间:
2020-01-29 10:17:46
阅读次数:
61
链接: "LeetCode653" 给定一个二叉搜索树和一个目标结果,如果 BST 中存在两个元素且它们的和等于给定的目标结果,则返回 true。 相关标签: 哈希表 类似于求两数之和,我们只需要在遍历二叉树过程中寻找是否存在有数为k 已经遍历到的数即可。 代码如下: python: C++: ...
分类:
其他好文 时间:
2020-01-28 22:58:39
阅读次数:
75
题目 Given two strings S1 and S2, S = S1 – S2 is defined to be the remaining string afer taking all the characters in S2 from S1. Your task is simply to ...
分类:
其他好文 时间:
2020-01-28 21:02:59
阅读次数:
65
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i ...
分类:
其他好文 时间:
2020-01-28 17:32:43
阅读次数:
88
Redis系列 存储篇sorted set主要操作函数小结 redis支持有序集合,即sorted set。sorted set在set的基础上,增加了排序属性,是set的升级版。这里简要谈谈sorted set的常用函数: 1)insert a)zadd 2)select a)zrange b)z ...
分类:
其他好文 时间:
2020-01-28 13:58:40
阅读次数:
73
From Tutte institute for mathematics and computing Problem: dimension reduction Theoretical foundations: Methodology: Two phases. In the first phase, ...
分类:
移动开发 时间:
2020-01-27 23:45:17
阅读次数:
134
题目内容 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would ha ...
分类:
其他好文 时间:
2020-01-27 19:08:41
阅读次数:
65
题目如下: Given a m * n matrix mat of integers, sort it diagonally in ascending order from the top-left to the bottom-right then return the sorted array. ...
分类:
其他好文 时间:
2020-01-27 19:06:23
阅读次数:
72
题目如下: Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank has the following rul ...
分类:
其他好文 时间:
2020-01-27 19:03:33
阅读次数:
71