- 博客(3)
- 收藏
- 关注
原创 Leetcode: 315. Count of Smaller Numbers After Self
Url : https://leetcode.com/problems/count-of-smaller-numbers-after-self/ You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i...
2019-03-31 20:00:24 172
原创 Leetcode:297. Serialize and Deserialize Binary Tree
url https://leetcode.com/problems/serialize-and-deserialize-binary-tree/ 本题使用层次遍历就行了,下面给出代码 /** * Definition for a binary tree node. */ static public class TreeNode { int val;...
2019-03-11 23:50:16 115
原创 Leetcode 295 Find Median from Data Stream
题目链接:https://leetcode.com/problems/find-median-from-data-stream/ 解题思路 既然是是找到中位数,我们就使用两个堆,一个是大顶堆,一个小顶堆,保证两个堆满足以下条件: 大顶堆的第一个元素需要小于小顶堆的第一个元素; 大顶堆的元素数量不能小于小顶堆且最多只能多一个元素; 满足以上条件,需要找中位数的时候,判断大顶堆是否比小顶堆元素多,如...
2019-03-02 13:24:19 133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人