码迷,mamicode.com
首页 >  
搜索关键字:elements    ( 4737个结果
Convert Sorted List to Balanced Binary Search Tree (BST)
(http://leetcode.com/2010/11/convert-sorted-list-to-balanced-binary.html)Given a singly linked list where elements are sorted in ascending order, conv...
分类:其他好文   时间:2015-01-18 22:18:49    阅读次数:202
[leetcode] 18 4Sum
问题描述: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note:...
分类:其他好文   时间:2015-01-18 21:09:04    阅读次数:140
【leetcode】Convert Sorted List to Binary Search Tree (middle)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路:题目看上去好像很难,但实际上很简单,递归做就行,每次找到左右子树对应的子链表...
分类:其他好文   时间:2015-01-18 21:03:17    阅读次数:241
UVA Simple calculations (数学推导)
Simple calculations  The Problem There is a sequence of n+2 elements a0, a1,…, an+1 (n i 1000). It is known that ai = (ai–1 + ai+1)/2 – ci   for each i=1, 2, ..., n. You are given a0, ...
分类:其他好文   时间:2015-01-18 18:37:25    阅读次数:252
4Sum Leetcode Python
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in...
分类:编程语言   时间:2015-01-17 13:59:19    阅读次数:171
3Sum Leetcode Python
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) mu...
分类:编程语言   时间:2015-01-17 10:02:22    阅读次数:232
leetcode 【 Remove Element 】python 实现
题目:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't ...
分类:编程语言   时间:2015-01-16 22:14:22    阅读次数:257
Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:其他好文   时间:2015-01-16 18:48:24    阅读次数:139
[C++]LeetCode: 100 Convert Sorted Array to Binary Search Tree (AVL树)
题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 思路:给出一个排序的数组,如何构造一个平衡二叉查找树?平衡二叉查找树要求任一结点的左右子树的高度差不能超过一,也叫做高度平衡树。如果让我们从一个排序数组中选取一个元素做树的根,我们会选择哪一个...
分类:编程语言   时间:2015-01-16 16:51:25    阅读次数:237
LeetCode Subsets II
Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order....
分类:其他好文   时间:2015-01-16 01:05:01    阅读次数:188
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!