- 博客(15)
- 收藏
- 关注
原创 [leetcode] 219. Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the difference between i and j is at most k.这
2016-08-22 15:53:45 277
原创 [leetcode] 381. Insert Delete GetRandom O(1) - Duplicates allowed
Design a data structure that supports all following operations in average O(1) time.Note: Duplicate elements are allowed.insert(val): Inserts an item val to the collection.remove(val): Remov
2016-08-19 16:47:31 1647 4
原创 [leetcode] 217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is
2016-08-18 15:58:50 230
原创 [leetcode] 384. Shuffle an Array
Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return
2016-08-17 16:32:44 1747
原创 [leetcode] 380. Insert Delete GetRandom O(1)
Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the set if not already present.remove(val): Removes an item val from the
2016-08-16 15:36:27 1510
原创 [leetcode] 385. Mini Parser
Given a nested list of integers represented as a string, implement a parser to deserialize it.Each element is either an integer, or a list -- whose elements may also be integers or other lists.
2016-08-15 17:17:59 1691
原创 [leetcode] 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constru
2016-08-11 15:52:41 1575
原创 [leetcode] 382. Linked List Random Node
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely large and i
2016-08-10 16:41:06 1099
原创 [leetcode] 26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2016-08-09 15:37:34 283
原创 [leetcode] 126. Word Ladder II
Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a timeEac
2016-08-08 17:30:52 536
原创 [leetcode] 110. Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofevery node never differ
2016-08-05 15:33:36 292
原创 [leetcode] 127. Word Ladder
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed at a
2016-08-04 17:40:45 419 6
原创 [leetcode] 258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only
2016-08-03 16:15:00 238
原创 [leetcode] 378. Kth Smallest Element in a Sorted Matrix
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
2016-08-02 16:38:33 2926
原创 [leetcode] 44. Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t
2016-08-01 17:45:31 331
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人