![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LCode
文章平均质量分 53
YangLJ123654
这个作者很懒,什么都没留下…
展开
-
求最长不重复子串---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 · 264 阅读 · 0 评论 -
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 · 182 阅读 · 0 评论 -
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 · 161 阅读 · 0 评论 -
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 · 286 阅读 · 0 评论 -
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 · 222 阅读 · 0 评论 -
寻找TopN——在10亿数据中找到1000个最大的数
寻找TopN——在10亿数据中找到1000个最大的数目录问题描述解法补充目录问题描述如何从10亿数据中找到前1000大的数?解法针对该问题,给定一个数组data,从中找出前n个最大的数。解题思路先维护一个具有n个数的堆,然后调整该堆为小顶堆,即每个父节点都比其子节点小。然后从剩下的数组中逐一读取数据,将读取到的数据跟堆顶比较。如果该数比堆顶小,直接丢弃;如果该数比堆顶数大,则用该数替...原创 2018-10-23 18:59:18 · 4501 阅读 · 1 评论 -
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 · 124 阅读 · 0 评论 -
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 · 275 阅读 · 0 评论