
数据结构
文章平均质量分 70
sscssz
这个作者很懒,什么都没留下…
展开
-
203. Remove Linked List Elements【E】【70】【leetcode】
Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5Credits:Special thank原创 2016-03-19 15:19:35 · 707 阅读 · 0 评论 -
【LeetCode】508. Most Frequent Subtree Sum【M】【40】
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (includi原创 2017-02-22 13:34:02 · 570 阅读 · 0 评论 -
【LeetCode】515. Find Largest Value in Each Tree Row【E】【87】
You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]Subsc原创 2017-02-19 18:37:01 · 1305 阅读 · 0 评论 -
【LeetCode】451. Sort Characters By Frequency【M】【68】
Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twice while 'r' and 't' both appear once.So 'e原创 2017-02-19 10:30:50 · 459 阅读 · 0 评论 -
【leetcode】447. Number of Boomerangs【E】
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of t原创 2016-11-07 23:32:20 · 2391 阅读 · 0 评论 -
【leetcode】438. Find All Anagrams in a String【E】
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be lar原创 2016-10-27 10:53:41 · 1333 阅读 · 0 评论 -
【leetcode】398. Random Pick Index【M】
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c原创 2016-09-13 09:52:02 · 1327 阅读 · 0 评论 -
【leetcode】378. Kth Smallest Element in a Sorted Matrix【M】【88ms】
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, not t原创 2016-08-01 21:46:14 · 1743 阅读 · 0 评论 -
【leetcode】146. LRU Cache【H】【9】
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if原创 2016-06-08 13:20:42 · 573 阅读 · 0 评论 -
106. Construct Binary Tree from Inorder and Postorder Traversal【M】【31】
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Subscribe to see which companies asked this原创 2016-06-07 15:13:21 · 348 阅读 · 0 评论 -
105. Construct Binary Tree from Preorder and Ignorer Traversal【M】【35】【再来一遍】
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Subscribe to see which companies asked this q原创 2016-06-07 14:58:21 · 567 阅读 · 0 评论 -
295. Find Median from Data Stream【H】【2.7】
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.Examples: [2,3,4] , the me原创 2016-06-02 09:14:17 · 367 阅读 · 0 评论 -
347. Top K Frequent Elements【M】【VIP】【字典排序】
Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number原创 2016-05-09 14:58:23 · 477 阅读 · 0 评论 -
341. Flatten Nested List Iterator【M】【42】
Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose elements may also be integers or other lists.Example 1:Given the list [原创 2016-05-31 13:26:27 · 629 阅读 · 0 评论 -
208. Implement Trie (Prefix Tree)【58】【M】
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.Subscribe to see which companies asked this原创 2016-05-27 16:06:59 · 286 阅读 · 0 评论 -
49. Group Anagrams 【M】【47】
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note:原创 2016-04-29 17:30:43 · 396 阅读 · 0 评论 -
1. Two Sum【E】【59+25】【leetcode】
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 have exactly one solution.Example:Given nums =原创 2016-03-21 13:09:46 · 547 阅读 · 0 评论 -
2. Add Two Numbers 【M】【72】【leetcode】
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link原创 2016-03-31 17:48:41 · 332 阅读 · 0 评论 -
103. Binary Tree Zigzag Level Order Traversal【M】
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary原创 2017-03-29 10:09:58 · 431 阅读 · 0 评论