码迷,mamicode.com
首页 >  
搜索关键字:sparse array    ( 29791个结果
Maximum Subarray
题目 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,...
分类:其他好文   时间:2014-06-19 12:08:20    阅读次数:270
Jump Game II
题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. ...
分类:其他好文   时间:2014-06-19 11:46:47    阅读次数:277
Anagrams
题目 Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 方法 题目中是找出所有的字符串由相同的字符组成,只是顺序不同。 public List anagrams(St...
分类:其他好文   时间:2014-06-19 10:46:45    阅读次数:207
Jump Game
题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. ...
分类:其他好文   时间:2014-06-19 10:05:39    阅读次数:278
C#的ArrayList集合的使用
集合类是一种将各相同类型的对象集合起来的类,数组实质上也是集合类型中的一种。 集合主要是以线性结构存储结构 C#提供ArrayList类、Queue类、Stack类 1.ArrayList类简介: ArrayList类可以动态地添加和删除元素。 ArrayList类相当于一种高级的动态数组,是Array类的升级版本,但它并不等同于数组。 2.与数...
分类:其他好文   时间:2014-06-19 09:55:19    阅读次数:229
C++类设计过程中的原则(总结)
一、由编译器生成的成员函数 1)默认的构造函数 默认构造函数定义为没有参数,或者有默认的参数值。当用户自己未定义时,系统可以提供。 自动生成的默认构造函数,会调用继承的基类的默认构造函数来构造派生类的基类部分。 若Star是一个类,则 Star orig; Star array[6];都将需要默认构造函数。 如果自己定义了构造函数,则系统不会再生成默认构造函数,这个时候最好自己要定义...
分类:编程语言   时间:2014-06-16 12:23:39    阅读次数:262
swift 笔记 (十二) —— 下标
下标 swift允许我们为 类,结构体,枚举 定义下标,以更便捷的方式访问一大堆属性。比如Array和Dictionary都是结构体,swift的工程师已经为这两个类型提供好了下标操作的代码,所以,我们才可以通过 myArray[2]这种方式,读取和改写这个struct中保存的数据。而且,一个类型中可以定义多种下标访问方式(重载,关于重载,在后面的笔记中会提到,这里先不用太在意) 下标...
分类:其他好文   时间:2014-06-16 11:35:16    阅读次数:173
Rotate Image
题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 方法 矩阵坐标的转换,循环替换。 public voi...
分类:其他好文   时间:2014-06-16 11:28:03    阅读次数:199
C语言求质数的算法
qianya 上次被出了一题质数的C语言求解题目,当时用了最粗暴的算法,回来仔细参考资料,其实答案有很多种: 1,小学生版本:判断 x 是否为质数,就从 2 一直算到 x-1。 static rt_uint32_t array1[ARRAY_LEN]; void func1(void) {     for (rt_uint32_t i = 1; i     {         a...
分类:编程语言   时间:2014-06-15 17:23:51    阅读次数:412
Search for a Range
题目 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target i...
分类:其他好文   时间:2014-06-15 16:53:32    阅读次数:177
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!