Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. Example: 380. Insert Delete ...
分类:
其他好文 时间:
2019-01-03 16:38:26
阅读次数:
127
leecode刷题(8) 两数之和 两数之和 描述: 给定一个整数数组 和一个目标值 ,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], t ...
分类:
其他好文 时间:
2019-01-02 23:33:39
阅读次数:
228
Problem: Given a set of words (without duplicates), find all word squares you can build from them. A sequence of words forms a valid word square if th ...
分类:
其他好文 时间:
2019-01-01 14:05:31
阅读次数:
198
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, ...
分类:
其他好文 时间:
2019-01-01 11:14:07
阅读次数:
143
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define ...
分类:
其他好文 时间:
2018-12-30 20:18:07
阅读次数:
186
Shuffle a set of numbers without duplicates. Example: Runtime: 244 ms, faster than 36.91% of C++ online submissions for Shuffle an Array. ...
分类:
其他好文 时间:
2018-12-30 02:32:35
阅读次数:
201
leecode刷题(3) 旋转数组 旋转数组 给定一个数组,将数组中的元素向右移动 K 个位置,其中 K 是非负数。 示例: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: ...
分类:
编程语言 时间:
2018-12-27 15:25:46
阅读次数:
162
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: time: O(n), space: O(1) ...
分类:
其他好文 时间:
2018-12-27 10:23:57
阅读次数:
118
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. ...
分类:
其他好文 时间:
2018-12-03 22:58:00
阅读次数:
245
https://leetcode.com/problems/summary-ranges/ Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Example 2: ...
分类:
其他好文 时间:
2018-12-02 19:16:40
阅读次数:
209