自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

翻译 LRU Cache---Leetcode146

问题描述Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be positive) of the key i...

2018-11-22 23:30:02 272

原创 Implement Queue using Stacks---LeetCode232

目录问题描述Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue.pop() – Removes the element from in front of queue.peek() – Get the front element.e...

2018-11-01 21:20:16 122

原创 寻找TopN——在10亿数据中找到1000个最大的数

寻找TopN——在10亿数据中找到1000个最大的数目录问题描述解法补充目录问题描述如何从10亿数据中找到前1000大的数?解法针对该问题,给定一个数组data,从中找出前n个最大的数。解题思路先维护一个具有n个数的堆,然后调整该堆为小顶堆,即每个父节点都比其子节点小。然后从剩下的数组中逐一读取数据,将读取到的数据跟堆顶比较。如果该数比堆顶小,直接丢弃;如果该数比堆顶数大,则用该数替...

2018-10-23 18:59:18 4500 1

原创 Shortest Word Distance---LeetCode243

题目描述/** * Shortest Word Distance—LeetCode243 * Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. * 给定一个数组和两个单词word1,word2,返回两者

2017-11-09 19:53:11 284

原创 Max Consecutive Ones---LeetCode485

题目描述Given a binary array, find the maximum number of consecutive 1s in this array. 求最长连续1的个数:给定一个二进制数组,求出最长连续的1的个数 Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or th

2017-11-09 11:04:25 159

原创 Reshape the Matrix---LeetCode566

题目描述In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.You’re given a matrix represented by a two-dime

2017-11-06 20:50:11 181

原创 Two Sum II - Input array is sorted---LeetCode167

题目描述: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numb

2017-10-26 19:18:48 218

转载 求最长不重复子串---LeetCode3

Longest Substring Without Repeating Characters题目描述 Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which the l

2017-10-18 12:35:39 263

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除