最长连续序列(困难) 题目叙述: 给定一个未排序的整数数组,找出最长连续序列的长度。 要求算法的时间复杂度为 O(n)。 示例: 输入: [100, 4, 200, 1, 3, 2] 输出: 4 解释: 最长连续序列是 …
分类:LeetCode
[LeetCode] Meeting Rooms 会议室
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...]&n…
[LeetCode] Bulb Switcher II 灯泡开关之二
There is a room with n lights which are turned on initially and 4 buttons on the wall. After …
[LeetCode] Map Sum Pairs 映射配对之和
Implement a MapSum class with insert, and sum methods. For the method insert, you…
LeetCode | Pascal's Triangle
题目: Given numRows, generate the first numRows of Pascal’s triangle. For example, given&nb…
LeetCode | Convert Sorted Array to Binary Search Tree(有序数组转换成平衡二叉树搜索树)
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目解析: 给定一个有序…
LC-mysql-180(consecutive numbers)
本SQL问题是 #180. Consecutive Numbers 问题 编写SQL,找出至少连续出现三次的所有数字 Tips: 借助一个游标变量@cu来记录重复次数 select distinct(p.Num) as …
【LeetCode】- Merge Interval (区间合并)
1、题目描述 Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10]…
【LeetCode】- Minimum Window Substirng(最小区间,双指针问题)
1、题目描述 Given a string S and a string T, find the minimum window in S which will contain all the characters in …
297. Serialize and Deserialize Binary Tree
hard 不会,抄的讨论区比较好理解的解法:注意这里我们并不需要把tree serializ成多么完美的表达,比如最后的,这些完全不用处理。目的很简单,能deserialize回来就可以了。 比如一棵单节点val = 1…
LeetCode[2] - Merge K Sorted Lists
事情是这样的。今天李特除了一题,据说是Hard。 我一看好像曾经见过,于是做了做,时间复杂度最后大约是O(kn)*O(logn). 因为用到了PriorityQueue, 里面的offer() 和 poll()都是O(l…
119. Pascal's Triangle II
欢迎fork and star:Nowcoder-Repository-github 119. Pascal’s Triangle II 题目 Given an index k, return the kth…