码迷,mamicode.com
首页 >  
搜索关键字:lintcode    ( 1584个结果
排颜色问题——数组 leetcode lintcode
问题描述: 给一个数组,并且数组里面元素的值只可能是0,1,2,然后现在把这个数组排序。 另外一种表述: 现有n个红白蓝三种不同颜色的小球,乱序排列在一起,请通过两两交换任意两个球,使得从左至右,依次是一些红球、一些白球、一些蓝球。 解题思路: 采用快速排序partition的思想,用两个指针将三种颜色间隔开。 下面引用此处内容 July 编程艺术系列中荷兰国旗问题。 一个...
分类:编程语言   时间:2015-06-08 09:45:17    阅读次数:213
Lintcode运算符重载
实现赋值运算符重载函数,确保: 新的数据可准确地被复制旧的数据可准确地删除/释放可进行 A = B = C 赋值 class Solution { public: char *m_pData; Solution() { this->m_pData = NULL; } Solution(char *pData) { th...
分类:其他好文   时间:2015-06-08 01:07:46    阅读次数:142
lintcode 1: Data Stream Median
lintcode 1: Data Stream Median python java c++...
分类:其他好文   时间:2015-06-06 16:38:45    阅读次数:136
[LintCode] Minimum Adjustment Cost
Minimum Adjustment CostGiven an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given num...
分类:其他好文   时间:2015-06-03 13:19:07    阅读次数:145
[LintCode] Remove Node in Binary Search Tree
http://www.lintcode.com/en/problem/remove-node-in-binary-search-tree/# Given a root ofBINARY Search Tree with unique value for each node. Remove the n...
分类:其他好文   时间:2015-06-01 18:46:58    阅读次数:87
[LintCode] Subarray Sum & Subarray Sum II
Subarray SumGiven an integer array, find a subarray where the sum of numbers iszero. Your code should return the index of the first number and the ind...
分类:其他好文   时间:2015-06-01 13:00:46    阅读次数:92
[Lintcode] Maximum Gap Problem
问题描述在一个无序的数组中,如果对其进行排序,然后扫描一遍有序数组,可以获得相邻两元素的最大差值,比如 {-1, 2, 4, 9},那么最大差值就是4和9之间,是5. 现在如果不对原始数组进行排序,有什么好的方案,来获取有序形式下的最大差值? Given an unsorted array, find the maximum difference between the successive...
分类:其他好文   时间:2015-05-31 16:53:29    阅读次数:109
九章算法面试题72 翻转链表I
给一个链表,然后我们要把这个链表进行翻转。...
分类:编程语言   时间:2015-05-29 10:01:08    阅读次数:113
九章算法面试题71 平方根
给定一个数,怎么样不用系统函数sqrt,可以求得它的平方根的答案。...
分类:编程语言   时间:2015-05-29 09:59:23    阅读次数:187
九章算法面试题70 排颜色II sort colors
九章算法官网-原文网址http://www.jiuzhang.com/problem/71/题目给定一个有n个对象(包括k种不同的颜色,并按照1到k进行编号)的数组,将对象进行分类使相同颜色的对象相邻,并按照1,2,...k的顺序进行排序。在线测试本题http://www.lintcode.com/...
分类:编程语言   时间:2015-05-29 06:11:17    阅读次数:504
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!